Browse Source

【英唐-CATL条码对接】

wuyx 1 year ago
parent
commit
887c1ed1c7

+ 0 - 72
src/main/java/com/uas/eis/config/DonlimConfig.java

@@ -1,72 +0,0 @@
-package com.uas.eis.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-@Component
-@ConfigurationProperties(prefix = "extral.donlim")
-public class DonlimConfig {
-    public String getRoute() {
-        return route;
-    }
-
-    public void setRoute(String route) {
-        this.route = route;
-    }
-
-    public String getAppKey() {
-        return appKey;
-    }
-
-    public void setAppKey(String appKey) {
-        this.appKey = appKey;
-    }
-
-    public String getAppSecret() {
-        return appSecret;
-    }
-
-    public void setAppSecret(String appSecret) {
-        this.appSecret = appSecret;
-    }
-
-    public String getToken() {
-        return token;
-    }
-
-    public void setToken(String token) {
-        this.token = token;
-    }
-
-    public String getTaxnum() {
-        return taxnum;
-    }
-
-    public void setTaxnum(String taxnum) {
-        this.taxnum = taxnum;
-    }
-
-    public boolean isProd() {
-        return true;
-    }
-
-    public void setProd(boolean prod) {
-        isProd = prod;
-    }
-
-    /**
-     * 请求路径
-     */
-   private String route ;
-
-   private String appKey;
-
-   private String appSecret;
-
-    private String token;
-
-    private String taxnum;
-
-    private boolean isProd;
-}

+ 10 - 46
src/main/java/com/uas/eis/controller/ERPController.java

@@ -1,19 +1,19 @@
 package com.uas.eis.controller;
 
-import com.uas.eis.sdk.entity.ApiResult;
-
 import com.uas.eis.service.ERPService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
 
 
 /**
- * @author koul
- * @email koul@usoftchina.com
- * @date 2021-12-07 9:31
+ * @author WUYX
+ * @email wuyx@usoftchina.com
+ * @date 2024-03-25
  */
 @RestController
 public class ERPController {
@@ -21,47 +21,11 @@ public class ERPController {
     private ERPService erpService;
 
     /**
-     *开票订单对接-创建订单
+     * 创建条码ID
      */
-    @RequestMapping("/erp/pushInvoiceOrder")
-    public Map<String, Object> pushInvoiceOrder(String master, Integer id){
-        return erpService.pushInvoiceOrder(master,id);
-    }
-    /**
-     *开票订单对接-订单状态查询
-     */
-    @RequestMapping("/erp/findOrderState")
-    public Map<String, Object>findOrderState(String master,int id){
-        return erpService.findOrderState(master,id);
-    }
-    /*
-    * 开票订单-提交开票(目前不启用此接口,财务人员去平台开票)
-    * */
-    public Map<String, Object> invoiceOrderSubmitKp(String master,int id){
-        return erpService.invoiceOrderSubmitKp(master,id);
+    @RequestMapping(value="/erp/createSticker",method=RequestMethod.POST)
+    @ResponseBody
+    public Map<String, Object> createSticker(String master, Integer id){
+        return erpService.createSticker(master,id);
     }
-    /**
-     * 开票订单删除
-     */
-    @RequestMapping("/erp/cancelInvoiceOrder")
-    public Map<String, Object> cancelInvoiceOrder(String master, Integer id){
-        return erpService.cancelInvoiceOrder(master,id);
-    }
-
-    /**
-     * 开票订单-获取发票
-     */
-    @RequestMapping("/erp/getElecInvoicesById")
-    public Map<String, Object> getElecInvoices(String master, Integer id){
-        return erpService.getElecInvoicesById(master,id);
-    }
-
-    /**
-     * 红冲
-     */
-    @RequestMapping("/erp/rushRed")
-    public Map<String, Object> rushRed(String master, Integer id){
-        return erpService.rushRed(master,id);
-    }
-
 }

+ 3 - 12
src/main/java/com/uas/eis/service/ERPService.java

@@ -1,7 +1,6 @@
 package com.uas.eis.service;
 
 
-import com.uas.eis.sdk.entity.ApiResult;
 
 import java.util.List;
 import java.util.Map;
@@ -12,15 +11,7 @@ import java.util.Map;
  * @date 2021-12-06 18:25
  */
 public interface ERPService {
-    Map<String, Object> pushInvoiceOrder(String master, int id);
-    Map<String, Object> invoiceOrderSubmitKp(String master,int id);
-    Map<String, Object> findOrderState(String master,int id);
-    Map<String, Object> cancelInvoiceOrder(String master, int id);
-    Map<String, Object> getElecInvoicesById(String master, Integer id);
-    Map<String, Object> getElecInvoices(Map<String,Object> m);
-    Map<String, Object> rushRed(String master, int id);
-    Map<String, Object> queryInvoiceRedConfirm(Map<String,Object> m);
-    Map<String,Object> queryRedPdfUrl(List<String> serialNosAll, Map<String,Object> m);
-
-    Map<String, Object> getRedReturnElecInvoices(Map<String,Object> m);
+    Map<String, Object> createSticker(String master, Integer id);
+    Map<String, Object> getToken(Map<String, String> map);
+    Map<String, Object> updateStickerByList(String master, Integer id,Map<String, String> map,List<Map<String,Object>> updateLists);
 }

+ 196 - 709
src/main/java/com/uas/eis/service/Impl/ERPServiceImpl.java

@@ -1,28 +1,18 @@
 package com.uas.eis.service.Impl;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.TypeReference;
-import com.uas.eis.config.DonlimConfig;
 import com.uas.eis.core.config.SpObserver;
 import com.uas.eis.core.support.TokenProperties;
 import com.uas.eis.dao.*;
-import com.uas.eis.dto.*;
-import com.uas.eis.service.CommonService;
 import com.uas.eis.service.ERPService;
-import com.uas.eis.service.NuoNuoSDKService;
 import com.uas.eis.utils.*;
-import nuonuo.open.sdk.NNOpenSDK;
-import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 
-import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * @author koul
@@ -37,733 +27,230 @@ public class ERPServiceImpl implements ERPService {
     @Autowired
     private BaseDao baseDao;
 
-    @Autowired
-    private DonlimConfig donlimConfig;
-    @Autowired
-    private CommonService commonService;
-    @Autowired
-    private NuoNuoSDKService nuoNuoSDKService;
-
-    @Override
-    public Map<String, Object> pushInvoiceOrder(String master, int id) {
-        Map<String, Object> map = new HashMap<String, Object>();
-        Object[] obs = baseDao.getFieldsDataByCondition("YITOA_DATACENTER.dock_invoice_config", new String[]{"appKey", "appSecret", "token", "taxnum"}, "username='" + master + "'");
-        String url = donlimConfig.getRoute();
-        System.out.println(url);
-        String appKey = donlimConfig.getAppKey();
-        String appSecret = donlimConfig.getAppSecret();
-        String token = donlimConfig.getToken();
-        String taxnum = donlimConfig.getTaxnum();
-        if (donlimConfig.isProd()) {
-            appKey = obs[0].toString();
-            appSecret = obs[1].toString();
-            token = obs[2].toString();// 访问令牌
-            taxnum = obs[3].toString();// 授权企业税号
-        }
-        logger.info("pushInvoiceOrder begin: master {} ,id {} ", master, id);
-        SpObserver.putSp(master);
-        SqlRowList rs_main = baseDao.queryForRowSet("select * from invoiceOrder left join customer on io_cucode=cu_code " +
-                " left join YITOA_DATACENTER.custinvoicemsg on ci_cucode = cu_code " +
-                " where io_id=" + id);
-        if (rs_main.next()) {
-            //String autoInvoiceFlag= baseDao.isDBSetting("InvoiceOrder", "autoInvoice")?"true":"false";
-            //数据组装
-            InvoiceOrderDTO invoiceOrderDTO = new InvoiceOrderDTO();
-            invoiceOrderDTO.setOrderType(rs_main.getGeneralString("IO_ORDERTYPE"));
-            invoiceOrderDTO.setAutoInvoiceFlag(rs_main.getGeneralString("io_autoinvoice"));//自动开票
-            invoiceOrderDTO.setRepeatCall("0");
-
-            OrderDTO orderDTO = new OrderDTO();
-            orderDTO.setOriginalOrderNo(rs_main.getGeneralString("io_code"));
-            orderDTO.setAddDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(rs_main.getDate("io_date")));
-            orderDTO.setInvoiceLine(rs_main.getGeneralString("io_invoiceline"));
-            orderDTO.setSpecificFactor("0");
-            orderDTO.setSaleTaxNum(donlimConfig.getTaxnum());//
-            orderDTO.setBuyerName(rs_main.getGeneralString("cu_name"));//客户名称
-            orderDTO.setTaxNum(rs_main.getGeneralString("ci_taxnum").trim());//购方税号
-            orderDTO.setAccount(rs_main.getGeneralString("ci_account"));
-            orderDTO.setAddress(rs_main.getGeneralString("ci_address"));
-            orderDTO.setTelephone(rs_main.getGeneralString("ci_telephone"));
-            orderDTO.setRemark(rs_main.getGeneralString("io_remark"));
-            orderDTO.setPayee(rs_main.getGeneralString("IO_PAYEE"));
-            orderDTO.setChecker(rs_main.getGeneralString("IO_CHECKER"));
-            orderDTO.setPhone(rs_main.getGeneralString("ci_jf_phone"));
-            orderDTO.setEmail(rs_main.getGeneralString("ci_jf_email"));
-            //原销售订单编号relateSaleOrderNo
-            orderDTO.setRelateSaleOrderNo(rs_main.getGeneralString("io_RelateSaleOrderNo"));
-            //原发票号码yfphm
-            orderDTO.setYfphm(rs_main.getGeneralString("io_Yfphm"));
-            invoiceOrderDTO.setOrderInfo(orderDTO);
-
-            SqlRowList rs_det = baseDao.queryForRowSet("select * from invoiceOrderdet_view where id_ioid=" + id + " order by id_detno");
-            List<OrderDetDTO> dets = new ArrayList<>();//商品列表
-            while (rs_det.next()) {
-                OrderDetDTO orderDetDTO = new OrderDetDTO();
-                orderDetDTO.setRowNo(rs_det.getGeneralString("id_id"));//唯一值
-                orderDetDTO.setGoodsName(rs_det.getGeneralString("pr_detail"));
-                orderDetDTO.setSpec(rs_det.getGeneralString("pr_spec"));
-                orderDetDTO.setUnit(rs_det.getGeneralString("pr_unit"));
-                orderDetDTO.setNum(rs_det.getGeneralString("id_qty"));
-                //orderDetDTO.setPrice(rs_det.getGeneralString("id_price"));//平台算法问题 传单价会有差异,校验可能不通过,所有传金额和数量,不传单价
-                orderDetDTO.setTaxRate(rs_det.getGeneralString("taxrate"));//0.13
-                orderDetDTO.setTaxAmount(rs_det.getGeneralString("id_amount"));
-                orderDetDTO.setHsbz(rs_det.getGeneralString("hsbz"));
-                orderDetDTO.setSpbm(rs_det.getGeneralString("spbm"));
-                orderDetDTO.setZke(rs_det.getGeneralString("ZKE"));
-                dets.add(orderDetDTO);
-            }
-            invoiceOrderDTO.setOrderOriginalDetails(dets);
-            invoiceOrderDTO.setInvoiceGoodsTransports(new ArrayList<>());
-            System.out.println(JSONArray.toJSONString(invoiceOrderDTO));
-            //调用对接
-            NNOpenSDK sdk = NNOpenSDK.getIntance();
-            String method = "nuonuo.OpeMplatform.saveOrder"; // API方法名
-            String content = sdk.convertToUtf8(JSONArray.toJSONString(invoiceOrderDTO));
-            String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-            String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-            logger.info("pushInvoiceOrder resultString {}, token {}", result, token);
-            Map<Object, Object> res = JSONUtil.toMap(result);
-            System.out.println(result);
-            Object status = res.get("status");
-            Object message = res.get("message");
-            if (status != null && "0000".equals(status.toString())) {//调用成功
-                baseDao.execute("update invoiceOrder set io_dockstatus='对接成功',IO_INVOICESTATUS=0 where io_id=" + id);
-                commonService.logSRecord("开票订单对接", id);
-            } else if (status != null && "9999".equals(status.toString()) && message != null && message.toString().contains("已存在原始订单")) {
-                baseDao.execute("update invoiceOrder set io_dockstatus='对接成功',IO_INVOICESTATUS=0 where io_id=" + id);
-                commonService.logFRecord("开票订单对接", "(" + status + ")" + message, id);
-            } else {
-                baseDao.execute("update invoiceOrder set io_dockstatus='对接失败' where io_id=" + id);
-                commonService.logFRecord("开票订单对接", "(" + status + ")" + message, id);
-            }
-            logger.info("pushInvoiceOrder master {} ,id {} status {} message {}", master, id, status, message);
-            map.put("success", true);
-            map.put("status", status);
-            map.put("message", message);
-            return map;
-        } else {//数据无效
-            logger.info("pushInvoiceOrder err {对接源信息无效} ,master {} , id {} status {} message {}", master, id);
-            map.put("success", false);
-            map.put("message", "对接源信息无效");
-            return map;
-        }
-    }
-
-    @Override
-    public Map<String, Object> invoiceOrderSubmitKp(String master, int id) {
-        Object[] obs = baseDao.getFieldsDataByCondition("YITOA_DATACENTER.dock_invoice_config", new String[]{"appKey", "appSecret", "token", "taxnum"}, "username='" + master + "'");
-        String url = donlimConfig.getRoute();
-        System.out.println(url);
-        String appKey = donlimConfig.getAppKey();
-        String appSecret = donlimConfig.getAppSecret();
-        String token = donlimConfig.getToken();
-        String taxnum = donlimConfig.getTaxnum();
-        if (donlimConfig.isProd()) {
-            appKey = obs[0].toString();
-            appSecret = obs[1].toString();
-            token = obs[2].toString();// 访问令牌
-            taxnum = obs[3].toString();// 授权企业税号
-        }
-        SpObserver.putSp(master);
-        SqlRowList rs_main = baseDao.queryForRowSet("select * from invoiceOrder left join customer on io_cucode=cu_code where io_id=" + id);
-        if (rs_main.next()) {
-            NNOpenSDK sdk = NNOpenSDK.getIntance();
-            String method = "nuonuo.OpeMplatform.submitKp"; // API方法名
-            String code = rs_main.getGeneralString("io_code");
-            Map<String, String> reqParam = new HashMap<>();
-            reqParam.put("orderNo", code);
-            String content = JSONArray.toJSONString(reqParam);
-            String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-            String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-            System.out.println(result);
-        } else {//数据无效
-            logger.info("findOrderState err {对接源信息无效} ,master {} , id {} status {} message {}", master, id);
-        }
-
-        return null;
-    }
-
-    @Override
-    public Map<String, Object> findOrderState(String master, int id) {
-        Map<String, Object> map = new HashMap<String, Object>();
-        Object[] obs = baseDao.getFieldsDataByCondition("YITOA_DATACENTER.dock_invoice_config", new String[]{"appKey", "appSecret", "token", "taxnum"}, "username='" + master + "'");
-        if (obs == null) {
-            return null;//对接信息为配置
-        }
-        String url = donlimConfig.getRoute();
-        String appKey = donlimConfig.getAppKey();
-        String appSecret = donlimConfig.getAppSecret();
-        String token = donlimConfig.getToken();
-        String taxnum = donlimConfig.getTaxnum();
-        if (donlimConfig.isProd()) {
-            appKey = obs[0].toString();
-            appSecret = obs[1].toString();
-            token = obs[2].toString();// 访问令牌
-            taxnum = obs[3].toString();// 授权企业税号
-        }
-        SpObserver.putSp(master);
-        SqlRowList rs_main = baseDao.queryForRowSet("select * from invoiceOrder left join customer on io_cucode=cu_code where io_id=" + id);
-        if (rs_main.next()) {
-            String code = rs_main.getGeneralString("io_code");
-            NNOpenSDK sdk = NNOpenSDK.getIntance();
-            String method = "nuonuo.OpeMplatform.findOrderState"; // API方法名
-            Map<String, String> reqParam = new HashMap<>();
-            reqParam.put("originalOrderNo", code);
-            reqParam.put("saleTaxNum", taxnum);
-            String content = JSONArray.toJSONString(reqParam);
-            String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-            String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-            System.out.println(result);
-            FindOrderStateResp resp = JSON.parseObject(result, new TypeReference<FindOrderStateResp>() {
-            });
-            System.out.println(resp.getCode());
-            System.out.println(resp.getMessage());
-            if ("该订单不存在".equals(resp.getMessage())) {
-                baseDao.execute("update invoiceOrder set IO_INVOICESTATUS = '-1' where io_id = '" + id + "'");
-            } else {
-                baseDao.execute("update invoiceOrder set IO_INVOICESTATUS = '" + resp.getData().getInvoiceStatus() + "'"
-                        + ",io_errorMsg='" + StringUtil.nvl(resp.getData().getErrorMsg(), "") + "'"
-                        + " where io_id = '" + id + "'");
-            }
-
-            map.put("success", true);
-            map.put("result", result);
-            return map;
-        } else {//数据无效
-            logger.info("findOrderState err {对接源信息无效} ,master {} , id {} status {} message {}", master, id);
-        }
-        return null;
-    }
-
-    @Override
-    public Map<String, Object> cancelInvoiceOrder(String master, int id) {
-        Map<String, Object> map = new HashMap<String, Object>();
-        Object[] obs = baseDao.getFieldsDataByCondition("YITOA_DATACENTER.dock_invoice_config", new String[]{"appKey", "appSecret", "token", "taxnum"}, "username='" + master + "'");
-        if (obs == null) {
-            return null;//对接信息为配置
-        }
-        String url = donlimConfig.getRoute();
-        System.out.println(url);
-        String appKey = donlimConfig.getAppKey();
-        String appSecret = donlimConfig.getAppSecret();
-        String token = donlimConfig.getToken();
-        String taxnum = donlimConfig.getTaxnum();
-        if (donlimConfig.isProd()) {
-            System.out.println("prod");
-            appKey = obs[0].toString();
-            appSecret = obs[1].toString();
-            token = obs[2].toString();// 访问令牌
-            taxnum = obs[3].toString();// 授权企业税号
-        } else {
-            System.out.println("dev");
-        }
-        SpObserver.putSp(master);
-        SqlRowList rs_main = baseDao.queryForRowSet("select * from invoiceOrder left join customer on io_cucode=cu_code where io_id=" + id);
-        if (rs_main.next()) {
-            String code = rs_main.getGeneralString("io_code");
-            Map<String, String> reqParam = new HashMap<>();
-            reqParam.put("originalOrderNo", code);
-            reqParam.put("saleTaxNum", taxnum);
-
-            String content = JSONArray.toJSONString(reqParam);
-            NNOpenSDK sdk = NNOpenSDK.getIntance();
-            String method = "nuonuo.OpeMplatform.deleteOrder"; // API方法名
-            String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-            String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-            Map<Object, Object> res = JSONUtil.toMap(result);
-            System.out.println(result);
-            Object status = res.get("status");
-            Object message = res.get("message");
-            if (status != null && "0000".equals(status.toString())) {//调用成功
-                baseDao.execute("update invoiceOrder set io_dockstatus='' where io_id=" + id);
-                baseDao.execute("insert into invoicedockLog(id_,code_,date_,result_,err_,keyvalue_)values(invoicedockLog_seq.nextval,'开票订单删除',sysdate,'SUCCEED',''," + id + ") ");
-                map.put("success", true);
-                map.put("message", message);
-            } else {
-                baseDao.execute("update invoiceOrder set io_dockstatus='取消失败' where io_id=" + id);
-                baseDao.execute("insert into invoicedockLog(id_,code_,date_,result_,err_,keyvalue_)values(invoicedockLog_seq.nextval,'开票订单删除',sysdate,'FAILED','(" + status + ")" + message + "'," + id + ") ");
-                map.put("success", false);
-                map.put("message", "(" + status + ")" + message);
-            }
-            logger.info("cancelInvoiceOrder master {} ,id {} status {} message {}", master, id, status, message);
-            return map;
-        } else {//数据无效
-            logger.info("cancelInvoiceOrder err {对接源信息无效} ,master {} , id {} status {} message {}", master, id);
-        }
-        return null;
-    }
-
-    @Override
-    public Map<String, Object> getElecInvoicesById(String master, Integer id) {
-        Map<String, Object> map = new HashMap<String, Object>();
-        Object[] obs = baseDao.getFieldsDataByCondition("YITOA_DATACENTER.dock_invoice_config", new String[]{"appKey", "appSecret", "token", "taxnum"}, "username='" + master + "'");
-        if (obs == null) {
-            return null;//对接信息为配置
-        }
-//        System.out.println(url);
-        String appKey = donlimConfig.getAppKey();
-        String appSecret = donlimConfig.getAppSecret();
-        String token = donlimConfig.getToken();
-        String taxnum = donlimConfig.getTaxnum();
-        logger.info("ElecI-getElecInvoicesById:master {} isProd {}", SpObserver.getSp(), donlimConfig.isProd());
-        if (donlimConfig.isProd()) {
-            appKey = obs[0].toString();
-            appSecret = obs[1].toString();
-            token = obs[2].toString();// 访问令牌
-            taxnum = obs[3].toString();// 授权企业税号
-        }
-        Map<String, Object> m = new HashMap<>();
-        m.put("appKey", appKey);
-        m.put("appSecret", appSecret);
-        m.put("token", token);
-        m.put("taxnum", taxnum);
-        SpObserver.putSp(master);
-        SqlRowList ioList = baseDao.queryForRowSet("select io_id,io_code,io_ordertype from " + master + ".invoiceOrder left join " + master + ".customer on io_cucode=cu_code " +
-                " where io_id = " + id);
-        while (ioList.next()) {
-            m.put("io_id", ioList.getGeneralInt("io_id"));
-            m.put("io_code", ioList.getGeneralString("io_code"));
-            m.put("io_ordertype", ioList.getGeneralInt("io_ordertype"));
-            map = getElecInvoices(m);
-        }
-        return map;
-    }
-
     @Override
-    public Map<String, Object> getElecInvoices(Map<String, Object> m) {
-        if (Integer.valueOf(m.get("io_ordertype").toString()).equals(2)) {
-            return getRedReturnElecInvoices(m);
-        }
-        String taxnum = m.get("taxnum").toString();
-        int ioid = Integer.valueOf(m.get("io_id").toString());
-        String ioCode = m.get("io_code").toString();
-        Map<String, Object> res = new HashMap<String, Object>();
-        String errCode = "-999";
-        String errMsg = "";
-        try {
-            //调用对接
-            FindOrderRelationInvoiceReq foriReq = new FindOrderRelationInvoiceReq();
-            foriReq.setOriginalOrderNo(ioCode);//订单编号
-            foriReq.setSaleTaxNum(taxnum);//销方税号
-            foriReq.setNeedInvoiceSourceDetail("1");//是否需要发票所来源的订单明细,1-是, 0-否(不填默认 0) 当为0时,将不回传orderDetailCallBackVOS。先默认不需要明细
-            FindOrderRelationInvoiceResp resp = nuoNuoSDKService.findOrderRelationInvoice(foriReq, m);
-            errCode = resp.getStatus();
-            errMsg = resp.getMessage();
-            logger.info("ElecI-DownLoad-master: {} ,id {} status {} message {}", SpObserver.getSp(), ioid, errCode, errMsg);
-            if ("0000".equals(errCode)) {//调用成功
-                //记录发票明细
-                baseDao.execute(getElecInvoicesSqls(ioid, resp.getData()));
-                //红字
-                commonService.logSRecord("订单关联发票对接", ioid);
-            } else if (!"8958".equals(errCode)) {//  {"status":"8958","message":"该订单对应的开票单不存在","data":null} 没有开票单的不记录对接失败日志
-                if (errMsg.length() > 3980) {
-                    errMsg = errMsg.substring(0, 3980);
-                }
-                baseDao.execute("update invoiceOrder set io_errorMsg='订单关联发票查询失败: " + errMsg + "' where io_id=" + ioid);
-                commonService.logFRecord("订单关联发票对接", "(" + errCode + ")" + errMsg, ioid);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            errMsg = "发票获取异常";
-            if (StringUtil.hasText(e.getMessage())) {
-                errMsg = e.getMessage();
-            } else if (e.getCause() != null && StringUtil.hasText(e.getCause().getMessage())) {
-                errMsg = e.getCause().getMessage();
-            }
-            logger.info("ElecI-DownLoad-master: {} ,id {} message {}", SpObserver.getSp(), ioid, errMsg);
-            commonService.logFRecord("订单关联发票对接", errMsg.replaceAll("'", "''"), ioid);
-        }
-        //获取红字发票PDF地址
-        List<String> serialNosAll = baseDao.queryForList("select ei_redsid from ElecInvoice " +
-                "where ei_ioid = " + ioid + " and EI_RELATIVEREFNO is not null and ei_redpdfurl is null and nvl(EI_BILLSTATUS,' ') in (' ','01','04')", String.class);
-        if (!CollectionUtil.isEmpty(serialNosAll)) {
-            queryRedPdfUrl(serialNosAll, m);
-        }
-        if (StringUtil.hasText(errMsg) && !"调用成功".equals(errMsg)) {
-            res.put("success", false);
-            res.put("errCode", errCode);
-            res.put("errMsg", errMsg);
-        } else {
-            res.put("success", true);
-        }
-        return res;
-    }
-
-    private List<String> getElecInvoicesSqls(int ioid, List<FindOrderRelationInvoiceDTO> data) {
-        List<String> sqls = new ArrayList<String>();
-        boolean syncToBillOut = baseDao.isDBSetting("BillOut", "syncToBillOut");
-        for (int i = 0; i < data.size(); i++) {
-            FindOrderRelationInvoiceDTO friDto = data.get(i);
-            sqls.addAll(friDto.toMergeSql(ioid, (i + 1)));
-        }
-        sqls.add(" update invoiceOrder set io_refno = (" +
-                "  select (min(ei_refno)||(case when max(ei_refno) <> min(ei_refno) then '-'||max(ei_refno) else '' end)) " +
-                "  from ELECINVOICE  " +
-                "     where ei_ioid = io_id and EI_INVOICETYPE = 1 " +
-                "        and ( nvl(ei_rushredstate,0) <> 1 or (nvl(ei_rushredstate,0) = 1 and exists (Select 1 from invoiceOrder redio where redio.io_ordertype=2 and redio.io_yfphm = ei_refno)) ) " +
-                "     ) " +
-                "  where io_id = " + ioid);
-        //更新开票记录
-        if (syncToBillOut) {
-            sqls.add("update BillOut set bi_refno = (select max(io_refno) from invoiceOrder where io_id = " + ioid + " and io_biid = bi_id) where bi_id in (select io_biid from invoiceOrder where io_id = " + ioid + " and io_refno is not null)");
-        }
-//        System.out.println("sqls:");
-//        System.out.println(sqls.toString());
-        return sqls;
-    }
-
-    @Override
-    public Map<String, Object> rushRed(String master, int id) {
-        Map<String, Object> map = new HashMap<String, Object>();
-        Object[] obs = baseDao.getFieldsDataByCondition("YITOA_DATACENTER.dock_invoice_config", new String[]{"appKey", "appSecret", "token", "taxnum"}, "username='" + master + "'");
-        String url = donlimConfig.getRoute();
-        String appKey = donlimConfig.getAppKey();
-        String appSecret = donlimConfig.getAppSecret();
-        String token = donlimConfig.getToken();
-        String taxnum = donlimConfig.getTaxnum();
-        if (donlimConfig.isProd()) {
-            appKey = obs[0].toString();
-            appSecret = obs[1].toString();
-            token = obs[2].toString();// 访问令牌
-            taxnum = obs[3].toString();// 授权企业税号
-        }
-        Map<String, Object> m = new HashMap<>();
-        m.put("appKey", appKey);
-        m.put("appSecret", appSecret);
-        m.put("token", token);
-        m.put("taxnum", taxnum);
-        logger.info("rushRed begin: master {} ,id {} ", master, id);
+    public Map<String, Object> createSticker(String master, Integer id) {
+        Map<String,Object> retMap = new HashMap<>();
+        retMap.put("success",true);
+        logger.info("createSticker-Begin:master {} id {}",master,id);
         SpObserver.putSp(master);
-        StringBuffer errmsg = new StringBuffer();
-        StringBuffer remindmsg = new StringBuffer();
-        SqlRowList rs_main = baseDao.queryForRowSet("select * from invoiceOrder left join customer on io_cucode=cu_code left join elecinvoice on io_id=ei_ioid where io_id=" + id + " and nvl(ei_redapplyid,' ')=' ' and nvl(EI_INVOICESTATE,0)=1 and nvl(EI_INVOICETYPE,0)=1 ");
-        if (rs_main.hasNext()) {
-            int scount = 0;
-            while (rs_main.next()) {
-                RedInvoiceReq redInvoiceReq = new RedInvoiceReq();
-                redInvoiceReq.setBlueInvoiceLine(rs_main.getGeneralString("io_invoiceline"));//蓝票发票种类
-                redInvoiceReq.setApplySource("0");//申请方(录入方)身份: 0 销方 1 购方
-                redInvoiceReq.setSellerTaxNo(donlimConfig.getTaxnum());//销方税号
-                redInvoiceReq.setBuyerName(rs_main.getGeneralString("cu_name"));//购方名称
-                redInvoiceReq.setBuyerTaxNo(rs_main.getGeneralString("ei_taxno"));
-                redInvoiceReq.setRedReason(rs_main.getGeneralString("io_redreason"));
-                //redInvoiceReq.setAutoInvoice("1");//测试是否能自动红冲目前参数无效
-                redInvoiceReq.setBlueElecInvoiceNumber(rs_main.getGeneralString("ei_allelectronicinvoicenumber"));
-                NNOpenSDK sdk = NNOpenSDK.getIntance();
-                String content = sdk.convertToUtf8(JSONArray.toJSONString(redInvoiceReq));
-                String method = "nuonuo.OpeMplatform.saveInvoiceRedConfirm"; // API方法名
-                String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-                String resp = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-                Map<Object, Object> res = JSONUtil.toMap(resp);
-                Object code = res.get("code");
-                Object describe = res.get("describe");
-                Object result = res.get("result");
-                logger.info("rushRed master {} ,id {} code {} describe {} applycode {}", master, id, code, describe, result);
-                if (code != null && "E0000".equals(code.toString())) {//调用成功
-                    baseDao.execute("update elecinvoice set ei_redapplyid='" + result.toString() + "' where ei_id=" + rs_main.getGeneralInt("ei_id"));
-                    scount++;
-                    commonService.logSRecord("红字确认单申请(" + rs_main.getGeneralString("ei_refno") + ")", id);
-                } else {
-                    //E9755 describe 该发票存在进行中的红字确认单,暂时不能冲红
-                    commonService.logFRecord("红字确认单申请(" + rs_main.getGeneralInt("ei_id") + ")", "(" + code + ")" + describe, id);
-                    errmsg.append("(" + code + ")" + describe).append("</br>");
-                }
-            }
-            //没有自动开红票 但是可以拿状态
-            if (scount > 0) {
-                m.put("io_id", id);
-                m.put("ei_id", 0);
-                //获取红字确认状态等信息,若自动开票成功,则同时获取红票信息
-                Map<String, Object> mm = queryInvoiceRedConfirm(m);
-                if ("false".equals(mm.get("success")) && StringUtil.hasText(mm.get("errMsg"))) {
-                    remindmsg.append(mm.get("errMsg"));
-                }
-            }
-        } else {//数据无效
-            logger.info("rushRed err {对接源信息无效} ,master {} , id {} status {} message {}", master, id);
-            errmsg.append("对接源信息无效");
-            return map;
+        SqlRowList docLoist = baseDao.queryForRowSet("select CD_CPN matnr,min(CD_DC) ztcnno,pr_capacity zzxsmount,pr_zxbzs zbzsmount,sum(CD_QTY) zmount " +
+                "from CatlDocDetail left join product on pr_code = CD_PRCODE " +
+                "where cd_caid = ? and CD_PANID is null group by CD_CPN,pr_capacity,pr_zxbzs order by min(cd_detno)",id);
+        if(!docLoist.hasNext()){
+            System.out.println("no docLoist!");
+            retMap.put("success",false);
+            retMap.put("message","没有需要对接的明细.");
+            logger.info("createSticker-F:master {} id {} no docLoist!",master,id);
         }
-        if (errmsg.length() > 0) {
-            map.put("success", false);
-            if (remindmsg.length() > 0) {
-                errmsg.append(remindmsg.toString());
-            }
-            map.put("message", errmsg.toString());
-        } else {
-            map.put("success", true);
-            if (remindmsg.length() > 0) {
-                map.put("message", remindmsg.toString());
-            }
+        Object[] obs = baseDao.getFieldsDataByCondition("YITOA_DATACENTER.dock_catl_config A "
+                , new String[]{"URL_","deipaaskeyauth","appKey", "appSecret","VENDCODE"}
+                , "username='"+master+"' and A.ENVTYPE = (SELECT B.ENVTYPE FROM YITOA_DATACENTER.DOCK_CATL_EVCONFIG B WHERE A.username = B.username )");
+        String url = String.valueOf(obs[0]);
+        String deipaaskeyauth = String.valueOf(obs[1]);
+        String vendcode = String.valueOf(obs[4]);
+        Map<String,String> map = new HashMap<>();
+        map.put("url",url);
+        map.put("deipaaskeyauth",deipaaskeyauth);
+        map.put("appKey",String.valueOf(obs[2]));
+        map.put("appSecret",String.valueOf(obs[3]));
+        Map<String,Object> tokenMap = getToken(map);
+        if(!(boolean)tokenMap.get("success")){
+            return tokenMap;
         }
-        return map;
-    }
-
-    /*
-        条件:蓝票、有确认单号、待确认或者无需确认的情况下 持续获取红票相关信息
-        按照红冲确认单查询对应状态
-            可以查到信息: 确认单状态、开票状态、冲红原因、
-        若已开票,则自动获取红票 发票号:
-        冲红原因: 1销货退回 2开票有误 3服务中止 4销售折让
-     */
-    @Override
-    public Map<String, Object> queryInvoiceRedConfirm(Map<String, Object> m) {
-        int ioid = Integer.valueOf(m.get("io_id").toString());
-        int eiid = Integer.valueOf(m.get("ei_id").toString());
-        Map<String, Object> res = new HashMap<String, Object>();
-        StringBuffer errmsg = new StringBuffer();
-        SqlRowList bluePiao = baseDao.queryForRowSet("select ei_id,ei_redapplyid,ei_billStatus,ei_billNo,ei_billUuid,ei_taxExcludedAmount,ei_taxAmount,ei_redReason,io_ordertype " +
-                "from elecinvoice left join invoiceOrder on ei_ioid = io_id " +
-                "where ei_ioid = '" + ioid + "' " + (eiid > 0 ? "and ei_id = " + eiid : "")
-                + " and EI_INVOICETYPE = '1' and ei_redapplyid is not null and EI_RELATIVEREFNO is null and nvl(ei_billStatus,' ') in (' ','01','02','03','15') " +
-                "order by ei_Detno");
-        if (bluePiao.hasNext()) {
-            boolean isRushRedBill = false;
-            while (bluePiao.next()) {
-                String redApplyId = bluePiao.getGeneralString("ei_redapplyid");
-                eiid = bluePiao.getGeneralInt("ei_id");
-                m.put("ei_id", eiid);
-                QueryInvoiceRedConfirmReq qircReq = new QueryInvoiceRedConfirmReq();
-                qircReq.setIdentity("0");
-                qircReq.setBillId(redApplyId);
-                String rCode = "-999";
-                String describe = "";
-                String logCode = "发票红字确认状态查询";
-                try {
-                    QueryInvoiceRedConfirmResp qircResp = nuoNuoSDKService.queryInvoiceRedConfirm(qircReq, m);
-                    rCode = qircResp.getCode();
-                    describe = qircResp.getDescribe();
-                    logger.info("ElecI-queryInvoiceRedConfirmByCode:master {} ,redApplyid {} rCode {} describe {} total {}", SpObserver.getSp(), redApplyId, rCode, describe, qircResp.getResult().getTotal());
-                    if ("E0000".equals(rCode)) {//调用成功 记录发票明细 1135624457459470336
-                        List<String> sqls = new ArrayList<>();
-                        List<QueryInvoiceRedConfirmDTO> qircList = qircResp.getResult().getList();
-                        for (int i = 0; i < qircList.size(); i++) {
-                            QueryInvoiceRedConfirmDTO qircfDTO = qircList.get(i);
-                            //先获取红票状态 不一致才更新
-                            sqls.add("update elecinvoice set " +
-                                    "ei_billStatus='" + qircfDTO.getBillStatus() + "' " +
-                                    ",ei_billNo='" + StringUtil.nvl(qircfDTO.getBillNo(), "") + "' " + //990000008655037292
-                                    ",ei_billUuid='" + StringUtil.nvl(qircfDTO.getBillUuid(), "") + "' " +
-                                    ",ei_redsid='" + StringUtil.nvl(qircfDTO.getInvoiceSerialNum(), "") + "' " +
-                                    ",ei_redorderno='" + StringUtil.nvl(qircfDTO.getOrderNo(), "") + "' " +
-                                    ",ei_taxExcludedAmount='" + StringUtil.nvl(qircfDTO.getTaxExcludedAmount(), "0") + "' " +
-                                    ",ei_taxAmount='" + StringUtil.nvl(qircfDTO.getTaxAmount(), "0") + "' " +
-                                    ",ei_redReason='" + StringUtil.nvl(qircfDTO.getRedReason(), "") + "' " +
-                                    ",ei_openStatus='" + StringUtil.nvl(qircfDTO.getOpenStatus(), "0") + "' " +
-                                    " where ei_id = " + eiid);
-                            //针对自动开票场景:若开票,则记录红票数据,调用查询接口批量更新
-                            if ("1".equals(qircfDTO.getOpenStatus())) { //已开具红字发票标记: 1:已开具 0:未开具 //orderNo 20230731182154174492
-                                isRushRedBill = true;
-                                // serialNos 流水号 -- EI_SID -- invoiceSerialNum ; orderNos 开票单号 --- EI_ORDERNO -- ORDERNO
+        String action="/SNC/outer_SNC_createSticker?sap-client=810&interfacename=ZIRFC_TP2SNC_CREATESTICKER";
+        String deipaasjwt = "Bearer "+tokenMap.get("token");
+        map.put("deipaasjwt",deipaasjwt);
+        StringBuffer errMsg = new StringBuffer();
+        for (Map<String,Object> docMap: docLoist.getResultList()) {
+            try {
+                String matnr = String.valueOf(docMap.get("matnr"));
+                Map<String,Object> paraMap=new HashMap<>();
+                paraMap.put("matnr",matnr);//物料号:客户料号
+                paraMap.put("ztcnno",docMap.get("ztcnno"));//制造日期: 取最小DC
+                paraMap.put("zzstz",matnr);//供应商批次: 用型号作为虚拟批次
+//				paraMap.put("zeiar",docMap.get("zeiar"));//版本
+//				paraMap.put("zwidth",docMap.get("zwidth"));//宽度
+                paraMap.put("zmount",docMap.get("zmount"));//本次生产总数量
+//				paraMap.put("zzbsmount",docMap.get("zzbsmount"));//栈板容量
+                paraMap.put("zzxsmount",docMap.get("zzxsmount"));//纸箱容量
+                paraMap.put("zbzsmount",docMap.get("zbzsmount"));//包装袋容量
+//				paraMap.put("zremark",docMap.get("zremark"));//备注
+                paraMap.put("partner",vendcode);//供应商编码 固定值
+                HttpUtil.Response response = HttpUtil.doPost(url+action, JacksonUtil.toJson(paraMap), deipaaskeyauth,deipaasjwt);
+                if (response.getStatusCode() == HttpStatus.OK.value()){
+                    String res = response.getResponseText();
+                    if(res!=null && !"".equals(res)){
+//                        System.out.println("res:"+res);
+                        Map<String,Object> resData = JacksonUtil.fromJson(res);
+                        if("S".equals(String.valueOf(resData.get("e_type")))){
+                            List<Map<String,Object>> outdata = (List) resData.get("outdata");
+//                            List<Map<String,Object>> outdata = JacksonUtil.fromJsonArray(resData.get("outdata").toString());
+                            System.out.println("outdata.size:"+outdata.size());
+                            List<Map<String,Object>> idList = outdata.stream().filter(od->{
+                                return "1 ".equals(od.get("levels"));
+                            }).collect(Collectors.toList());
+                            //更新条码ID、箱ID
+                            List<String> sqls = new ArrayList<>();
+                            SqlRowList updateList = baseDao.queryForRowSet("select cd_id,cd_lotno,cd_dc,nvl(cd_ed,to_char(to_date(cd_dc,'yyyymmdd')+365,'yyyymmdd')) cd_ed from CatlDocDetail where cd_caid = ? and CD_CPN = ? and CD_PANID is null order by cd_detno",id,matnr);
+                            List<Map<String,Object>> updateStickerList = new ArrayList<>();
+                            if(idList.size() == updateList.getResultList().size()){
+                                for (int i = 0; i < updateList.getResultList().size(); i++) {
+                                    Map<String,Object> updateMap = updateList.getResultList().get(i);
+                                    Map<String,Object> idMap = idList.get(i);
+                                    sqls.add("update CatlDocDetail set CD_PANID='"+idMap.get("zalt_id")+"',CD_BOXID='"+idMap.get("zalt_id_upper")+"' where cd_id = "+updateMap.get("cd_id"));
+                                    Map<String,Object> updateStickerMap = new HashMap<>();
+                                    updateStickerMap.put("matnr",matnr);//物料号
+                                    updateStickerMap.put("zalt_id",idMap.get("zalt_id"));//贴纸ID
+                                    updateStickerMap.put("prtbatchid",updateMap.get("cd_lotno"));//供应商批次
+                                    updateStickerMap.put("manufacturing_date",updateMap.get("cd_dc"));//生产日期
+                                    updateStickerMap.put("atlyx",updateMap.get("cd_ed"));//有效日期
+                                    updateStickerList.add(updateStickerMap);
+                                }
+                                if(sqls.size()>0){
+                                    baseDao.execute(sqls);
+                                    //第二个接口 更新供应商批次
+                                    Map<String,Object> updateStickerMap = updateStickerByList(master, id,map,updateStickerList);
+                                    if(!(boolean) updateStickerMap.get("success")){
+                                        errMsg.append("更新供应商批次失败:客户料号:"+matnr).append(updateStickerMap.get("message")).append("</br>");
+                                    }
+                                }
+                            }else {
+                                errMsg.append("条码创建数与实际不一致,型号:"+matnr).append("创建数:"+idList.size()+",待更新数量:"+updateList.getResultList().size()).append("</br>");
+                            }
+                        }else {
+                            if(StringUtil.hasText(resData.get("e_message"))){
+                                errMsg.append("客户料号:"+matnr).append(resData.get("e_message")).append("</br>");
+                            }else {
+                                errMsg.append("客户料号:"+matnr).append("创建条码失败").append("</br>");
                             }
                         }
-                        baseDao.execute(sqls);
-                        describe = "";
-                    } else {
-                        if (describe.length() > 3980) {
-                            describe = describe.substring(0, 3980);
-                        }
-                        errmsg.append(describe).append("</br>");
-                        baseDao.execute("update elecinvoice set EI_EXCEPTIONMESSAGE='" + logCode + ": " + describe + "' where ei_id = " + eiid + " ");
-                        commonService.logFRecord(logCode, describe, eiid);
+                    }else{
+                        logger.info("getToken-F:No ResponseText");
+                        retMap.put("success",false);
+                        retMap.put("message", "No ResponseText");
                     }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    describe = "未知异常";
-                    if (StringUtil.hasText(e.getMessage())) {
-                        describe = e.getMessage();
-                    } else if (e.getCause() != null && StringUtil.hasText(e.getCause().getMessage())) {
-                        describe = e.getCause().getMessage();
-                    }
-                    commonService.logFRecord(logCode, "发票红冲状态查询:" + describe.replaceAll("'", "''"), eiid);
-                }
-                if (StringUtil.hasText(describe)) {
-                    errmsg.append(describe);
-                }
-            }
-            if (isRushRedBill) {
-                Map<String, Object> elM = new HashMap<>();
-                elM.put("appKey", m.get("appKey"));
-                elM.put("appSecret", m.get("appSecret"));
-                elM.put("token", m.get("token"));
-                elM.put("taxnum", m.get("taxnum"));
-                elM.put("io_id", ioid);
-                elM.put("io_code", m.get("io_code"));
-                elM.put("io_ordertype", bluePiao.getGeneralInt("io_ordertype"));
-                Map<String, Object> r = getElecInvoices(elM);
-                if (StringUtil.hasText(r.get("errMsg"))) {
-                    baseDao.execute("update elecinvoice set EI_EXCEPTIONMESSAGE='" + r.get("errCode") + ": " + r.get("errMsg") + "' where EI_INVOICETYPE = '1' and ei_redapplyid is not null and EI_RELATIVEREFNO is null and ei_ioid = " + ioid);
+                }else {
+                    logger.info("createSticker-F:StatusCode {} ResponseText {}",response.getStatusCode(),response.getResponseText());
+                    retMap.put("success",false);
+                    retMap.put("message", response.getStatusCode()+":"+response.getResponseText());
                 }
+            }catch (Exception e){
+                e.printStackTrace();
+                retMap.put("success",false);
+                retMap.put("message","创建条码异常。");
             }
         }
-        if (errmsg.length() > 0) {
-            res.put("success", false);
-            res.put("errMsg", errmsg.toString());
-        } else {
-            res.put("success", true);
+        if(errMsg.length()>0){
+            System.out.println("errMsg:"+errMsg.toString());
+            retMap.put("success",false);
+            retMap.put("message","对接失败:</br>"+errMsg.toString());
+        }else {
+            baseDao.execute("update CatlDoc set CA_DOCSTATE=1 where ca_id = "+id);
         }
-        return res;
+        logger.info("createSticker-End:master {} id {} retMap {}",master,id,retMap.toString());
+        return retMap;
     }
 
-    //根据红票流水号 获取红票号及其他信息
-    public Map<String, Object> queryRedPdfUrl(List<String> serialNosAll, Map<String, Object> m) {
-        Map<String, Object> res = new HashMap<>();
-        String describe = "";
+    @Override
+    public Map<String, Object> getToken(Map<String, String> map) {
+        Map<String, Object> retMap = new HashMap<>();
+        retMap.put("success",true);
+        String url = map.get("url");
+        String deipaaskeyauth = map.get("deipaaskeyauth");
+        String appKey = map.get("appKey");
+        String appSecret = map.get("appSecret");
+        logger.info("getToken-begin: url {} ,deipaaskeyauth {},appKey {},appSecret {} ", url,deipaaskeyauth,appKey,appSecret);
+        String action="/ipaas/ipaas_getJwtToken";
+        Map<String,Object> paraMap=new HashMap<>();
+        paraMap.put("appKey",appKey);
+        paraMap.put("appSecret",appSecret);
+        paraMap.put("time",60);
         try {
-            logger.info("ElecI-queryRedPdfUrl:master {} ,serialNosAll {}", SpObserver.getSp(), serialNosAll.toString());
-            List<String> rSql = new ArrayList<String>();
-            if (serialNosAll.size() > 0) {
-                Stream.iterate(0, n -> n + 1)
-                        .limit((int) Math.ceil((double) serialNosAll.size() / 50)).forEach(page -> {
-                    List<String> serialNos = serialNosAll.stream().skip(page * 50).limit(50).collect(Collectors.toList());
-                    QueryInvoiceResultReq qirReq = new QueryInvoiceResultReq();
-                    qirReq.setIsOfferInvoiceDetail("0");
-                    qirReq.setSerialNos(serialNos);
-                    QueryInvoiceResultResp qirResp = nuoNuoSDKService.queryInvoiceResult(qirReq, m);
-                    List<QueryInvoiceResultDTO> list = qirResp.getResult();
-                    if (!CollectionUtil.isEmpty(list)) {
-                        for (int i = 0; i < list.size(); i++) {
-                            String sql = list.get(i).updatePdfUrlSql();
-                            if (!"".equals(sql)) {
-                                rSql.add(sql);
-                            }
-                        }
-                    }
-                });
+            HttpUtil.Response response =HttpUtil.doPost(url+action, JacksonUtil.toJson(paraMap), deipaaskeyauth,"");
+            if (response.getStatusCode() == HttpStatus.OK.value()){
+                String res = response.getResponseText();
+                if(res!=null && !"".equals(res)){
+                    Map<String,Object> resMap = JacksonUtil.fromJson(res);
+                    logger.info("getToken-S: {} ", String.valueOf(resMap.get("accessToken")));
+                    retMap.put("token", String.valueOf(resMap.get("accessToken")));
+                }else{
+                    logger.info("getToken-F:No ResponseText");
+                    retMap.put("success",false);
+                    retMap.put("message", "No ResponseText");
+                }
+            }else {
+                logger.info("getToken-F:StatusCode {} ResponseText {}",response.getStatusCode(),response.getResponseText());
+                retMap.put("success",false);
+                retMap.put("message", response.getStatusCode()+":"+response.getResponseText());
             }
-//            System.out.println("rSql:" + rSql.toString());
-            baseDao.execute(rSql);
-        } catch (Exception e) {
+        }catch (Exception e){
             e.printStackTrace();
-            describe = "未知异常";
-            if (StringUtil.hasText(e.getMessage())) {
-                describe = e.getMessage();
-            } else if (e.getCause() != null && StringUtil.hasText(e.getCause().getMessage())) {
-                describe = e.getCause().getMessage();
-            }
-            commonService.logFRecord("查询红票详情", describe.replaceAll("'", "''"), 0);
+            retMap.put("success",false);
+            retMap.put("message", "对接异常");
         }
-        return res;
+        return retMap;
     }
 
-    //退货单 订单开票 根据来源蓝票获取红票信息:写入退货的发票明细、更新来源蓝票对应红票信息、及退货开票记录中
     @Override
-    public Map<String, Object> getRedReturnElecInvoices(Map<String, Object> m) {
-        String taxnum = m.get("taxnum").toString();
-        int ioid = Integer.valueOf(m.get("io_id").toString());
-        String ioCode = m.get("io_code").toString();
-        Map<String, Object> res = new HashMap<String, Object>();
-        String errCode = "-999";
-        String errMsg = "";
-        SqlRowList ioReturn = baseDao.queryForRowSet("select io_id,io_code,io_relatesaleorderno,io_yfphm,io_biid,io_bicode from invoiceOrder " +
-                " where IO_INVOICESTATUS = 2 and io_ordertype = 2 and io_id =  " + ioid);
-        if (!ioReturn.next()) {
-            errMsg = "退货订单:" + ioCode + "(" + ioid + ")不存在";
-            logger.info("RedReturnElecI-DownLoad-master: {} ,id {} status {} message {}", SpObserver.getSp(), ioid, errMsg);
-            commonService.logFRecord("退货订单关联发票对接", errMsg, ioid);
-        }
-        String relatesaleorderno = ioReturn.getGeneralString("io_relatesaleorderno");//关联蓝票订单号
-        String oldInvoiceNumber = ioReturn.getGeneralString("io_yfphm");//原蓝票发票号码
-        Integer biid = ioReturn.getGeneralInt("io_biid");
-        String bicode = ioReturn.getGeneralString("io_bicode");
-        SqlRowList ioBlue = baseDao.queryForRowSet("select ei_id,ei_ioid from ElecInvoice " +
-                "where EI_IOCODE ='" + relatesaleorderno + "' and EI_ALLELECTRONICINVOICENUMBER ='" + oldInvoiceNumber + "'");
-        if (!ioBlue.next()) {
-            errMsg = "原订单:" + relatesaleorderno + "不存在";
-            logger.info("RedReturnElecI-DownLoad-master: {} ,id {} status {} message {}", SpObserver.getSp(), ioid, errMsg);
-            commonService.logFRecord("退货订单关联发票对接", errMsg, ioid);
-        }
-        Integer eiBlue = ioBlue.getGeneralInt("ei_id");
+    public Map<String, Object> updateStickerByList(String master, Integer id,Map<String, String> map,List<Map<String,Object>> updateLists) {
+        Map<String, Object> retMap = new HashMap<>();
+        retMap.put("success",true);
+        String url = map.get("url");
+        String deipaaskeyauth = map.get("deipaaskeyauth");
+        String appKey = map.get("appKey");
+        String appSecret = map.get("appSecret");
+        String deipaasjwt = map.get("deipaasjwt");
+        logger.info("updateSticker-begin: url {} ,deipaaskeyauth {},appKey {},appSecret {},deipaasjwt {} ", url,deipaaskeyauth,appKey,appSecret,deipaasjwt);
+        String action="/SNC/outer_SNC_updateGyspc?sap-client=810&interfacename=ZIRFC_TP2SNC_UPDATEGYSPC";
+        Map<String,Object> paraMap=new HashMap<>();
+        paraMap.put("inputdata",updateLists);
+        StringBuffer errMsg = new StringBuffer();
         try {
-            Map<String, Object> mBlue = new HashMap<>();
-            mBlue.put("taxnum", taxnum);
-            mBlue.put("appKey", m.get("appKey"));
-            mBlue.put("appSecret", m.get("appSecret"));
-            mBlue.put("token", m.get("token"));
-            FindOrderRelationInvoiceReq foriReqBlue = new FindOrderRelationInvoiceReq();
-            foriReqBlue.setOriginalOrderNo(relatesaleorderno);//订单编号
-            foriReqBlue.setSaleTaxNum(taxnum);//销方税号
-            foriReqBlue.setNeedInvoiceSourceDetail("1");//是否需要发票所来源的订单明细,1-是, 0-否(不填默认 0) 当为0时,将不回传orderDetailCallBackVOS。先默认不需要明细
-            FindOrderRelationInvoiceResp resp = nuoNuoSDKService.findOrderRelationInvoice(foriReqBlue, mBlue);
-            errCode = resp.getStatus();
-            errMsg = resp.getMessage();
-            logger.info("RedReturnElecI-DownLoad-master: {} ,id {} status {} message {}", SpObserver.getSp(), ioid, errCode, errMsg);
-            errCode = resp.getStatus();
-            errMsg = resp.getMessage();
-            logger.info("RedReturnElecI-DownLoad-master: {} ,id {} status {} message {}", SpObserver.getSp(), ioid, errCode, errMsg);
-            if ("0000".equals(errCode)) {//调用成功
-                List<String> sqls = new ArrayList<>();
-                List<FindOrderRelationInvoiceDTO> data = resp.getData();
-                for (int i = 0; i < data.size(); i++) {
-                    FindOrderRelationInvoiceDTO friDto = data.get(i);
-                    if (friDto.getAllElectronicInvoiceNumber().equals(oldInvoiceNumber)) {
-                        List<RelateRedInvoiceDTO> relateRedInvoiceList = friDto.getRelateRedInvoiceList();
-                        for (int j = 0; j < relateRedInvoiceList.size(); j++) {
-                            RelateRedInvoiceDTO relateRedInvoiceDTO = relateRedInvoiceList.get(j);
-                            if (StringUtil.hasText(relateRedInvoiceDTO.getAllElectronicInvoiceNumber())) {
-                                sqls.add("delete ElecInvoice where ei_ioid = " + ioid);
-                                sqls.add("insert into ElecInvoice (EI_ID, EI_DETNO, EI_IOID, EI_IOCODE, EI_BIID, EI_BICODE " +
-                                        "   , EI_SID, EI_ORDERNO, EI_CREATETIME, EI_INVOICETYPE, EI_INVOICELINE, EI_SPECIFICFACTOR, EI_INVOICESTATE, EI_EXCEPTIONMESSAGE, EI_INVOICECODE, EI_INVOICENUMBER, EI_ALLELECTRONICINVOICENUMBER, EI_OLDINVOICECODE, EI_OLDINVOICENUMBER, EI_OLDALLELECTRONICINVOICENU" +
-                                        "   , EI_INVOICETIME, EI_INVALIDTIME" +
-                                        "   , EI_PDFURL, EI_PDFATTACH, EI_OFDURL, EI_IMAGEURL, EI_CALCEXCLUDINGTAXAMOUNT, EI_CALCTAXAMOUNT, EI_CALEORDERAMOUNT, EI_SELLERTAXNO, EI_SELLERNAME, EI_TAXNO, EI_BUYERNAME, EI_REMARK, EI_CLERKER, EI_PAYEE, EI_CHECKER, EI_BFIELD1, EI_BFIELD2, EI_BFIELD3, EI_INDATE, EI_UPDATEDATE, EI_REFNO" +
-                                        "   ,EI_BILLSTATUS,ei_rushredstate,ei_redsid,ei_relativerefno,ei_taxamount,ei_taxexcludedamount) " +
-                                        "SELECT ElecInvoice_Seq.nextval,1," + ioid + ",'" + ioCode + "'," + biid + ",'" + bicode + "' " +
-                                        "   , EI_SID, EI_ORDERNO, EI_CREATETIME, EI_INVOICETYPE, EI_INVOICELINE, EI_SPECIFICFACTOR, EI_INVOICESTATE, EI_EXCEPTIONMESSAGE, EI_INVOICECODE, EI_INVOICENUMBER, EI_ALLELECTRONICINVOICENUMBER, EI_OLDINVOICECODE, EI_OLDINVOICENUMBER, EI_OLDALLELECTRONICINVOICENU" +
-                                        "   , (to_date('1970-01-0100:00:00','yyyy-mm-dd hh24:mi:ss') + "+relateRedInvoiceDTO.getInvoiceTime()+"/1000/24/60/60) EI_INVOICETIME, EI_INVALIDTIME" +
-                                        "   , EI_PDFURL, EI_PDFATTACH, EI_OFDURL, EI_IMAGEURL, EI_CALCEXCLUDINGTAXAMOUNT, EI_CALCTAXAMOUNT, EI_CALEORDERAMOUNT, EI_SELLERTAXNO, EI_SELLERNAME, EI_TAXNO, EI_BUYERNAME, EI_REMARK, EI_CLERKER, EI_PAYEE, EI_CHECKER, EI_BFIELD1, EI_BFIELD2, EI_BFIELD3, EI_INDATE, EI_UPDATEDATE, EI_REFNO" +
-                                        "   ,'01' EI_BILLSTATUS,"+friDto.getRushRedState()+" ei_rushredstate,'"+relateRedInvoiceDTO.getSid()+"' ei_redsid,'"+relateRedInvoiceDTO.getAllElectronicInvoiceNumber()+"' ei_relativerefno,"+relateRedInvoiceDTO.getTaxAmount()+" ei_taxamount,"+relateRedInvoiceDTO.getExcludingTaxAmount()+" ei_taxexcludedamount " +
-                                        "FROM ElecInvoice b WHERE EI_ID = " + eiBlue);
-                                sqls.add("update ElecInvoice set EI_BILLSTATUS='01'" +
-                                        ",ei_rushredstate=" + friDto.getRushRedState() + "" +
-                                        ",ei_redsid='" + relateRedInvoiceDTO.getSid() + "' " +
-                                        ",ei_relativerefno='" + relateRedInvoiceDTO.getAllElectronicInvoiceNumber() + "' " +
-                                        ",ei_taxamount=" + relateRedInvoiceDTO.getTaxAmount() +
-                                        ",ei_taxexcludedamount=" + relateRedInvoiceDTO.getExcludingTaxAmount() +
-                                        ",ei_redpdfurl=null,ei_redpdfattach=null " +
-                                        " where EI_ID = '" + eiBlue + "'");
-                                sqls.add("update InvoiceOrder set io_refno='" + relateRedInvoiceDTO.getAllElectronicInvoiceNumber() + "' where io_id=" + ioid);
-                                sqls.add("update billout set bi_refno='" + relateRedInvoiceDTO.getAllElectronicInvoiceNumber() + "' where bi_code='" + bicode + "'");
+            HttpUtil.Response response =HttpUtil.doPost(url+action, JacksonUtil.toJson(paraMap), deipaaskeyauth,deipaasjwt);
+            if (response.getStatusCode() == HttpStatus.OK.value()){
+                String res = response.getResponseText();
+                if(res!=null && !"".equals(res)){
+                    Map<String,Object> resMap = JacksonUtil.fromJson(res);
+                    if(StringUtil.hasText(resMap.get("OUTPUTDATA"))){
+                        if(StringUtil.hasText(String.valueOf(resMap.get("OUTPUTDATA")))){
+                            List<Map<String,Object>> outputdataList = (List) resMap.get("OUTPUTDATA");
+                            for (Map<String,Object> outputdataMap:outputdataList) {
+                                if(!"S".equals(outputdataMap.get("e_msgtype"))){
+                                    errMsg.append("条码:").append(outputdataMap.get("zalt_id")).append(",原因:").append(outputdataMap.get("e_msg")).append("</br>");
+                                    baseDao.execute("update CatlDocDetail set cd_errmsg='"+outputdataMap.get("e_msg")+"' where cd_caid = "+id+" and cd_panid = '"+outputdataMap.get("zalt_id")+"'");
+                                }
                             }
+                        }else {
+                            logger.info("updateSticker-F:No ResponseText");
+                            retMap.put("success",false);
+                            retMap.put("message", "No outPutData");
                         }
+                    }else {
+                        logger.info("updateSticker-F:No ResponseText");
+                        retMap.put("success",false);
+                        retMap.put("message", "No ResponseText");
                     }
+                }else{
+                    logger.info("updateSticker-F:No ResponseText");
+                    retMap.put("success",false);
+                    retMap.put("message", "No ResponseText");
                 }
-                //记录发票明细
-//                System.out.println(sqls.toString());
-                baseDao.execute(sqls);
-                //红字
-                commonService.logSRecord("退货订单关联发票对接", ioid);
-            } else {//  {"status":"8958","message":"该订单对应的开票单不存在","data":null} 没有开票单的不记录对接失败日志
-                if (errMsg.length() > 3850) {
-                    errMsg = errMsg.substring(0, 3850);
-                }
-                baseDao.execute("update invoiceOrder set io_errorMsg='订单关联发票查询失败: " + errMsg + "' where io_id=" + ioid);
-                commonService.logFRecord("退货订单关联发票对接", "蓝发票信息获取:(" + errCode + ")" + errMsg, ioid);
+            }else {
+                logger.info("updateSticker-F:StatusCode {} ResponseText {}",response.getStatusCode(),response.getResponseText());
+                retMap.put("success",false);
+                retMap.put("message", response.getStatusCode()+":"+response.getResponseText());
             }
-        } catch (Exception e) {
+        }catch (Exception e){
             e.printStackTrace();
-            errMsg = "发票获取异常";
-            if (StringUtil.hasText(e.getMessage())) {
-                errMsg = e.getMessage();
-            } else if (e.getCause() != null && StringUtil.hasText(e.getCause().getMessage())) {
-                errMsg = e.getCause().getMessage();
-            }
-            logger.info("RedReturnElecI-DownLoad-master: {} ,id {} message {}", SpObserver.getSp(), ioid, errMsg);
-            commonService.logFRecord("退货订单关联发票对接", errMsg.replaceAll("'", "''"), ioid);
+            retMap.put("success",false);
+            retMap.put("message", "对接异常");
         }
-        //获取红字发票PDF地址
-        List<String> serialNosAll = baseDao.queryForList("select ei_redsid from ElecInvoice " +
-                "where ei_id = " + eiBlue + " and EI_RELATIVEREFNO is not null and ei_redpdfurl is null and nvl(EI_BILLSTATUS,' ') in (' ','01','04')", String.class);
-        if (!CollectionUtil.isEmpty(serialNosAll)) {
-            queryRedPdfUrl(serialNosAll, m);
+        if(errMsg.length()>0){
+            retMap.put("success",false);
+            retMap.put("message",errMsg.toString());
         }
-        if (StringUtil.hasText(errMsg) && !"调用成功".equals(errMsg)) {
-            res.put("success", false);
-            res.put("errCode", errCode);
-            res.put("errMsg", errMsg);
-        } else {
-            res.put("success", true);
-        }
-        return res;
+        return retMap;
     }
 
+
 }

+ 0 - 86
src/main/java/com/uas/eis/service/Impl/NuoNuoSDKServiceImpl.java

@@ -1,86 +0,0 @@
-package com.uas.eis.service.Impl;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.TypeReference;
-import com.uas.eis.config.DonlimConfig;
-import com.uas.eis.core.config.SpObserver;
-import com.uas.eis.dao.BaseDao;
-import com.uas.eis.dto.*;
-import com.uas.eis.service.CommonService;
-import com.uas.eis.service.NuoNuoSDKService;
-import com.uas.eis.utils.Constant;
-import com.uas.eis.utils.DateUtil;
-import nuonuo.open.sdk.NNOpenSDK;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-
-@Service
-public class NuoNuoSDKServiceImpl implements NuoNuoSDKService {
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-    @Autowired
-    private DonlimConfig donlimConfig;
-
-    //nuonuo.OpeMplatform.queryInvoiceRedConfirm(诺税通saas红字确认单查询接口)
-    @Override
-    public QueryInvoiceRedConfirmResp queryInvoiceRedConfirm(QueryInvoiceRedConfirmReq qircReq, Map<String,Object> m) {
-        String url=donlimConfig.getRoute();
-        String taxnum = m.get("taxnum").toString();
-        String appKey = m.get("appKey").toString();
-        String appSecret = m.get("appSecret").toString();
-        String token = m.get("token").toString();
-        NNOpenSDK sdk = NNOpenSDK.getIntance();
-        String method = "nuonuo.OpeMplatform.queryInvoiceRedConfirm"; // API方法名
-        String content = sdk.convertToUtf8(JSONArray.toJSONString(qircReq));
-        logger.info("ElecI-queryInvoiceRedConfirm:master {} content {}", SpObserver.getSp(),content);
-        String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-        String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-//        System.out.println(result);
-        QueryInvoiceRedConfirmResp resp = JSON.parseObject(result, new TypeReference<QueryInvoiceRedConfirmResp>() {});
-        return resp;
-    }
-    //nuonuo.OpeMplatform.queryInvoiceResult(诺税通saas发票详情查询接口)
-    @Override
-    public QueryInvoiceResultResp queryInvoiceResult(QueryInvoiceResultReq qirReq, Map<String,Object> m) {
-        String url=donlimConfig.getRoute();
-        String taxnum = m.get("taxnum").toString();
-        String appKey = m.get("appKey").toString();
-        String appSecret = m.get("appSecret").toString();
-        String token = m.get("token").toString();
-        NNOpenSDK sdk = NNOpenSDK.getIntance();
-        String method = "nuonuo.OpeMplatform.queryInvoiceResult"; // API方法名
-        String content = sdk.convertToUtf8(JSONArray.toJSONString(qirReq));
-        logger.info("ElecI-queryInvoiceResult:master {} content {}",SpObserver.getSp(),content);
-        String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-        String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-//        System.out.println(result);
-        QueryInvoiceResultResp resp = JSON.parseObject(result, new TypeReference<QueryInvoiceResultResp>() {});
-        return resp;
-    }
-    /*
-    * nuonuo.OpeMplatform.findOrderState(诺税通Saas订单状态查询接口)
-    * */
-    @Override
-    public FindOrderRelationInvoiceResp findOrderRelationInvoice(FindOrderRelationInvoiceReq foriReq, Map<String, Object> m) {
-        String url=donlimConfig.getRoute();
-        String taxnum = m.get("taxnum").toString();
-        String appKey = m.get("appKey").toString();
-        String appSecret = m.get("appSecret").toString();
-        String token = m.get("token").toString();
-        NNOpenSDK sdk = NNOpenSDK.getIntance();
-        String method = "nuonuo.OpeMplatform.findOrderRelationInvoice"; // API方法名
-        String content =sdk.convertToUtf8(JSONArray.toJSONString(foriReq));
-        logger.info("ElecI-findOrderRelationInvoice:master {} content {}",SpObserver.getSp(),content);
-        String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-        String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-        logger.info("ElecI-findOrderRelationInvoice:master {} result {}",SpObserver.getSp(),result);
-        FindOrderRelationInvoiceResp resp = JSON.parseObject(result , new TypeReference<FindOrderRelationInvoiceResp>() {});
-        return resp;
-    }
-}

+ 0 - 17
src/main/java/com/uas/eis/service/NuoNuoSDKService.java

@@ -1,17 +0,0 @@
-package com.uas.eis.service;
-
-
-import com.uas.eis.dto.*;
-
-import java.util.Map;
-
-/**
- * @author wuyx
- * @email wuyx@usoftchina.com
- * @date 2023-08-04
- */
-public interface NuoNuoSDKService {
-    QueryInvoiceRedConfirmResp queryInvoiceRedConfirm(QueryInvoiceRedConfirmReq qircReq, Map<String,Object> m);
-    QueryInvoiceResultResp queryInvoiceResult(QueryInvoiceResultReq qirReq, Map<String,Object> m);
-    FindOrderRelationInvoiceResp findOrderRelationInvoice(FindOrderRelationInvoiceReq foriReq, Map<String,Object> m);
-}

+ 0 - 376
src/main/java/com/uas/eis/task/ElecInvoiceTask.java

@@ -1,376 +0,0 @@
-package com.uas.eis.task;
-
-import com.uas.eis.config.DonlimConfig;
-import com.uas.eis.core.config.SpObserver;
-import com.uas.eis.dao.BaseDao;
-import com.uas.eis.dao.SqlRowList;
-import com.uas.eis.service.CommonService;
-import com.uas.eis.service.ERPService;
-import com.uas.eis.utils.*;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.*;
-
-@Component
-public class ElecInvoiceTask {
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-    @Autowired
-    private BaseDao baseDao;
-    @Autowired
-    private DonlimConfig donlimConfig;
-    @Autowired
-    private ERPService erpService;
-    @Autowired
-    private CommonService commonService;
-    /**
-     * 每半小时执行一次
-     *  //0:待处理 表示订单没有转了开票申请,此状态可以不用管
-     * //1:处理中 表示订单可能转了开票申请,但是在走审批流等,此状态可以先不用管
-     * //2:已处理 表示订单全部都转了开票申请
-     * //4:提交失败 表示订单自动转失败了,此状态可以不用管
-     * /*6:部分待处理 表示订单部分转了开票申请
-     *     1.有开票记录申请,但是没开票
-     *          {"status":"8958","message":"该订单对应的开票单不存在","data":null}
-     *     2.有开票记录申请,存在部分失败或者成功
-     *          只返回开票失败或者成功的部分
-     *          {"status":"0000","message":"调用成功","data":[{"sellerTaxNo":"339901999999199","orderNo":"1134068619401396224","rushRedState":"0","invoiceType":1,"invoiceState":1,"invoiceLine":"b","exceptionMessage":"ukey版签章无下载码","sid":"23072713481601034933"}]}
-     * //7:无需开票,此状态可以不用管
-     * */
-    @Scheduled(cron = "0 0/2 * * * ?")
-    public void elecInvoiceDownLoad(){
-        List<Object[]> obsList=baseDao.getFieldsDatasByCondition("YITOA_DATACENTER.dock_invoice_config",new String[]{"appKey","appSecret","token","taxnum","username"},"1=1");
-        if(!CollectionUtil.isEmpty(obsList)){
-            logger.info("ElecI-DownLoad Begin");
-            for (Object[] obs: obsList) {
-                if(obs == null){
-                    continue;
-                }
-                String master = obs[4].toString();
-                String appKey = donlimConfig.getAppKey();
-                String appSecret = donlimConfig.getAppSecret();
-                String token =  donlimConfig.getToken();
-                String taxnum=  donlimConfig.getTaxnum();
-                if(donlimConfig.isProd()){
-                    System.out.println("prod");
-                    appKey =  obs[0].toString();
-                    appSecret =  obs[1].toString();
-                    token = obs[2].toString();// 访问令牌
-                    taxnum = obs[3].toString();// 授权企业税号
-                }else{
-                    System.out.println("dev");
-                }
-                Map<String,Object> m = new HashMap<>();
-                m.put("appKey",appKey);
-                m.put("appSecret",appSecret);
-                m.put("token",token);
-                m.put("taxnum",taxnum);
-                logger.info("ElecI-DownLoad: master: {} Begin ",master);
-                SpObserver.putSp(master);
-                SqlRowList ioList = baseDao.queryForRowSet("select io_id,io_code,io_ordertype from(select io_id,io_code,io_ordertype from "+master+".invoiceOrder " +
-                        " where io_status = '已审核' and nvl(IO_DOCKSTATUS,' ') = '对接成功' " +
-                        "   and (IO_INVOICESTATUS = 6 or (IO_INVOICESTATUS = 2 and io_refno is null and io_ordertype = 1)) " +//仅蓝票,红票另外获取
-                        "order by io_id desc) where rownum <= 100");
-                logger.info("ElecI-DownLoad: master: {} size: {} ",master,ioList.getResultList().size());
-                while (ioList.next()){
-                    m.put("io_id",ioList.getGeneralInt("io_id"));
-                    m.put("io_code",ioList.getGeneralString("io_code"));
-                    m.put("io_ordertype",ioList.getGeneralInt("io_ordertype"));
-                    erpService.getElecInvoices(m);
-                }
-                logger.info("ElecI-DownLoad: master: {} End ",master);
-            }
-            logger.info("ElecI-DownLoad End");
-        }
-    }
-    @Scheduled(cron = "0 0/2 * * * ?")
-    //PDF文件转存 一次转存
-    public void elecInvoiceAttachSave(){
-        List<Object[]> obsList=baseDao.getFieldsDatasByCondition("YITOA_DATACENTER.dock_invoice_config",new String[]{"appKey","appSecret","token","taxnum","username"},"1=1");
-        if(!CollectionUtil.isEmpty(obsList)){
-            logger.info("ElecI-AttachSave Begin");
-            for (Object[] obs: obsList) {
-                if(obs == null){
-                    continue;
-                }
-                String master = obs[4].toString();
-                logger.info("ElecI-AttachSave: master: {} Begin ",master);
-                SpObserver.putSp(master);
-                SqlRowList ioList = baseDao.queryForRowSet("select * from (select ei_id,ei_pdfurl,ei_refno,ei_ioid,cu_name " +
-                        " from ELECINVOICE LEFT JOIN InvoiceOrder ON io_id = ei_ioid LEFT JOIN CUSTOMER ON CU_CODE = io_cucode " +
-                        "where (ei_pdfurl is not null and ei_pdfattach is null) " +
-                        " order by ei_id ) where rownum <= 100 ");//一次最多500
-                logger.info("ElecI-AttachSave: master: {} size: {} ",master,ioList.getResultList().size());
-                List<Integer> ioids = new ArrayList<>();
-                while (ioList.next()){
-                    //下载地址
-                    String fileUrl = ioList.getGeneralString("ei_pdfurl"); // "https://inv.jss.com.cn/fp2/2zpnwyKkdvu9dWzE8BhmSnER0Iux3xQRMLidDJhiIE2PziVXY4lL3k83OsK0K06YctW5cf1FFHxraffj-bf16A.pdf";
-                    // 定义要保存的文件的路径
-                    String fileName = ioList.getGeneralString("cu_name")+ioList.getGeneralString("ei_refno")+".pdf";//发票号码
-                    String fileBasePath = "C:\\invoice\\"+fileName;//发票号码
-                    fileBasePath = "/usr/local/uas/invoice/"+fileName;//发票号码
-                    try {
-                        // 创建URL对象
-                        URL url = new URL(fileUrl);
-                        // 打开连接
-                        URLConnection conn = url.openConnection();
-                        // 获取输入流
-                        InputStream in = conn.getInputStream();
-                        // 创建输出流
-                        FileOutputStream out = new FileOutputStream(fileBasePath);
-                        // 创建缓冲区
-                        byte[] buffer = new byte[104857600];
-                        // 读取并写入数据
-                        int len;
-                        while ((len = in.read(buffer)) != -1) {
-                            out.write(buffer, 0, len);
-                        }
-                        long size = out.getChannel().size();
-                        // 关闭流
-                        in.close();
-                        out.close();
-//                        System.out.println("size:"+size);
-                        //存文件 filepath
-                        int id = commonService.saveFilePath(fileBasePath, (int) size, fileName, "管理员");
-                        baseDao.execute("update ELECINVOICE set ei_pdfattach ='"+id+";' where ei_id = "+ioList.getGeneralInt("ei_id"));
-                        if(!ioids.contains(ioList.getGeneralInt("ei_ioid"))){
-                            ioids.add(ioList.getGeneralInt("ei_ioid"));
-                        }
-                        System.out.println("下载成功");
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        String errMsg = "文件转存异常";
-                        if(StringUtil.hasText(e.getMessage())){
-                            errMsg = e.getMessage();
-                        }else if(e.getCause()!=null&&StringUtil.hasText(e.getCause().getMessage())){
-                            errMsg = e.getCause().getMessage();
-                        }
-                        commonService.logFRecord("订单关联发票对接",errMsg.replaceAll("'","''"),ioList.getGeneralInt("ei_id"));
-                    }
-                }
-                if(ioids.size()>0){
-                    baseDao.execute("update invoiceOrder set io_attach = REPLACE(to_char((select wm_concat(ei_pdfattach) from ELECINVOICE where io_id = ei_ioid and nvl(ei_rushredstate,0) <> 1)),',','') where io_id in ("+StringUtils.join(ioids.toArray(), ",")+")");
-                }
-                logger.info("ElecI-AttachSave: master: {} End ",master);
-            }
-            logger.info("ElecI-AttachSave End");
-        }
-    }
-
-
-    @Scheduled(cron = "0 0/2 * * * ?")
-    //发票红字确认状态查询
-    public void elecInvoiceRedConfirmStateUpdate(){
-        List<Object[]> obsList=baseDao.getFieldsDatasByCondition("YITOA_DATACENTER.dock_invoice_config",new String[]{"appKey","appSecret","token","taxnum","username"},"1=1");
-        if(!CollectionUtil.isEmpty(obsList)){
-            logger.info("ElecI-RedConfirmStateUpdate Begin");
-            for (Object[] obs: obsList) {
-                if(obs == null){
-                    continue;
-                }
-                String master = obs[4].toString();
-                String appKey = donlimConfig.getAppKey();
-                String appSecret = donlimConfig.getAppSecret();
-                String token =  donlimConfig.getToken();
-                String taxnum=  donlimConfig.getTaxnum();
-                if(donlimConfig.isProd()){
-                    System.out.println("prod");
-                    appKey =  obs[0].toString();
-                    appSecret =  obs[1].toString();
-                    token = obs[2].toString();// 访问令牌
-                    taxnum = obs[3].toString();// 授权企业税号
-                }else{
-                    System.out.println("dev");
-                }
-                Map<String,Object> m = new HashMap<>();
-                m.put("appKey",appKey);
-                m.put("appSecret",appSecret);
-                m.put("token",token);
-                m.put("taxnum",taxnum);
-                logger.info("ElecI-RedConfirmStateUpdate: master: {} Begin ",master);
-                SpObserver.putSp(master);
-                SqlRowList ioList = baseDao.queryForRowSet("select * from ( " +
-                        "select io_id,io_Code " +
-                        "from Invoiceorder where exists (Select 1 from ElecInvoice " +
-                        //有红字确认单 但是没有获取到发票号的
-                        "   where ei_ioid = io_id and EI_EXCEPTIONMESSAGE is null and nvl(EI_INVOICETYPE,'1') = '1' and ei_redapplyid is not null and EI_RELATIVEREFNO is null and nvl(EI_BILLSTATUS,' ') in (' ','01','02','03','15') " +
-//                        " and io_code = 'SZ23070033' " +
-                        ")) where rownum <= 100");
-                logger.info("ElecI-DownLoad: master: {} size: {} ",master,ioList.getResultList().size());
-                while (ioList.next()){
-                    m.put("io_id",ioList.getGeneralInt("io_id"));
-                    m.put("io_code",ioList.getGeneralString("io_code"));
-                    m.put("ei_id",0);
-                    erpService.queryInvoiceRedConfirm(m);
-                }
-                logger.info("ElecI-RedConfirmStateUpdate: master: {} End ",master);
-            }
-            logger.info("ElecI-RedConfirmStateUpdate End");
-        }
-    }
-    //红票PDF地址获取
-    @Scheduled(cron = "0 0/2 * * * ?")
-    public void redPdfUrlUpdate(){
-        List<Object[]> obsList=baseDao.getFieldsDatasByCondition("YITOA_DATACENTER.dock_invoice_config",new String[]{"appKey","appSecret","token","taxnum","username"},"1=1");
-        if(!CollectionUtil.isEmpty(obsList)){
-            logger.info("ElecI-redPdfUrlUpdate Begin");
-            for (Object[] obs: obsList) {
-                if(obs == null){
-                    continue;
-                }
-                String master = obs[4].toString();
-                String appKey = donlimConfig.getAppKey();
-                String appSecret = donlimConfig.getAppSecret();
-                String token =  donlimConfig.getToken();
-                String taxnum=  donlimConfig.getTaxnum();
-                if(donlimConfig.isProd()){
-                    System.out.println("prod");
-                    appKey =  obs[0].toString();
-                    appSecret =  obs[1].toString();
-                    token = obs[2].toString();// 访问令牌
-                    taxnum = obs[3].toString();// 授权企业税号
-                }else{
-                    System.out.println("dev");
-                }
-                Map<String,Object> m = new HashMap<>();
-                m.put("appKey",appKey);
-                m.put("appSecret",appSecret);
-                m.put("token",token);
-                m.put("taxnum",taxnum);
-                logger.info("ElecI-redPdfUrlUpdate: master: {} Begin ",master);
-                SpObserver.putSp(master);
-                List<String> serialNosAll = baseDao.queryForList("select ei_redsid from ElecInvoice left join InvoiceOrder on ei_ioid = io_id where io_ordertype=1 and EI_RELATIVEREFNO is not null and ei_redpdfurl is null and nvl(EI_BILLSTATUS,' ') in ('01','04')",String.class);
-                if (serialNosAll == null){
-                    logger.info("ElecI-redPdfUrlUpdate: master: {} size: {} ",master,0);
-                }else {
-                    logger.info("ElecI-redPdfUrlUpdate: master: {} size: {} ",master,serialNosAll.size());
-                    erpService.queryRedPdfUrl(serialNosAll,m);
-                }
-            }
-            logger.info("ElecI-redPdfUrlUpdate End");
-        }
-    }
-
-    @Scheduled(cron = "0 0/2 * * * ?")
-    //红字PDF文件转存 一次转存
-    public void elecInvoiceRedAttachSave(){
-        List<Object[]> obsList=baseDao.getFieldsDatasByCondition("YITOA_DATACENTER.dock_invoice_config",new String[]{"appKey","appSecret","token","taxnum","username"},"1=1");
-        if(!CollectionUtil.isEmpty(obsList)){
-            logger.info("ElecI-AttachSave Begin");
-            for (Object[] obs: obsList) {
-                if(obs == null){
-                    continue;
-                }
-                String master = obs[4].toString();
-                logger.info("ElecI-AttachSave: master: {} Begin ",master);
-                SpObserver.putSp(master);
-                SqlRowList ioList = baseDao.queryForRowSet("select * from (select ei_id,ei_redpdfurl,ei_relativerefno,ei_ioid,cu_name,ei_allelectronicinvoicenumber " +
-                        " from ELECINVOICE LEFT JOIN InvoiceOrder ON io_id = ei_ioid LEFT JOIN CUSTOMER ON CU_CODE = io_cucode " +
-                        "where io_ordertype=1 and ei_redpdfurl is not null and ei_redpdfattach is null " +
-                        " order by ei_id ) where rownum <= 100 ");//一次最多500
-                logger.info("ElecI-AttachSave: master: {} size: {} ",master,ioList.getResultList().size());
-                List<Integer> ioids = new ArrayList<>();
-                while (ioList.next()){
-                    //下载地址
-                    String fileUrl = ioList.getGeneralString("ei_redpdfurl"); // "https://inv.jss.com.cn/fp2/2zpnwyKkdvu9dWzE8BhmSnER0Iux3xQRMLidDJhiIE2PziVXY4lL3k83OsK0K06YctW5cf1FFHxraffj-bf16A.pdf";
-                    // 定义要保存的文件的路径
-                    String fileName = ioList.getGeneralString("cu_name")+ioList.getGeneralString("ei_relativerefno")+".pdf";//发票号码
-                    String fileBasePath = "C:\\invoice\\"+fileName;//发票号码
-                    fileBasePath = "/usr/local/uas/invoice/"+fileName;//发票号码
-                    try {
-                        // 创建URL对象
-                        URL url = new URL(fileUrl);
-                        // 打开连接
-                        URLConnection conn = url.openConnection();
-                        // 获取输入流
-                        InputStream in = conn.getInputStream();
-                        // 创建输出流
-                        FileOutputStream out = new FileOutputStream(fileBasePath);
-                        // 创建缓冲区
-                        byte[] buffer = new byte[104857600];
-                        // 读取并写入数据
-                        int len;
-                        while ((len = in.read(buffer)) != -1) {
-                            out.write(buffer, 0, len);
-                        }
-                        long size = out.getChannel().size();
-                        // 关闭流
-                        in.close();
-                        out.close();
-//                        System.out.println("size:"+size);
-                        //存文件 filepath
-                        int id = commonService.saveFilePath(fileBasePath, (int) size, fileName, "管理员");
-                        baseDao.execute("update ELECINVOICE set ei_redpdfattach ='"+id+";' where ei_relativerefno='"+ioList.getGeneralString("ei_relativerefno")+"' and ei_allelectronicinvoicenumber = "+ioList.getGeneralString("ei_allelectronicinvoicenumber"));
-                        //关联退货单 开票订单信息更新
-                        baseDao.execute("update Invoiceorder set io_attach = '"+id+";' where io_ordertype=2 and io_yfphm='"+ioList.getGeneralString("ei_allelectronicinvoicenumber")+"' and io_refno = '"+ioList.getGeneralString("ei_relativerefno")+"'");
-                        System.out.println("下载成功");
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        String errMsg = "文件转存异常";
-                        if(StringUtil.hasText(e.getMessage())){
-                            errMsg = e.getMessage();
-                        }else if(e.getCause()!=null&&StringUtil.hasText(e.getCause().getMessage())){
-                            errMsg = e.getCause().getMessage();
-                        }
-                        commonService.logFRecord("订单关联发票对接",errMsg.replaceAll("'","''"),ioList.getGeneralInt("ei_id"));
-                    }
-                }
-                logger.info("ElecI-AttachSave: master: {} End ",master);
-            }
-            logger.info("ElecI-AttachSave End");
-        }
-    }
-
-    //退货单 红票获取
-    @Scheduled(cron = "0 0/2 * * * ?")
-    public void saleReturnElecInvoiceDownLoad(){
-        List<Object[]> obsList=baseDao.getFieldsDatasByCondition("YITOA_DATACENTER.dock_invoice_config",new String[]{"appKey","appSecret","token","taxnum","username"},"1=1");
-        if(!CollectionUtil.isEmpty(obsList)){
-            logger.info("RedReturnElecI-DownLoad Begin");
-            for (Object[] obs: obsList) {
-                if(obs == null){
-                    continue;
-                }
-                String master = obs[4].toString();
-                String appKey = donlimConfig.getAppKey();
-                String appSecret = donlimConfig.getAppSecret();
-                String token =  donlimConfig.getToken();
-                String taxnum=  donlimConfig.getTaxnum();
-                if(donlimConfig.isProd()){
-                    System.out.println("prod");
-                    appKey =  obs[0].toString();
-                    appSecret =  obs[1].toString();
-                    token = obs[2].toString();// 访问令牌
-                    taxnum = obs[3].toString();// 授权企业税号
-                }else{
-                    System.out.println("dev");
-                }
-                Map<String,Object> m = new HashMap<>();
-                m.put("appKey",appKey);
-                m.put("appSecret",appSecret);
-                m.put("token",token);
-                m.put("taxnum",taxnum);
-                logger.info("RedReturnElecI-DownLoad: master: {} Begin ",master);
-                SpObserver.putSp(master);
-                SqlRowList ioList = baseDao.queryForRowSet("select io_id,io_code from (select io_id,io_code from "+master+".invoiceOrder " +
-                        " where io_status = '已审核' and nvl(IO_DOCKSTATUS,' ') = '对接成功' and (io_invoicestatus = 2 and io_refno is null and io_ordertype = 2) order by io_id desc) where rownum <= 100");
-                logger.info("RedReturnElecI-DownLoad: master: {} size: {} ",master,ioList.getResultList().size());
-                while (ioList.next()){
-                    m.put("io_id",ioList.getGeneralInt("io_id"));
-                    m.put("io_code",ioList.getGeneralString("io_code"));
-                    erpService.getRedReturnElecInvoices(m);
-                }
-                logger.info("RedReturnElecI-DownLoad: master: {} End ",master);
-            }
-            logger.info("RedReturnElecI-DownLoad End");
-        }
-    }
-}

+ 0 - 55
src/main/java/com/uas/eis/task/InvoiceOrderTask.java

@@ -1,55 +0,0 @@
-package com.uas.eis.task;
-
-import com.uas.eis.dao.BaseDao;
-import com.uas.eis.dao.SqlRowList;
-import com.uas.eis.service.ERPService;
-import com.uas.eis.utils.CollectionUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.Map;
-
-@Component
-public class InvoiceOrderTask {
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-    @Autowired
-    private BaseDao baseDao;
-    @Autowired
-    private ERPService erpService;
-    /**
-     * 每10分钟执行
-     *  	//订单状态(0:待处理 1:处理中 2:已处理 4:提交失败 6:部分待处理 7:无需开票)
-     * 		//0:待处理 表示订单没有转了开票申请,此状态需要定时获取
-     * 		//1:处理中 表示订单可能转了开票申请,此状态需要定时获取
-     * 		//2:已处理 表示订单全部都转了开票申请,没有发票号的情况下要继续获取订单状态。
-     * 		//4:提交失败 表示订单自动转失败了,此状态需要定时获取
-     *      //6:部分待处理 表示订单部分转了开票申请,此状态需要定时获取
-     * 		//7:无需开票,此状态可以不用管,此状态需要定时获取
-     * */
-    @Scheduled(cron = "0 0/2 * * * ?")
-    public void InvoiceOrderStateUpdate(){
-        List<Object[]> obsList=baseDao.getFieldsDatasByCondition("YITOA_DATACENTER.dock_invoice_config",new String[]{"appKey","appSecret","token","taxnum","username"},"1=1");
-        if(!CollectionUtil.isEmpty(obsList)){
-            logger.info("InvoiceOrder-StateUpdate Begin");
-            for (Object[] obs: obsList) {
-                if(obs == null){
-                    continue;
-                }
-                String master = obs[4].toString();
-                logger.info("InvoiceOrder-StateUpdate: master: {} Begin ",master);
-                SqlRowList ioList = baseDao.queryForRowSet("select io_id,io_code from "+master+".invoiceOrder left join "+master+".customer on io_cucode=cu_code " +
-                        " where IO_STATUS ='已审核' and IO_DOCKSTATUS = '对接成功' and (nvl(IO_INVOICESTATUS,0) in (0,1,4,6,7) or (IO_INVOICESTATUS = 2 and io_refno is null)) order by io_id");
-                logger.info("InvoiceOrder-StateUpdate: master: {} size: {} ",master,ioList.getResultList().size());
-                while (ioList.next()){
-                    Map<String, Object> mm = erpService.findOrderState(master, ioList.getGeneralInt("io_id"));
-                }
-                logger.info("InvoiceOrder-StateUpdate: master: {} End ",master);
-            }
-            logger.info("InvoiceOrder-StateUpdate End");
-        }
-    }
-}

+ 0 - 117
src/main/java/com/uas/eis/task/PnsDataSyncTask.java

@@ -1,117 +0,0 @@
-package com.uas.eis.task;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.uas.eis.config.PNSConfig;
-import com.uas.eis.dao.BaseDao;
-import com.uas.eis.entity.PNSSendData;
-import com.uas.eis.entity.PNSSendResp;
-import com.uas.eis.utils.FlexJsonUtil;
-import com.uas.eis.utils.HttpUtil;
-import com.uas.eis.utils.StringUtil;
-import net.sf.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.http.HttpStatus;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Component
-public class PnsDataSyncTask {
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    private int  pageSize = 50;
-    @Autowired
-    private PNSConfig pnsConfig;
-    @Autowired
-    private BaseDao baseDao;
-    /**
-     * 第一商品营业部 1453
-     * 第二商品营业部 733
-     * */
-
-    //@Scheduled(cron = "0 0/5 * * * ?")
-    public void UploadSaleData(){
-        logger.info("Sale Upload Start---");
-        List<PNSSendData> saleUploads = getSaleDataUpload();
-        if(saleUploads.size() < 1 ) {
-            return;
-        }
-        //分页上传
-        int a =  saleUploads.size() / pageSize;
-        int b =  saleUploads.size() % pageSize;
-        int pages = a + (b>0?1:0);
-        HashMap<String, String> reqHeader = new HashMap<>();
-        reqHeader.put("fromsys","ISP");
-         JSONObject pageReq = new JSONObject();
-         pageReq.put("if_name","ISPP-PSI-UPLOAD");
-         pageReq.put("if_key" , pnsConfig.getIf_key());
-         pageReq.put("total_page", String.valueOf(pages));
-         pageReq.put("total_data_count", String.valueOf(saleUploads.size()));
-         logger.info("Sale Upload totalSize {}", pages);
-        for(int i = 0 ; i < pages; i++) {
-            pageReq.put("current_page", String.valueOf(i+1));
-            if((i+1)*pageSize > saleUploads.size()) {
-                pageReq.put("current_data_count", String.valueOf(b));
-                pageReq.put("detail", JSONArray.toJSONString(saleUploads.subList(i*pageSize, i*pageSize+b), SerializerFeature.WriteMapNullValue));
-            }else {
-                pageReq.put("current_data_count", String.valueOf(pageSize));
-                pageReq.put("detail", JSONArray.toJSONString(saleUploads.subList(i*pageSize, (i+1)*pageSize),SerializerFeature.WriteMapNullValue));
-            }
-            try {
-               HttpUtil.Response response = HttpUtil.sendPostRequest(pnsConfig.getRoute(), reqHeader, pageReq.toString());
-               logger.info("{}, statusCode{},{}",response.getResponseText(), response.getStatusCode(), response.getStatusCode() == HttpStatus.OK.value());
-                if (response.getStatusCode() == HttpStatus.OK.value()) {
-                    String data = response.getResponseText();
-                    logger.info("{}", StringUtils.hasText(data));
-                    if (StringUtils.hasText(data)) {
-                        PNSSendResp resp = FlexJsonUtil.fromJson(String.valueOf(FlexJsonUtil.fromJson(data).get("result")), PNSSendResp.class);
-                        if(resp.getSuccess()) {
-                            logger.info("Sale Upload success Size {}", i);
-                            pageReq.put("if_batch_no",resp.getIf_batch_no());
-                        }
-                    }
-                }
-            } catch (Exception e) {
-                logger.info(e.getMessage());
-                e.printStackTrace();
-
-            }
-
-        }
-    }
-
-    public List<PNSSendData> getSaleDataUpload() {
-        try {
-            List<PNSSendData> sendSales = baseDao
-                    .getJdbcTemplate()
-                    .query(" SELECT SUBSTR(YEAR_MONTH,1,4)||'-'||SUBSTR(YEAR_MONTH,5,2) ymonth,MODEL_NO_CUST,MODEL_NO_ISP,FINAL_BUYER_CUST,FINAL_BUYER_NAME,CONFIRM_DATE,DATA_TYPE,DIVISION_NO,ROUND(SUM(QUANTITY),0) QUANTITY,CUST_ID,CUST_NAME FROM PNS_SENDDATADETAIL LEFT JOIN  PNS_SENDDATAMAIN ON PNS_SENDDATADETAIL.MM_ID=PNS_SENDDATAMAIN.MAIN_ID " +
-                            "WHERE BILLSTATUS='已审核' AND UPLOAD=0 GROUP BY YEAR_MONTH,MODEL_NO_CUST,MODEL_NO_ISP,FINAL_BUYER_CUST,FINAL_BUYER_NAME,CONFIRM_DATE,DATA_TYPE,DIVISION_NO,CUST_ID,CUST_NAME ORDER BY DATA_TYPE DESC,MODEL_NO_ISP ASC,CONFIRM_DATE ASC ", new BeanPropertyRowMapper<PNSSendData>(PNSSendData.class));
-            int num = 0;
-            for(PNSSendData sendSale : sendSales) {
-                num ++;
-                if(num > pageSize) {
-                    num = 1;
-                }
-                sendSale.setRow_number(num); //分页处理序号问题
-                /*sendSale.setCust_id(pnsConfig.getCust_id());
-                sendSale.setCust_name("华商龙商务互联");
-                sendSale.setYmonth("2023-04");*/
-            }
-            baseDao.execute("UPDATE PNS_SENDDATADETAIL SET UPLOAD=-1 WHERE UPLOAD=0");
-            return sendSales;
-        } catch (EmptyResultDataAccessException e) {
-            return null;
-        }
-    };
-}

+ 0 - 27
src/main/java/com/uas/eis/task/ProductMITask.java

@@ -1,27 +0,0 @@
-package com.uas.eis.task;
-
-import com.uas.eis.dao.BaseDao;
-import com.uas.eis.dao.SqlRowList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author: zhouy
- * @date: 2022/5/6 17:18
- * @desc: 型号MI路径更新
- */
-@Component
-@EnableAsync
-@EnableScheduling
-public class ProductMITask {
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-}

+ 16 - 1
src/main/java/com/uas/eis/utils/HttpUtil.java

@@ -254,7 +254,22 @@ public class HttpUtil {
         CloseableHttpResponse response = httpClient.execute(post);
         return Response.getResponse(response);
     }
-	
+
+	public static Response doPost(String postUrl, String formData,String deipaaskeyauth,String deipaasjwt) throws Exception {
+		CloseableHttpClient httpClient = HttpClients.createDefault();
+		HttpPost post = new HttpPost(postUrl);
+		StringEntity postingString = new StringEntity(formData, HTTP.UTF_8);
+		post.setEntity(postingString);
+		// 设置 Authorization 头为 NoAuth
+		post.setHeader("Authorization", "NoAuth");
+		post.setHeader("deipaaskeyauth",deipaaskeyauth);
+		post.setHeader("Content-type", "application/json");
+		if(StringUtil.hasText(deipaasjwt)){
+			post.setHeader("deipaasjwt", deipaasjwt);
+		}
+		CloseableHttpResponse response = httpClient.execute(post);
+		return Response.getResponse(response);
+	}
 	public static Response doPost(String postUrl, String formData,  boolean sign, String signKey, int timeout) throws Exception {
 		URL url = new URL(postUrl);
 		HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();

+ 4 - 13
src/main/resources/application-dev.yml

@@ -4,7 +4,7 @@ spring:
         driverClassName: oracle.jdbc.OracleDriver
         username: YITOA_DATACENTER
         password: select!#%*(
-        url: jdbc:oracle:thin:@10.10.10.103:1521:orcl
+        url: jdbc:oracle:thin:@10.1.81.208:11756:orcl
         initialSize: 1
         maxActive: 3
         maxWait: 30000
@@ -22,18 +22,9 @@ server:
     tomcat:
         uri_encoding: UTF-8
     context-path:
-        /eis_invoice
-    port: 8184
+        /eis_catl
+    port: 8185
 
 action:
     api_action: /EIS/api,/EIS/mes,/EIS/erp
-    public_actions: /EIS/logout,/EIS/hello1
-
-extral:
-    donlim:
-        route: https://sdk.nuonuo.com/open/v1/services
-        appKey : 78607195
-        appSecret : 26A860C451744A21
-        token  : 77f21f617f87135fcd97ef1ueud3dxdi
-        taxnum : 339901999999199
-        isProd : true
+    public_actions: /EIS/logout,/EIS/hello1

+ 3 - 12
src/main/resources/application-prod.yml

@@ -4,7 +4,7 @@ spring:
         driverClassName: oracle.jdbc.OracleDriver
         username: YITOA_DATACENTER
         password: select!#%*(
-        url: jdbc:oracle:thin:@10.10.10.103:1521:orcl
+        url: jdbc:oracle:thin:@10.1.81.208:11756:orcl
         initialSize: 1
         maxActive: 3
         maxWait: 30000
@@ -22,18 +22,9 @@ server:
     tomcat:
         uri_encoding: UTF-8
     context-path:
-        /eis_invoice
-    port: 8184
+        /eis_catl
+    port: 8185
 
 action:
     api_action: /EIS/api,/EIS/mes,/EIS/erp
     public_actions: /EIS/logout,/EIS/hello1
-
-extral:
-    donlim:
-        route: https://sdk.nuonuo.com/open/v1/services
-        appKey: 47646161
-        appSecret: B6681C05C3EA4408
-        token:  3792fb46bc927024c7f6a504fzow07cs
-        taxnum: 91440300319521190W
-        isProd: true

+ 90 - 215
src/test/java/com/uas/eis/UasEisApplicationTests.java

@@ -1,24 +1,22 @@
 package com.uas.eis;
 
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.uas.eis.config.DonlimConfig;
 import com.uas.eis.dao.*;
 import com.uas.eis.service.ERPService;
-import com.uas.eis.task.ElecInvoiceTask;
-import com.uas.eis.task.InvoiceOrderTask;
-import nuonuo.open.sdk.NNOpenSDK;
+import com.uas.eis.utils.*;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.protocol.HTTP;
 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.http.HttpStatus;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import java.io.*;
-import java.net.URL;
-import java.net.URLConnection;
-import java.text.SimpleDateFormat;
 import java.util.*;
 
 @RunWith(SpringRunner.class)
@@ -28,229 +26,106 @@ public class UasEisApplicationTests {
 	private BaseDao baseDao;
 	@Autowired
 	private ERPService erpService;
-	@Autowired
-	private DonlimConfig donlimConfig;
-	@Autowired
-	private ElecInvoiceTask elecInvoiceTask;
-	@Autowired
-	InvoiceOrderTask invoiceOrderTask;
-	/**
-	 * 	开票订单对接
-	 */
-	@Test
-	public void Test() {
-		System.out.println("test");
-		System.out.println(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
-		Object ob=baseDao.getFieldDataByCondition("enterprise","EN_WHICHSYSTEM","1=1");
-		System.out.println(ob.toString());
-		erpService.pushInvoiceOrder("N_HUASL_SZ",47);
-	}
-	/**
-	 * 	获取token
-	 */
-	@Test
-	public void Test1() {
-		/*//测试
-		String appKey = "SD47646161";
-		String appSecret = "SD681C05C3EA4408";*/
-		//正式
-		String appKey = "47646161";
-		String appSecret = "B6681C05C3EA4408";
-		// 接口调用
-		NNOpenSDK sdk = NNOpenSDK.getIntance();
-		String json = sdk.getMerchantToken(appKey, appSecret);
-
-		// 响应报文解析
-		System.out.println("\n\n\n【商户获取Token】");
-		System.out.println(json);
-	}
 
 	@Test
-	public void Test2(){
-		NNOpenSDK sdk = NNOpenSDK.getIntance();
-		String taxnum ="339901999999199";////测试
-		String appKey = "78607195";
-		String appSecret = "26A860C451744A21";
-		String method = "nuonuo.OpeMplatform.queryInvoiceList"; // API方法名
-		String url = "https://sdk.nuonuo.com/open/v1/services";//SDK请求地址
-		String token = "77f21f617f87135fcd97ef1ueud3dxdi";
-		String content = "{  \"requestType\": \"1\",  \"pageNo\": \"2\",  \"pageSize\": \"20\",  \"taxnum\": \"339901999999199\", " +
-						" \"startTime\": \"2023-07-20 00:00:00\",  " +
-						"\"endTime\": \"2023-07-21 00:00:00\" }";
-		content=sdk.convertToUtf8(content);
-		String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-		String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-		System.out.println("result:");
-		System.out.println(result);
-	}
-	/**
-	 * 	请求开具发票
-	 */
-	@Test
-	public void Test3() {
-		erpService.invoiceOrderSubmitKp("N_HUASL_SZ",5);
+	public void TestUrl11(){
+		try {
+			CloseableHttpClient httpClient = HttpClients.createDefault();
+			HttpPost post = new HttpPost("https://ipaassit.catl.com/gateway/outside/ipaas/ipaas/ipaas_getJwtToken");
+			StringEntity postingString =
+					new StringEntity("{\"appKey\":\"WMS_HSL-51J0ISM3\",\"appSecret\":\"52cc3f11-0764-493c-a3bf-a7bcd4f0e66e\",\"time\":\"60\"}"
+							, HTTP.UTF_8);
+			post.setEntity(postingString);
+			// 设置 Authorization 头为 NoAuth
+			post.setHeader("Authorization", "NoAuth");
+			post.setHeader("deipaaskeyauth","n71K0e3D0N783kA04078521ZS28Gh6K5");
+			post.setHeader("Content-type", "application/json");
+			CloseableHttpResponse response = httpClient.execute(post);
+			HttpUtil.Response res = HttpUtil.Response.getResponse(response);
+			System.out.println("response:"+res.getStatusCode());
+			System.out.println("res:"+res.getResponseText());
+		}catch (Exception e){
+			e.printStackTrace();
+		}
 	}
 
-	/**
-	 * 删除平台开票订单
-	 */
-	@Test
-	public void Test_del() {
-		erpService.cancelInvoiceOrder("N_HUASL_SZ",7);
-	}
-	/**
-	 *  nuonuo.OpeMplatform.findOrderState(诺税通Saas订单状态查询接口)
-	 */
 	@Test
-	public void TestfindOrderState() {
-		String OrderCode = "SZ24030025";
-		SqlRowList io = baseDao.queryForRowSet("SELECT io_id FROM N_HUASL_SZ.invoiceOrder where IO_STATUS ='已审核' and IO_DOCKSTATUS = '对接成功' " +
-//				"and nvl(IO_INVOICESTATUS,0) in(0,1,6) " +
-				"and io_code = '"+OrderCode+"'" +
-				"order by io_id ");
-		//订单状态(0:待处理 1:处理中 2:已处理 4:提交失败 6:部分待处理 7:无需开票)
-		//0:待处理 表示订单没有转了开票申请,此状态需要定时获取
-		//1:处理中 表示订单可能转了开票申请,此状态需要定时获取
-		//2:已处理 表示订单全部都转了开票申请,没有发票号的情况下要继续获取订单状态。
-		//4:提交失败 表示订单自动转失败了,此状态需要定时获取
-        //6:部分待处理 表示订单部分转了开票申请,此状态需要定时获取
-		//7:无需开票,此状态可以不用管,此状态需要定时获取
-		while (io.next()){
-			Map<String, Object> mm = erpService.findOrderState("N_HUASL_SZ", io.getGeneralInt("io_id"));
+	public void TestUrl(){
+		try {
+			HttpUtil.Response response = HttpUtil.doPost("https://ipaassit.catl.com/gateway/outside/ipaas/ipaas/ipaas_getJwtToken"
+					,"{\"appKey\":\"WMS_HSL-51J0ISM3\",\"appSecret\":\"52cc3f11-0764-493c-a3bf-a7bcd4f0e66e\",\"time\":\"60\"}"
+					,"n71K0e3D0N783kA04078521ZS28Gh6K5","");
+			System.out.println("response:"+response.getStatusCode());
+			System.out.println("res:"+response.getResponseText());
+			if (response.getStatusCode() == HttpStatus.OK.value()){
+				String res = response.getResponseText();
+				if(res!=null && !"".equals(res)){
+					System.out.println("res:"+res);
+				}else{
+					System.out.println("???");
+				}
+			}
+		}catch (Exception e){
+			e.printStackTrace();
 		}
 	}
-	@Test
-	public void TestInvoiceOrderStateUpdate(){
-		invoiceOrderTask.InvoiceOrderStateUpdate();
-	}
 	/**
-	 *  查询订单关联发票接口 nuonuo.OpeMplatform.findOrderRelationInvoice
+	 * 	获取token
 	 */
 	@Test
-	public void Test5() {
-		NNOpenSDK sdk = NNOpenSDK.getIntance();
-		String taxnum ="91440300319521190W";////测试
-		String appKey = "47646161";
-		String appSecret = "B6681C05C3EA4408";
-		String method = "nuonuo.OpeMplatform.findOrderRelationInvoice"; // API方法名
-		String url = "https://sdk.nuonuo.com/open/v1/services";//SDK请求地址
-		String token = "3792fb46bc927024c7f6a504fzow07cs";
-		Map<String,Object> reqParam=new HashMap<>();
-		reqParam.put("needInvoiceSourceDetail","1");// 是否需要发票所来源的订单明细,1-是, 0-否(不填默认 0) 当为0时,将不回传orderDetailCallBackVOS
-		//SZ23070026
-		//betaRTC-202105-003180-209
-//		reqParam.put("originalOrderNo","SZ24030025");//部分待处理-没开票 {"status":"8958","message":"该订单对应的开票单不存在","data":null}
-//		reqParam.put("originalOrderNo","SZ24020177");//部分待处理-没开票 {"status":"8958","message":"该订单对应的开票单不存在","data":null}
-		reqParam.put("originalOrderNo","SZ24020188");//部分待处理-没开票 {"status":"8958","message":"该订单对应的开票单不存在","data":null}
-		reqParam.put("saleTaxNum","91440300319521190W");
-		// invoiceState = 1 开票状态,合并冲销时为空 1:开票成功 2:开票失败
-		//exceptionMessage 开票异常信息,开票失败状态时返回
-		String content=JSONArray.toJSONString(reqParam);
-//     content=sdk.convertToUtf8(content);
-//		System.out.println(content);
-		String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-		String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-		System.out.println(result);
-	}
-
-	@Test
-	public void TestDownLoadElecInvoice(){
-//		20230731182154174492 SZ23070033
-//		Map<String, Object> m = erpService.getElecInvoicesById("N_HUASL_SZ", 1150);//退货单 发票获取
-		Map<String, Object> m = erpService.getElecInvoicesById("N_HUASL_SZ", 881);//有退货单的蓝票 发票获取
-		System.out.println(JSONObject.toJSONString(m));
-//		elecInvoiceTask.elecInvoiceDownLoad();
-	}
-
-	//文件转存
-	//https://inv.jss.com.cn/fp2/2zpnwyKkdvu9dWzE8BhmSnER0Iux3xQRMLidDJhiIE2PziVXY4lL3k83OsK0K06YctW5cf1FFHxraffj-bf16A.pdf
-	@Test
-	public void TestPdfDowLoad(){
-		//下载地址
-		String fileUrl = "https://inv.jss.com.cn/fp2/2zpnwyKkdvu9dWzE8BhmSnER0Iux3xQRMLidDJhiIE2PziVXY4lL3k83OsK0K06YctW5cf1FFHxraffj-bf16A.pdf";
-		// 定义要保存的文件的路径
-		String filePath = "C:\\invoice\\988038486766_00007404.pdf";//开票代码_发票号码
+	public void TestToken() {
+		String route = "https://ipaassit.catl.com/gateway/outside/ipaas";
+		String deipaaskeyauth = "n71K0e3D0N783kA04078521ZS28Gh6K5";
+		String action="/ipaas/ipaas_getJwtToken";
+		String appKey = "WMS_HSL-51J0ISM3";
+		String appSecret = "52cc3f11-0764-493c-a3bf-a7bcd4f0e66e";
+		System.out.println("route:"+route+",action:"+action+",deipaaskeyauth:"+deipaaskeyauth+",appKey:"+appKey+",appSecret:"+appSecret);
+		/*
+		* {
+			"appKey":"WMS_HSL-51J0ISM3",
+			"appSecret":"52cc3f11-0764-493c-a3bf-a7bcd4f0e66e",
+			"time":"60"
+		}
+		* */
+		Map<String,Object> paraMap=new HashMap<>();
+		paraMap.put("appKey",appKey);
+		paraMap.put("appSecret",appSecret);
+		paraMap.put("time",60);
+		System.out.println("paraMap:"+ JacksonUtil.toJson(paraMap));
 		try {
-			// 创建URL对象
-			URL url = new URL(fileUrl);
-			// 打开连接
-			URLConnection conn = url.openConnection();
-			// 获取输入流
-			InputStream in = conn.getInputStream();
-			// 创建输出流
-			OutputStream out = new FileOutputStream(filePath);
-			// 创建缓冲区
-			byte[] buffer = new byte[1024];
-			// 读取并写入数据
-			int len;
-			while ((len = in.read(buffer)) != -1) {
-				out.write(buffer, 0, len);
+			HttpUtil.Response response =HttpUtil.doPost(route+action, JacksonUtil.toJson(paraMap), deipaaskeyauth,"");
+			if (response.getStatusCode() == HttpStatus.OK.value()){
+				String res = response.getResponseText();
+				if(res!=null && !"".equals(res)){
+					Map<String,Object> resMap = JacksonUtil.fromJson(res);
+					System.out.println(resMap.get("accessToken"));
+				}else{
+					System.out.println("No ResponseText");
+				}
+			}else {
+				System.out.println("response:"+response.getStatusCode());
+				System.out.println("res:"+response.getResponseText());
 			}
-			// 关闭流
-			in.close();
-			out.close();
-			//存文件 filepath
-			System.out.println("下载成功");
-		} catch (Exception e) {
+		}catch (Exception e){
 			e.printStackTrace();
 		}
 	}
-
-	@Test
-	public void TestElecInvoiceAttachSave(){
-		elecInvoiceTask.elecInvoiceAttachSave();
-	}
-	//冲红
 	@Test
-	public void testRushRed(){
-		erpService.rushRed("N_HUASL_SZ",7);
+	public void TestGetToken(){
+		Object[] obs = baseDao.getFieldsDataByCondition("YITOA_DATACENTER.dock_catl_config"
+				, new String[]{"URL_","deipaaskeyauth","appKey", "appSecret"}
+				, "username='N_HUASL_SZ' and ENVTYPE = 0 ");
+		Map<String,String> map = new HashMap<>();
+		map.put("url",String.valueOf(obs[0]));
+		map.put("deipaaskeyauth",String.valueOf(obs[1]));
+		map.put("appKey",String.valueOf(obs[2]));
+		map.put("appSecret",String.valueOf(obs[3]));
+		erpService.getToken(map);
 	}
-
 	@Test
-	public void queryInvoiceRedConfirm(){
-		String url=donlimConfig.getRoute();
-		String appKey = donlimConfig.getAppKey();
-		String appSecret = donlimConfig.getAppSecret();
-		String token =  donlimConfig.getToken();
-		String taxnum=  donlimConfig.getTaxnum();
-//		erpService.queryInvoiceRedConfirmByCode( taxnum,  appKey,  appSecret,  token, url,"1135624457459470336");
+	public void TestCreateSticker(){
+		Map<String, Object> resMap = erpService.createSticker("N_HUASL_SZ", 1);
+		System.out.println("resMap:"+resMap.toString());
 	}
 
-	@Test
-	public void testRed(){
-		NNOpenSDK sdk = NNOpenSDK.getIntance();
-		String taxnum ="339901999999199";////测试
-		String appKey = "78607195";
-		String appSecret = "26A860C451744A21";
-		String token = "77f21f617f87135fcd97ef1ueud3dxdi";
-		String url = "https://sdk.nuonuo.com/open/v1/services";//SDK请求地址
-		String method = "nuonuo.OpeMplatform.queryInvoiceResult"; // API方法名
-		String content = "{" +
-//				"\"serialNos\": \"23073118215402725192\""+//流水号 -- EI_SID -- invoiceSerialNum
-  				",\"orderNos\": \"20230731182154174492\""+ //开票单号 --- EI_ORDERNO -- ORDERNO
-  				",\"isOfferInvoiceDetail\": \"0\""+
-//				",\"extensionNumber\": \"-\","+
-//				"\"deptId\": \"-\","+
-//				"\"clerkId\": \"-\","+
-//				"\"startTime\": \"2022-05-19\","+
-//				"\"endTime\": \"2022-06-19\""+
-				"}";
-	String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,32位随机码,无需修改,保持默认即可
-	String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
-		System.out.println(result);
-	}
-	@Test
-	public void TestelecInvoiceRedConfirmStateUpdate(){
-		elecInvoiceTask.elecInvoiceRedConfirmStateUpdate();
-	}
-	@Test
-	public void TestElecInvoiceRedAttachSave(){
-		elecInvoiceTask.elecInvoiceRedAttachSave();
-	}
-
-	//退货单 红票获取
-	@Test
-	public void TestsaleReturnElecInvoiceDownLoad(){
-		elecInvoiceTask.saleReturnElecInvoiceDownLoad();
-	}
 }