Browse Source

业务处理单过滤

xuhao 6 months ago
parent
commit
7bdad9d7df

+ 0 - 206
src/main/java/kd/imc/rim/AwsRecognitionServiceEx.java

@@ -1,206 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by FernFlower decompiler)
-//
-
-package kd.imc.rim;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Maps;
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import kd.bos.dataentity.resource.ResManager;
-import kd.bos.logging.Log;
-import kd.bos.logging.LogFactory;
-import kd.bos.util.StringUtils;
-import kd.imc.rim.common.constant.InputInvoiceTypeEnum;
-import kd.imc.rim.common.invoice.model.ConvertFieldUtil;
-import kd.imc.rim.common.invoice.query.convert.impl.AirConvertService;
-import kd.imc.rim.common.invoice.recognitionnew.RecognitionService;
-import kd.imc.rim.common.invoice.recognitionnew.model.RecognitionParam;
-import kd.imc.rim.common.invoice.recognitionnew.model.RecognitionResult;
-import kd.imc.rim.common.message.exception.MsgException;
-import kd.imc.rim.utils.ApiHttpUtils;
-import kd.imc.rim.utils.FileOutputStreamExample;
-import org.apache.commons.compress.utils.Lists;
-
-public class AwsRecognitionServiceEx implements RecognitionService {
-    private static Log logger = LogFactory.getLog(AwsRecognitionServiceEx.class);
-    private static final int connectionTimeout = 3000;
-    private static final int readTimeout = 60000;
-
-    public AwsRecognitionServiceEx() {
-    }
-
-    public RecognitionResult recognitionInvoice(RecognitionParam recognitionParam) {
-        RecognitionResult recognitionResult = this.getResultFromDb(recognitionParam);
-        if (recognitionResult == null) {
-            recognitionResult = this.getResultFromAws(recognitionParam);
-        }
-
-        return recognitionResult;
-    }
-
-    private RecognitionResult getResultFromAws(RecognitionParam recognitionParam) {
-        RecognitionResult recognitionResult = new RecognitionResult();
-        Map<String, Object> extMap = recognitionParam.getExtMap();
-        Map<String, Object> bodyMap = Maps.newHashMap();
-        bodyMap.put("eid", extMap.get("eid") + "");
-        bodyMap.put("taxNo", extMap.get("taxNo") + "");
-        bodyMap.put("recogType", recognitionParam.getRecogType());
-        bodyMap.put("overseaAppCode", recognitionParam.getAppCode());
-        String fileUrl = recognitionParam.getFileUrl();
-        String imgStrToBase64 = FileOutputStreamExample.getImgStrToBase64(fileUrl);
-        try {
-            String serviceType = this.getServiceType(recognitionParam);
-            Map<String, String> headers = Maps.newHashMap();
-            boolean overseaFlag = false;
-            if (!"".equals(imgStrToBase64)) {
-                long start = System.currentTimeMillis();
-                String url = "http://10.3.2.70:8115/cci_ai/service/v1/receipt_crop_and_recog";
-                String valueFileName;
-                ByteArrayInputStream valueInputStream = recognitionParam.getFileByteArrayInputStream();
-                valueFileName = recognitionParam.getFileName();
-                int retryTimes = 1;
-                for(int times = 1; times <= retryTimes; ++times) {
-                    logger.info("aws识别bodyMap:{}", bodyMap);
-                    String result = ApiHttpUtils.Posthttp(url, imgStrToBase64);
-                    result=ApiHttpUtils.toFiledata(result);
-                    logger.info("aws识别接口返回结果{}:{}", times, result);
-                    boolean reTry = false;
-                    if (!StringUtils.isNotEmpty(result)) {
-                        break;
-                    }
-
-                    JSONArray recognitionArray = this.getRecoginitionData(recognitionResult, result, overseaFlag);
-                    if (recognitionArray == null) {
-                        break;
-                    }
-
-                    boolean saveFlag = true;
-
-                    for(int i = 0; i < recognitionArray.size(); ++i) {
-                        JSONObject invoiceInfo = recognitionArray.getJSONObject(i);
-                        if ("1".equals(invoiceInfo.getString("defaultOther"))) {
-                            saveFlag = false;
-                            if (times < retryTimes) {
-                                reTry = true;
-                                throw new MsgException("0002", ResManager.loadKDString("aws识别异常", "AwsRecognitionService_0", "imc-rim-common", new Object[0]));
-                            }
-                        }
-
-                        this.setResultValue(invoiceInfo);
-                    }
-
-                    if (!reTry) {
-                        if (saveFlag) {
-                            this.saveRecognition(recognitionParam, serviceType, result, System.currentTimeMillis() - start);
-                        }
-
-                        recognitionResult.setData(this.convertRecognition(recognitionArray));
-                        break;
-                    }
-                }
-            } else {
-                recognitionResult.setData(new ArrayList(1));
-            }
-
-            return recognitionResult;
-        } catch (Throwable var22) {
-            logger.error("AwsRecognitionService exception:", var22);
-            if (var22 instanceof MsgException) {
-                throw new MsgException(((MsgException)var22).getErrorCode(), ((MsgException)var22).getErrorMsg());
-            } else {
-                throw new MsgException("0001", ResManager.loadKDString("aws识别异常", "AwsRecognitionService_0", "imc-rim-common", new Object[0]));
-            }
-        }
-    }
-
-    private RecognitionResult getResultFromDb(RecognitionParam recognitionParam) {
-        RecognitionResult recognitionResult = new RecognitionResult();
-        String serviceType = this.getServiceType(recognitionParam);
-        String resultStr = this.getRecognitionResultFromDb(recognitionParam, serviceType);
-        if (StringUtils.isEmpty(resultStr)) {
-            return null;
-        } else {
-            boolean overseaFlag = false;
-            if (!resultStr.contains("recoginitionData")) {
-                overseaFlag = true;
-            }
-
-            JSONArray recognitionArray = this.getRecoginitionData(recognitionResult, resultStr, overseaFlag);
-            if (recognitionArray == null) {
-                return null;
-            } else {
-                for(int i = 0; i < recognitionArray.size(); ++i) {
-                    JSONObject invoiceInfo = recognitionArray.getJSONObject(i);
-                    this.setResultValue(invoiceInfo);
-                }
-
-                recognitionResult.setData(this.convertRecognition(recognitionArray));
-                return recognitionResult;
-            }
-        }
-    }
-
-    private JSONArray getRecoginitionData(RecognitionResult recognitionResult, String resultStr, boolean overseaFlag) {
-        if (StringUtils.isNotEmpty(resultStr)) {
-            JSONObject recognitionJson = JSONObject.parseObject(resultStr);
-            recognitionResult.setErrcode(recognitionJson.getString("errcode"));
-            recognitionResult.setDescription(recognitionJson.getString("description"));
-
-            try {
-                if (overseaFlag) {
-                    JSONArray data = recognitionJson.getJSONArray("data");
-
-                    for(int i = 0; i < data.size(); ++i) {
-                        JSONObject overseaInfo = data.getJSONObject(i);
-                        overseaInfo.put("invoiceType", InputInvoiceTypeEnum.OVERSEA_INVOICE.getAwsType());
-                    }
-
-                    return data;
-                }
-
-                JSONObject data = recognitionJson.getJSONObject("data");
-                if (data != null) {
-                    return data.getJSONArray("recoginitionData");
-                }
-            } catch (Exception var8) {
-                logger.info("getRecoginitionData exception:", var8);
-            }
-        }
-
-        return null;
-    }
-
-    private void setResultValue(JSONObject invoiceInfo) {
-        invoiceInfo.put("snapshotUrl", "");
-        invoiceInfo.put("kdcloudUrl", "");
-        invoiceInfo.put("downloadUrl", "");
-        Long invoiceType = InputInvoiceTypeEnum.getInvoiceTypeByAwsType(invoiceInfo.getString("invoiceType"));
-        invoiceInfo.put("invoiceType", invoiceType);
-        if (InputInvoiceTypeEnum.AIR_INVOICE.getCode().equals(invoiceType)) {
-            JSONArray items = invoiceInfo.getJSONArray("items");
-            if (items != null && items.size() > 0) {
-                JSONObject firstOne = items.getJSONObject(0);
-                invoiceInfo.put("seatGrade", firstOne.getString("seatGrade"));
-                invoiceInfo.put("flightNum", firstOne.getString("flightNum"));
-                invoiceInfo.put("seatGradeName", AirConvertService.convertSeatName(firstOne.getString("seatGrade")));
-            }
-        }
-
-    }
-
-    private List<Object> convertRecognition(JSONArray recognitionArray) {
-        List<Object> entityList = Lists.newArrayList();
-        ConvertFieldUtil.convertRecognitionEntity(entityList, recognitionArray, new String[]{"items"});
-        return entityList;
-    }
-
-    public String getServiceType(RecognitionParam recognitionParam) {
-        return "aws" + recognitionParam.getRecogType();
-    }
-}

+ 0 - 3226
src/main/java/kd/imc/rim/FpzsMainPluginEx.java

@@ -1,3226 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by FernFlower decompiler)
-//
-
-package kd.imc.rim;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Maps;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.EventObject;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import kd.bos.cache.CacheFactory;
-import kd.bos.cache.TempFileCache;
-import kd.bos.context.RequestContext;
-import kd.bos.dataentity.entity.DynamicObject;
-import kd.bos.dataentity.entity.DynamicObjectCollection;
-import kd.bos.dataentity.entity.LocaleString;
-import kd.bos.dataentity.metadata.IDataEntityProperty;
-import kd.bos.dataentity.resource.ResManager;
-import kd.bos.dataentity.serialization.SerializationUtils;
-import kd.bos.dataentity.utils.ObjectUtils;
-import kd.bos.dlock.DLock;
-import kd.bos.entity.EntityMetadataCache;
-import kd.bos.entity.MainEntityType;
-import kd.bos.entity.datamodel.ListSelectedRowCollection;
-import kd.bos.entity.datamodel.events.PropertyChangedArgs;
-import kd.bos.ext.form.control.CustomControl;
-import kd.bos.fileservice.FileItem;
-import kd.bos.fileservice.FileServiceFactory;
-import kd.bos.fileservice.enums.PreviewParams;
-import kd.bos.form.CloseCallBack;
-import kd.bos.form.ConfirmCallBackListener;
-import kd.bos.form.ConfirmTypes;
-import kd.bos.form.FormShowParameter;
-import kd.bos.form.IClientViewProxy;
-import kd.bos.form.IPageCache;
-import kd.bos.form.MessageBoxOptions;
-import kd.bos.form.MessageBoxResult;
-import kd.bos.form.ShowFormHelper;
-import kd.bos.form.ShowType;
-import kd.bos.form.cardentry.CardEntry;
-import kd.bos.form.container.Tab;
-import kd.bos.form.control.Button;
-import kd.bos.form.control.Control;
-import kd.bos.form.control.EntryGrid;
-import kd.bos.form.control.Label;
-import kd.bos.form.control.Toolbar;
-import kd.bos.form.control.events.ItemClickEvent;
-import kd.bos.form.control.events.RowClickEvent;
-import kd.bos.form.control.events.RowClickEventListener;
-import kd.bos.form.control.events.TabSelectEvent;
-import kd.bos.form.control.events.TabSelectListener;
-import kd.bos.form.control.events.UploadEvent;
-import kd.bos.form.control.events.UploadListener;
-import kd.bos.form.events.AfterDoOperationEventArgs;
-import kd.bos.form.events.BeforeClosedEvent;
-import kd.bos.form.events.ClosedCallBackEvent;
-import kd.bos.form.events.CustomEventArgs;
-import kd.bos.form.events.MessageBoxClosedEvent;
-import kd.bos.list.ListFilterParameter;
-import kd.bos.list.ListShowParameter;
-import kd.bos.logging.Log;
-import kd.bos.logging.LogFactory;
-import kd.bos.msgjet.MsgSendFactory;
-import kd.bos.mvc.cache.PageCache;
-import kd.bos.mvc.form.ClientViewProxy;
-import kd.bos.orm.query.QFilter;
-import kd.bos.orm.util.CollectionUtils;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
-import kd.bos.servicehelper.QueryServiceHelper;
-import kd.bos.servicehelper.operation.DeleteServiceHelper;
-import kd.bos.servicehelper.operation.SaveServiceHelper;
-import kd.bos.url.UrlService;
-import kd.imc.rim.common.constant.AttachConstant;
-import kd.imc.rim.common.constant.CollectTypeEnum;
-import kd.imc.rim.common.constant.FpzsConstant;
-import kd.imc.rim.common.constant.InputInvoiceTypeEnum;
-import kd.imc.rim.common.helper.ExcelHelper;
-import kd.imc.rim.common.helper.ImcSaveServiceHelper;
-import kd.imc.rim.common.helper.RecognitionCheckHelper;
-import kd.imc.rim.common.invoice.fpzs.FpzsAwsService;
-import kd.imc.rim.common.invoice.fpzs.FpzsMainService;
-import kd.imc.rim.common.invoice.query.AttachQueryService;
-import kd.imc.rim.common.invoice.query.InvoiceQueryService;
-import kd.imc.rim.common.invoice.query.convert.impl.AirConvertService;
-import kd.imc.rim.common.invoice.recognition.impl.RecognitionCheckTask;
-import kd.imc.rim.common.invoice.save.InvoiceSaveResult;
-import kd.imc.rim.common.invoice.save.InvoiceSaveService;
-import kd.imc.rim.common.invoice.verify.VerifyService;
-import kd.imc.rim.common.invoice.verify.VerifyStatisticsService;
-import kd.imc.rim.common.invoice.verify.VerifyUtil;
-import kd.imc.rim.common.license.LicenseFormPlugin;
-import kd.imc.rim.common.message.exception.MsgException;
-import kd.imc.rim.common.service.DialogService;
-import kd.imc.rim.common.service.InvoiceAutoFillBillService;
-import kd.imc.rim.common.service.InvoiceLog;
-import kd.imc.rim.common.utils.BigDecimalUtil;
-import kd.imc.rim.common.utils.CacheHelper;
-import kd.imc.rim.common.utils.DynamicObjectUtil;
-import kd.imc.rim.common.utils.FileUploadUtils;
-import kd.imc.rim.common.utils.FileUtils;
-import kd.imc.rim.common.utils.InvoiceConfigUtils;
-import kd.imc.rim.common.utils.InvoiceConvertUtils;
-import kd.imc.rim.common.utils.RimConfigUtils;
-import kd.imc.rim.common.utils.UUID;
-import kd.imc.rim.common.utils.itextpdf.UrlServiceUtils;
-import kd.imc.rim.formplugin.fpzs.FpzsAttachService;
-import kd.imc.rim.formplugin.fpzs.operate.FpzsOperateService;
-import org.apache.commons.compress.utils.IOUtils;
-import org.apache.commons.compress.utils.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.tuple.Pair;
-
-public class FpzsMainPluginEx extends LicenseFormPlugin implements RowClickEventListener, UploadListener, TabSelectListener {
-    private static Log logger = LogFactory.getLog(FpzsMainPluginEx.class);
-    private Map<String, String> traceMap;
-    private static final String TEMPLATE_DIR = "templates";
-    private static final String TEMPLATE_NAME = "发票查验模板.xlsx";
-    private static final String ATTACH_PDF_ICON_NAME = "fpy_icon_pdf.png";
-    private static final String ATTACH_PDF_ICON_URL = "/rim/attach/fpy_icon_pdf.png";
-    private static final String OPERATE_ENTRY = "operate_entry";
-    private static final String OPERATE_ENTRY_ATTACH = "operate_entry_attach";
-    private static final String OPERATE_TYPE = "operate_type";
-    private static final String FLEX_INIT = "flex_init";
-    private static final String ALL_INVOICE = "all_invoice";
-    private static final String ADVCONAP_IMPORT = "advconap_import";
-    private static final String ADVCONAP_ERROR = "advconap_error";
-    private static final String ATTACH_PANNEL = "attach_panel";
-    private static final String ADVCONAP_ATTACH = "advconap_attach";
-    private static final String ATTACH_GRID_ENTRY = "attach_grid_entry";
-    private static final String ATTACH_CARD_ENTRY = "attach_card_entry";
-    private static final String TOOLBARAP_IMPORT = "toolbarap_import";
-    private static final String TOOLBARAP_ERROR = "toolbarap_error";
-    private static final String TOOLBARAP_ATTACH = "toolbarap_attach";
-    private static final String DELETE_IMPORT = "del_import";
-    private static final String EDIT_CLASS = "edit_class";
-    private static final String DELETE_ERROR = "del_error";
-    private static final String DELETE_ATTACH = "del_attach";
-    private static final String CLEAR_IMPORT = "clear_import";
-    private static final String CLEAR_ERROR = "clear_error";
-    private static final String CLEAR_ATTACH = "clear_attach";
-    private static final String CHOOSE_ATTACH_TYPE = "choose_attach_type";
-    private static final String ADD_ATTACH = "add_attach";
-    private static final String UPLOAD_INVOICE_ATTACH = "upload_invoice_attach";
-    private static final String UPLOAD_INVOICE_ATTACH2 = "upload_invoice_attach2";
-    private static final String INVOICE_CARD_ENTRY = "invoice_card_entry";
-    private static final String ERROR_INVOICE_CARD_ENTRY = "error_invoice_card_entry";
-    private static final String RADIO_FLEX = "radio_flex";
-    private static final String INVOICE_SWITCH_FLEX = "flexpanelap131";
-    private static final String RADIO_GROUP = "radiogroup";
-    private static final String EXCEL_DOWNLOAD = "excel_download";
-    private static final String BTN_IMPORT = "btn_import";
-    private static final String TAB_INVOICE = "tab_invoice";
-    private static final String TAB_ATTACH = "tab_attach";
-    private static final String TAB_OVERSEA = "tab_oversea";
-    private static final String LIST_ATTACH_BUTTON = "list_attach_button";
-    private static final String CARD_ATTACH_BUTTON = "pic_attach_button";
-    private static final String LIST_INVOICE_BUTTON = "list_invoice_button";
-    private static final String CARD_INVOICE_BUTTON = "card_invoice_button";
-    private static final String ATTACH_EDIT_BUTTON = "attach_edit_button";
-    private static final List<String> IMPORT_MSG_LIST = new ArrayList(Arrays.asList("import_filter_msg", "import_red_msg", "import_yellow_msg"));
-    private static final List<String> ERROR_MSG_LIST = new ArrayList(Arrays.asList("error_filter_msg", "error_red_msg", "error_yellow_msg"));
-    private static final String PAGE_COMPANY_INVOICE = "rim_fpzs_company_invoice";
-    private static final String ERROR_INVOICE_LIST = "error";
-    private static final String IMPORT_INVOICE_LIST = "import";
-    private static final String format = "###,##0.00";
-
-    public FpzsMainPluginEx() {
-    }
-
-    public void beforeClosed(BeforeClosedEvent e) {
-        String timeCache = "PollAwsTime" + this.getView().getPageId();
-        CacheHelper.remove(timeCache);
-        JSONObject customParam = FpzsMainService.cacheCustomParam(this);
-        String billType = customParam.getString("billType");
-        if ("personTicket".equals(billType)) {
-            this.doVerfiySave();
-        }
-
-    }
-
-    public void initialize() {
-        EntryGrid entryGrid = (EntryGrid)this.getView().getControl("operate_entry");
-        entryGrid.addRowClickListener(this);
-        EntryGrid entryGridAttach = (EntryGrid)this.getView().getControl("operate_entry_attach");
-        entryGridAttach.addRowClickListener(this);
-        Button excelDownload = (Button)this.getView().getControl("excel_download");
-        excelDownload.addClickListener(this);
-        Button importButton = (Button)this.getView().getControl("btn_import");
-        importButton.addClickListener(this);
-        Button uploadFile = (Button)this.getView().getControl("upload_file");
-        uploadFile.addUploadListener(this);
-        Button uploadInvoiceAttach = (Button)this.getView().getControl("upload_invoice_attach");
-        uploadInvoiceAttach.addUploadListener(this);
-        Button uploadInvoiceAttachUnimport = (Button)this.getView().getControl("upload_invoice_attach2");
-        uploadInvoiceAttachUnimport.addUploadListener(this);
-    }
-
-    public void registerListener(EventObject e) {
-        Tab tab = (Tab)this.getControl("tabap");
-        tab.addTabSelectListener(this);
-        this.addItemClickListeners(new String[]{"toolbarap_import", "toolbarap_error", "toolbarap_attach", "toolbarap_submit"});
-        this.addClickListeners(new String[]{"list_attach_button", "pic_attach_button", "list_invoice_button", "card_invoice_button", "buttonap"});
-        Toolbar attachLabel = (Toolbar)this.getControl("toolbarap_attach");
-        if (attachLabel != null) {
-            attachLabel.addUploadListener(this);
-        }
-
-    }
-
-    public void upload(UploadEvent evt) {
-        IPageCache pageCache = new PageCache(this.getView().getPageId());
-        String serialNo = pageCache.get("add_attach");
-        if (!StringUtils.isEmpty(serialNo)) {
-            pageCache.remove(serialNo);
-        }
-
-    }
-
-    public void afterUpload(UploadEvent evt) {
-        String callbackKey = evt.getCallbackKey();
-        if (callbackKey != null && ("add_attach".equals(callbackKey) || callbackKey.startsWith("upload_invoice_attach"))) {
-            ;
-        }
-    }
-
-    public void click(EventObject evt) {
-        Control properties = (Control)evt.getSource();
-        String clickKey = properties.getKey();
-        if ("excel_download".equals(clickKey)) {
-            if (InvoiceConfigUtils.isZhCn()) {
-                ExcelHelper.downloadTemplate(this, "templates", "发票查验模板.xlsx");
-            } else {
-                ExcelHelper.downloadTemplate(this, "templates", "invoicecheck.xlsx");
-            }
-        } else if ("buttonap".equals(clickKey)) {
-            this.checkClose();
-        } else if ("btn_import".equals(clickKey)) {
-            this.submitToBill();
-        } else if ("list_attach_button".equals(clickKey)) {
-            this.getView().getPageCache().remove("attach_list_model");
-            this.showAttachModel();
-        } else if ("pic_attach_button".equals(clickKey)) {
-            this.getView().getPageCache().put("attach_list_model", "card");
-            this.showAttachModel();
-        } else if ("list_invoice_button".equals(clickKey)) {
-            this.getView().getPageCache().remove("invoice_list_model");
-            this.showInvoiceModel();
-        } else if ("card_invoice_button".equals(clickKey)) {
-            this.getView().getPageCache().put("invoice_list_model", "card");
-            this.showInvoiceModel();
-        } else if ("add_attach".equals(properties.getKey())) {
-            this.getPageCache().remove("add_attach");
-            this.showAttachUpload();
-        }
-
-    }
-
-    private void checkClose() {
-        String verifySaveFlag = RimConfigUtils.getConfig("verify_save");
-        if (!"0".equals(verifySaveFlag)) {
-            this.getView().close();
-        } else {
-            JSONObject dataJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-            JSONArray invoiceData = new JSONArray();
-            Iterator<String> iterator = dataJson.keySet().iterator();
-
-            while(iterator.hasNext()) {
-                String key = (String)iterator.next();
-                JSONObject invoice = dataJson.getJSONObject(key);
-                if (!FpzsMainService.isFilter(invoice) && !invoice.isEmpty()) {
-                    invoiceData.add(invoice);
-                }
-            }
-
-            if (invoiceData.isEmpty()) {
-                this.getView().showTipNotification(ResManager.loadKDString("不存在符合导入的发票,请检查采集的发票是否合规", "FpzsMainPlugin_164", "imc-rim-formplugin", new Object[0]), 3000);
-            } else {
-                this.getView().showTipNotification(ResManager.loadKDString("操作成功", "ClassInvoiceService_4", "imc-rim-formplugin", new Object[0]), 3000);
-                this.getView().close();
-            }
-        }
-    }
-
-    private void doVerfiySave() {
-        String verifySaveFlag = RimConfigUtils.getConfig("verify_save");
-        boolean checkFlag = "0".equals(verifySaveFlag);
-        if (checkFlag) {
-            JSONObject dataJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-            Iterator<String> iterator = dataJson.keySet().iterator();
-            Long rimUser = FpzsMainService.getRimUser(FpzsMainService.getCustomParam(this));
-
-            while(iterator.hasNext()) {
-                String key = (String)iterator.next();
-                JSONObject invoice = dataJson.getJSONObject(key);
-                String errorLevel = invoice.getString("errorLevel");
-                String invoiceType = invoice.getString("invoiceType");
-                String serialNo = invoice.getString("serialNo");
-                VerifyUtil.updateDataStatus(errorLevel, serialNo, InputInvoiceTypeEnum.getInvoiceTypeByAwsType(invoiceType), Boolean.TRUE, rimUser);
-            }
-        }
-
-    }
-
-    private void submitToBill() {
-        Map<String, Object> param = FpzsMainService.getCustomParam(this);
-        Object linkKey = param.get("linkKey");
-        int attachTotal = this.getModel().getEntryRowCount("attach_grid_entry");
-        JSONObject returnData = new JSONObject();
-        JSONArray attachData = new JSONArray();
-        String billId = "billId";
-        if (!CollectionUtils.isEmpty(param)) {
-            billId = (String)param.get("billId");
-        }
-
-        AttachQueryService attachQueryService = new AttachQueryService();
-        String entityId = (String)param.get("entityId");
-        String resource = (String)param.get("resource");
-        JSONArray attachCacheArray = new JSONArray();
-
-        String key;
-        for(int i = 0; i < attachTotal; ++i) {
-            String serialNo = (String)this.getModel().getValue("serial_no3", i);
-            String attachId = (String)this.getModel().getValue("attachid", i);
-            JSONObject attach = new JSONObject(true);
-            attach.put("serialNo", serialNo);
-            attach.put("attachId", attachId);
-            attach.put("attachType", (String)this.getModel().getValue("attach_type", i));
-            String attachName = (String)this.getModel().getValue("attach_name", i);
-            attach.put("attachName", attachName);
-            key = (String)this.getModel().getValue("file_extension", i);
-            attach.put("fileExtension", key);
-            attach.put("originalFileName", attachName + '.' + key);
-            attach.put("attachNo", (String)this.getModel().getValue("attach_no", i));
-            attach.put("attachUrl", (String)this.getModel().getValue("attach_path", i));
-            attach.put("remark", (String)this.getModel().getValue("attach_remark", i));
-            attach.put("attachIcon", (String)this.getModel().getValue("attach_icon", i));
-            attach.put("uploadDate", this.getModel().getValue("upload_date", i));
-            Object pkValue = this.getModel().getValue("attach_category_grid");
-            Object pkValue2 = this.getModel().getValue("attach_categoryid");
-            attach.put("expenseId", billId);
-            DynamicObject attachCategory = (DynamicObject)this.getModel().getValue("attach_category_grid", i);
-            if (attachCategory != null) {
-                attach.put("attachCategory", attachCategory.getLong("id"));
-            }
-
-            attachCacheArray.add(attach);
-            JSONObject dataJson = new JSONObject();
-            dataJson.put("serialNo", serialNo);
-            dataJson.put("attachId", attachId);
-            dataJson.put("attachUrl", (String)this.getModel().getValue("attach_path", i));
-            dataJson.put("attachType", (String)this.getModel().getValue("attach_type", i));
-            dataJson.put("attachNo", (String)this.getModel().getValue("attach_no", i));
-            dataJson.put("attachName", (String)this.getModel().getValue("attach_name", i));
-            dataJson.put("remark", (String)this.getModel().getValue("attach_remark", i));
-            dataJson.put("attachSize", this.getModel().getValue("attach_size", i));
-            dataJson.put("attachIcon", this.getModel().getValue("attach_icon", i));
-            dataJson.put("uploadDate", this.getModel().getValue("upload_date", i));
-            attachData.add(dataJson);
-        }
-
-        attachQueryService.addFpzsAttach(billId, entityId, resource, attachCacheArray);
-        returnData.put("attachData", attachData);
-        JSONObject dataJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-        JSONArray invoiceData = new JSONArray();
-        JSONArray invoiceVerifyData = new JSONArray();
-        Iterator<String> iterator = dataJson.keySet().iterator();
-        Long rimUser = FpzsMainService.getRimUser(param);
-
-        while(iterator.hasNext()) {
-            key = (String)iterator.next();
-            JSONObject invoice = dataJson.getJSONObject(key);
-            invoiceVerifyData.add(invoice);
-            String errorLevel = invoice.getString("errorLevel");
-            String invoiceType = invoice.getString("invoiceType");
-            String serialNo = invoice.getString("serialNo");
-            VerifyUtil.updateDataStatus(errorLevel, serialNo, InputInvoiceTypeEnum.getInvoiceTypeByAwsType(invoiceType), Boolean.TRUE, rimUser);
-            if (!FpzsMainService.isFilter(invoice) && !invoice.isEmpty()) {
-                if (!"expense_pc".equals(param.get("resource"))) {
-                    invoice.remove("validateMessage_html");
-                }
-
-                invoiceData.add(invoice);
-            }
-        }
-
-        this.saveVerifyResult(invoiceVerifyData);
-        if (attachTotal < 1 && invoiceData.isEmpty()) {
-            this.getView().showTipNotification(ResManager.loadKDString("不存在符合导入单据的发票,请检查是否已采集发票或采集的发票是否合规", "FpzsMainPlugin_108", "imc-rim-formplugin", new Object[0]), 3000);
-        } else {
-            returnData.put("invoiceData", invoiceData);
-            Object pushType = param.get("pushType");
-            logger.info("发票助手导入单据的数据:{}", returnData);
-            InvoiceLog.insertExpenseLog(ResManager.loadKDString("发票助手导入单据", "FpzsMainPlugin_109", "imc-rim-formplugin", new Object[0]), String.valueOf(param.get("billId")), String.valueOf(param.get("billNo")), returnData.toJSONString());
-            if (pushType != null) {
-                if (ObjectUtils.isEmpty(linkKey)) {
-                    logger.info("发票助手导入单据的linkKey为空:{}-{}", String.valueOf(param.get("billId")), String.valueOf(param.get("billNo")));
-                    return;
-                }
-
-                if ("socket".equals(pushType.toString())) {
-                    MsgSendFactory.getSender().send(linkKey.toString(), returnData.toJSONString());
-                } else if ("poll".equals(pushType.toString())) {
-                    CacheHelper.put("rim_push:" + linkKey, returnData.toJSONString(), 120);
-                }
-            } else {
-                InvoiceAutoFillBillService iafbs = new InvoiceAutoFillBillService();
-                iafbs.autoFill(this.getView(), returnData);
-                this.getView().returnDataToParent(returnData);
-                this.getView().close();
-            }
-
-        }
-    }
-
-    public void itemClick(ItemClickEvent evt) {
-        String item = evt.getItemKey();
-        if ("del_import".equals(item)) {
-            this.showDeleteConfirm(ResManager.loadKDString("你确定要删除选中发票吗?", "FpzsMainPlugin_110", "imc-rim-formplugin", new Object[0]), "delete_import_invoice_List");
-        } else if ("del_error".equals(item)) {
-            this.showDeleteConfirm(ResManager.loadKDString("你确定要删除选中发票吗?", "FpzsMainPlugin_110", "imc-rim-formplugin", new Object[0]), "delete_error_invoice_List");
-        } else if ("del_attach".equals(item)) {
-            this.showDeleteConfirm(ResManager.loadKDString("你确定要删除选中附件吗?", "FpzsMainPlugin_111", "imc-rim-formplugin", new Object[0]), "del_attach");
-        } else if ("clear_import".equals(item)) {
-            this.showDeleteConfirm(ResManager.loadKDString("你确定要清空可导入发票列表吗?", "FpzsMainPlugin_112", "imc-rim-formplugin", new Object[0]), "clear_import_invoice_List");
-        } else if ("clear_error".equals(item)) {
-            this.showDeleteConfirm(ResManager.loadKDString("你确定要清空不可导入发票列表吗?", "FpzsMainPlugin_113", "imc-rim-formplugin", new Object[0]), "clear_error_invoice_List");
-        } else if ("clear_attach".equals(item)) {
-            this.showDeleteConfirm(ResManager.loadKDString("你确定要清空当前列表吗?", "FpzsMainPlugin_114", "imc-rim-formplugin", new Object[0]), "clear_attach");
-        } else if ("choose_attach_type".equals(item)) {
-            this.showAttachTypeBase();
-        } else if ("bar_excel".equals(item)) {
-            if (InvoiceConfigUtils.isZhCn()) {
-                ExcelHelper.downloadTemplate(this, "templates", "发票查验模板.xlsx");
-            } else {
-                ExcelHelper.downloadTemplate(this, "templates", "invoicecheck.xlsx");
-            }
-        } else if ("bar_import".equals(item)) {
-            this.submitToBill();
-        } else if ("edit_class".equals(item)) {
-            this.getView().setEnable(Boolean.FALSE, new String[]{"edit_class"});
-            this.operateCustomTable("import", "editClass");
-        }
-
-    }
-
-    public void afterCreateNewData(EventObject eventObject) {
-        this.getView().setVisible(Boolean.FALSE, new String[]{"all_invoice"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"advconap_import"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"advconap_error"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"attach_panel"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"flexpanelap11"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"attach_panel"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"flexpanelap12"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"edit_class"});
-        this.progressBarVisible(false, (String[])null);
-        CustomControl scannerControl = (CustomControl)this.getControl("custom_scanner");
-        ScannerServiceEx.init(scannerControl, this.getView().getPageId());
-        JSONObject customParam = FpzsMainService.cacheCustomParam(this);
-        String billType = customParam.getString("billType");
-        if (StringUtils.isEmpty(billType)) {
-            billType = "fpzs";
-        }
-
-        if ("personTicket".equals(billType)) {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap12"});
-            this.getView().setVisible(Boolean.FALSE, new String[]{"flexpanelap6"});
-            this.getView().setVisible(Boolean.TRUE, new String[]{"edit_class"});
-        }
-
-        Boolean showOversea = FpzsMainService.showOperateFpzs(this, billType, "tab_oversea");
-        Boolean showInvoice = FpzsMainService.showOperateFpzs(this, billType, "tab_invoice");
-        Boolean showAttach = FpzsMainService.showOperateFpzs(this, billType, "tab_attach");
-        this.getView().setVisible(Boolean.FALSE, new String[]{"tab_invoice", "tab_oversea", "tab_attach", "flexpanelap11", "flexpanelap1"});
-        Boolean isInvoiceFlex = Boolean.FALSE;
-        Tab invoiceTab = (Tab)this.getView().getControl("tabap");
-        if (showInvoice) {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"tab_invoice"});
-            this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap1"});
-            isInvoiceFlex = Boolean.TRUE;
-            invoiceTab.activeTab("tab_invoice");
-        }
-
-        if (showOversea) {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"tab_oversea"});
-            this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap1"});
-            isInvoiceFlex = Boolean.TRUE;
-        }
-
-        if (!showInvoice && showAttach) {
-            this.getView().setVisible(Boolean.FALSE, new String[]{"flexpanelap1"});
-            this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap11"});
-            invoiceTab.activeTab("tab_attach");
-        }
-
-        if (isInvoiceFlex && showAttach) {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"tab_attach"});
-        }
-
-        if (!isInvoiceFlex && showAttach) {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"tab_attach"});
-            this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap11"});
-            invoiceTab.activeTab("tab_attach");
-        }
-
-        if (!showInvoice && !showAttach && showOversea) {
-            this.getView().setVisible(Boolean.FALSE, new String[]{"tab_invoice"});
-            this.getView().setVisible(Boolean.FALSE, new String[]{"tab_attach"});
-            invoiceTab.activeTab("tab_oversea");
-        }
-
-        if (!showInvoice && !showAttach && !showOversea) {
-            this.getView().showErrorNotification(ResManager.loadKDString("没有发票采集相关权限,请联系管理员", "FpzsMainPlugin_115", "imc-rim-formplugin", new Object[0]));
-            this.getView().setVisible(Boolean.FALSE, new String[]{"radio_flex"});
-        }
-
-    }
-
-    public void entryRowClick(RowClickEvent evt) {
-        Control source = (Control)evt.getSource();
-        String key = source.getKey();
-        if ("operate_entry".equals(key) || "operate_entry_attach".equals(key)) {
-            Integer selectRow = evt.getRow();
-            String operateType = (String)this.getModel().getValue("operate_type", selectRow);
-            if ("operate_entry_attach".equals(key)) {
-                operateType = (String)this.getModel().getValue("operate_type_attach", selectRow);
-            }
-
-            FpzsOperateService service = FpzsOperateService.newInstance(this, operateType);
-            if (service != null) {
-                this.getView().getPageCache().put("operate_type", operateType);
-                service.operate();
-            }
-        }
-
-    }
-
-    public void customEvent(CustomEventArgs e) {
-        String eventName = e.getEventName();
-        String eventArgs = e.getEventArgs();
-        if ("pushData".equals(eventName) || "onMessage".equals(eventName)) {
-            this.dealWebSoceketMsag(eventArgs);
-        }
-
-        if ("onError".equals(eventName)) {
-            this.getView().getPageCache().remove("linkkey");
-            this.getView().showTipNotification(eventArgs, 10000);
-        }
-
-        if ("scanner_fail".equals(eventName)) {
-            if (ScannerServiceEx.scannerFail(this, eventArgs)) {
-                this.scannerProcess("uploadFinish");
-            }
-        } else {
-            JSONObject json;
-            String name;
-            String cache;
-            String description;
-            String url;
-            JSONObject businessParam;
-            String traceId;
-            if ("scanner_success".equals(eventName)) {
-                if (!StringUtils.isEmpty(eventArgs)) {
-                    json = JSON.parseObject(eventArgs);
-                    JSONObject data = json.getJSONObject("data");
-                    name = data.getString("url");
-                    cache = data.getString("name");
-                    description = this.getView().getPageCache().get("operate_type");
-                    logger.info("扫描仪上传成功:" + description + "," + name + "," + cache);
-                    if (!"operate_attach_scanner".equals(description)) {
-                        url = this.getView().getPageId();
-                        businessParam = FpzsMainService.getBusinessParam(url, CollectTypeEnum.PC_SCANNER.getCode());
-                        businessParam.put("uploadIndex", ScannerServiceEx.getUploadIndex(data));
-                        ScannerServiceEx.recognitionInvoice("fpzs", this.getView().getPageId(), name, cache, businessParam, FpzsMainService.getCustomParam(this));
-                    } else {
-                        url = null;
-
-                        try {
-                            JSONArray upload = new JSONArray();
-                            businessParam = new JSONObject();
-                            businessParam.put("url", name);
-                            businessParam.put("name", cache);
-                            businessParam.put("resource", "scanner");
-                            upload.add(businessParam);
-                            traceId = this.getView().getPageId();
-                            Boolean lockFlag = Boolean.FALSE;
-                            DLock lock = DLock.create("updateAttachView" + traceId, ResManager.loadKDString("更新附件页面锁", "FpzsMainPlugin_116", "imc-rim-formplugin", new Object[0]));
-                            Throwable var15 = null;
-
-                            try {
-                                int times = 0;
-
-                                while(times < 30) {
-                                    ++times;
-                                    if (lock.tryLock(500L)) {
-                                        try {
-
-                                            this.updateAttachView(upload);
-                                            lockFlag = Boolean.TRUE;
-                                            break;
-                                        } finally {
-                                            lock.unlock();
-                                        }
-                                    }
-                                }
-                            } catch (Throwable var33) {
-                                var15 = var33;
-                                throw var33;
-                            } finally {
-                                if (lock != null) {
-                                    if (var15 != null) {
-                                        try {
-                                            lock.close();
-                                        } catch (Throwable var31) {
-                                            var15.addSuppressed(var31);
-                                        }
-                                    } else {
-                                        lock.close();
-                                    }
-                                }
-
-                            }
-
-                            if (!lockFlag) {
-                                this.getView().showErrorNotification(String.format(ResManager.loadKDString("附件上传失败:%1$s", "FpzsMainPlugin_117", "imc-rim-formplugin", new Object[0]), cache));
-                            }
-                        } catch (Exception var35) {
-                            logger.error("扫描仪上传附件失败", var35);
-                            this.getView().showErrorNotification(ResManager.loadKDString("附件上传失败", "FpzsMainPlugin_118", "imc-rim-formplugin", new Object[0]));
-                        }
-                    }
-                }
-            } else if ("scanner_uploadFinish".equals(e.getEventName())) {
-                if (!ScannerServiceEx.uploadFinish(eventArgs)) {
-                    String operateType = this.getView().getPageCache().get("operate_type");
-                    logger.info("扫描仪上传结束:" + operateType);
-                    if (!"operate_attach_scanner".equals(operateType)) {
-                        this.scannerProcess("uploadFinish");
-                    }
-                }
-            } else if ("datagrid_deleteRow".equals(e.getEventName())) {
-                this.deleteInvoiceRow(eventArgs);
-            } else if ("datagrid_clearTable".equals(eventName)) {
-                this.clearInvoiceTable(eventArgs);
-            } else {
-                String type;
-                if ("datagrid_click".equals(eventName)) {
-                    json = JSON.parseObject(eventArgs);
-                    type = json.getString("clickkey");
-                    name = json.getString("rowkey");
-                    if ("viewInvoice".equals(type)) {
-                        this.showInvoiceEdit(name);
-                    } else if ("addAttach".equals(type)) {
-                        this.getPageCache().put("add_attach", name);
-                        this.showAttachUpload();
-                    }
-                } else if ("dialog".equals(eventName)) {
-                    this.scannerProcess("dialog");
-                } else if ("uploadfile_upload".equals(eventName)) {
-                    json = JSON.parseObject(eventArgs);
-                    type = json.getString("status");
-                    name = json.getString("name");
-                    cache = json.getString("errcode");
-                    description = json.getString("description");
-                    if ("success".equals(type) && !"40002".equals(cache)) {
-                        url = json.getString("url");
-                        String pageId = this.getView().getPageId();
-                        logger.info("uploadfile_upload{},{}", pageId, RequestContext.get().getTraceId());
-                        businessParam = FpzsMainService.getBusinessParam(pageId, CollectTypeEnum.PC_UPLOAD.getCode());
-                        businessParam.put("uploadIndex", ScannerServiceEx.getUploadIndex(json));
-                        ScannerServiceEx.recognitionInvoice("fpzs", this.getView().getPageId(), url, name, businessParam, FpzsMainService.getCustomParam(this));
-                        traceId = RequestContext.get().getTraceId();
-                        if (this.traceMap == null || this.traceMap.get(traceId) == null) {
-                            this.scannerProcess("upload");
-                        }
-
-                        if (this.traceMap == null) {
-                            this.traceMap = new HashMap(16);
-                        } else if (this.traceMap.size() > 1) {
-                            this.traceMap.clear();
-                        }
-
-                        this.traceMap.put(traceId, "1");
-                    } else if ("40002".equals(cache)) {
-                        this.getView().showErrorNotification(String.format(ResManager.loadKDString("文件:%1$s上传失败,不支持的文件类型", "FpzsMainPlugin_119", "imc-rim-formplugin", new Object[0]), name));
-                    } else if (StringUtils.isEmpty(description)) {
-                        this.getView().showErrorNotification(String.format(ResManager.loadKDString("文件:%1$s上传失败", "FpzsMainPlugin_120", "imc-rim-formplugin", new Object[0]), name));
-                    } else {
-                        this.getView().showErrorNotification(String.format(ResManager.loadKDString("文件:%1$s上传失败:%2$s", "FpzsMainPlugin_121", "imc-rim-formplugin", new Object[0]), name, description));
-                    }
-                } else if ("interval".equals(eventName)) {
-                    json = JSON.parseObject(eventArgs);
-                    type = json.getString("eventName");
-                    name = json.getString("linkKey");
-                    if (!StringUtils.isEmpty(name) && "pooling".equals(type)) {
-                        cache = CacheHelper.get(name);
-                        if (!StringUtils.isEmpty(cache)) {
-                            this.dealWebSoceketMsag(cache);
-                            CacheHelper.remove(name);
-                        }
-                    }
-                } else if ("datagrid_editClass".equals(eventName)) {
-                    this.editClass(eventArgs);
-                }
-            }
-        }
-
-    }
-
-    public void dealWebSoceketMsag(String eventArgs) {
-        logger.info("onMessage:{}", eventArgs);
-        JSONObject result = null;
-
-        try {
-            result = JSON.parseObject(eventArgs);
-        } catch (Exception var19) {
-            return;
-        }
-
-        if (null != result) {
-            String resource = result.getString("resource");
-            JSONObject data = result.getJSONObject("data");
-            if (null != data) {
-                JSONArray invoiceData = data.getJSONArray("invoiceData");
-                JSONArray attachIds = data.getJSONArray("attachIds");
-                if (StringUtils.isEmpty(resource) || CollectionUtils.isEmpty(attachIds) && CollectionUtils.isEmpty(invoiceData)) {
-                    ArrayList invoiceIds;
-                    InvoiceSaveResult saveResult;
-                    JSONArray fids;
-                    if (!CollectionUtils.isEmpty(invoiceData)) {
-                        String pageId = this.getView().getPageId();
-                        JSONObject businessParam = FpzsMainService.getBusinessParam(pageId, CollectTypeEnum.WEIXIN.getCode());
-                        invoiceIds = new ArrayList(16);
-                        StringBuilder sb = new StringBuilder();
-
-                        for(int i = 0; i < invoiceData.size(); ++i) {
-                            JSONObject invoiceJson = invoiceData.getJSONObject(i);
-                            InvoiceSaveService service = InvoiceSaveService.newInstance(invoiceJson.getString("invoiceType"));
-                            if (service != null) {
-                                Long invoiceType = InputInvoiceTypeEnum.getInvoiceTypeByAwsType(service.getInvoiceType() + "");
-                                invoiceJson.putAll(businessParam);
-                                if (InputInvoiceTypeEnum.AIR_INVOICE.getCode().equals(invoiceType)) {
-                                    invoiceJson.put("seatGradeName", AirConvertService.convertSeatName(invoiceJson.getString("seatGrade")));
-                                }
-
-                                boolean dealAttachRelation = true;
-                                String originalState;
-                                if (InvoiceConvertUtils.isSaleListInvoiceType(invoiceType)) {
-                                    String checkStatus = invoiceJson.getString("checkStatus");
-                                    if ("1".equals(checkStatus)) {
-                                        RecognitionCheckHelper.markSaleListByCheckResult(invoiceJson);
-                                    } else {
-                                        RecognitionCheckHelper.markSaleListInvoice(invoiceJson);
-                                    }
-
-                                    originalState = invoiceJson.getString("originalState");
-                                    if ("1".equals(originalState)) {
-                                        invoiceJson.put("salelistComplete", "0");
-                                        dealAttachRelation = false;
-                                    }
-                                }
-
-                                try {
-                                    saveResult = service.save(invoiceJson);
-                                    if (dealAttachRelation && "1".equals(invoiceJson.getString("isSaleListInvoice"))) {
-                                        RecognitionCheckHelper recognitionCheckHelper = new RecognitionCheckHelper();
-                                        recognitionCheckHelper.dealInvoiceAttachRelation(invoiceJson);
-                                    }
-
-                                    invoiceIds.add((Long)saveResult.getMainId());
-                                } catch (MsgException var18) {
-                                    originalState = String.format(ResManager.loadKDString("第%1$s个发票处理失败:%2$s", "FpzsMainPlugin_162", "imc-rim-formplugin", new Object[0]), i + 1, var18.getMessage());
-                                    sb.append(originalState).append(';');
-                                }
-                            }
-                        }
-
-                        if (sb.length() > 0) {
-                            this.getView().showTipNotification(sb.toString());
-                        }
-
-                        this.showSelectInvoice(invoiceIds, (List)null, (JSONArray)null);
-                    } else {
-                        fids = data.getJSONArray("fids");
-                        if (!CollectionUtils.isEmpty(fids)) {
-                            List<String> awsSerialList = new ArrayList(fids.size());
-                            invoiceIds = new ArrayList(fids.size());
-
-                            for(int i = 0; i < fids.size(); ++i) {
-                                String seri = fids.getString(i);
-                                awsSerialList.add(seri);
-                            }
-
-                            String pageId = this.getView().getPageId();
-                            JSONObject businessParam = FpzsMainService.getBusinessParam(pageId, CollectTypeEnum.WEIXIN.getCode());
-                            FpzsAwsService awsService = new FpzsAwsService();
-
-                            try {
-                                Map<String, InvoiceSaveResult> syncResult = awsService.syncInvoiceFromAws(businessParam.getLong("org_id"), awsSerialList, businessParam);
-                                if (syncResult != null) {
-                                    Iterator var14 = syncResult.entrySet().iterator();
-
-                                    while(var14.hasNext()) {
-                                        Map.Entry<String, InvoiceSaveResult> entry = (Map.Entry)var14.next();
-                                        saveResult = (InvoiceSaveResult)entry.getValue();
-                                        invoiceIds.add((Long)saveResult.getMainId());
-                                    }
-
-                                    this.showSelectInvoice(invoiceIds, (List)null, (JSONArray)null);
-                                }
-                            } catch (IOException var20) {
-                                this.getView().showErrorNotification(String.format(ResManager.loadKDString("同步发票失败%1$s", "FpzsMainPlugin_122", "imc-rim-formplugin", new Object[0]), var20.getMessage()));
-                            }
-                        }
-                    }
-
-                    fids = data.getJSONArray("attachmentData");
-                    JSONArray newAttachIds = this.saveAwsAttach(fids);
-                    this.updateAttachList(newAttachIds, (List)null);
-                } else {
-                    List<Long> invoiceIds = new ArrayList(16);
-                    if (!CollectionUtils.isEmpty(invoiceData)) {
-                        for(int i = 0; i < invoiceData.size(); ++i) {
-                            invoiceIds.add(invoiceData.getLong(i));
-                        }
-
-                        this.showSelectInvoice(invoiceIds, (List)null, (JSONArray)null);
-                    }
-
-                    this.updateAttachList(attachIds, invoiceIds);
-                }
-
-                this.getView().getPageCache().remove("qrCodePage");
-            }
-        }
-    }
-
-    public void tabSelected(TabSelectEvent tabSelectEvent) {
-        String tab = tabSelectEvent.getTabKey();
-        this.getPageCache().put("tabSelect", tab);
-        String entityId = this.getView().getEntityId();
-        if (tab.equalsIgnoreCase("tab_invoice") || tab.equalsIgnoreCase("tab_oversea")) {
-            JSONObject customParam = FpzsMainService.cacheCustomParam(this);
-            String billType = customParam.getString("billType");
-            Boolean showInvoice = FpzsMainService.showOperateFpzs(this, billType, tab);
-            if (!showInvoice) {
-                this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap11"});
-                this.getView().setVisible(Boolean.FALSE, new String[]{"flexpanelap1"});
-            }
-
-            if (!showInvoice && "tab_invoice".equals(tab)) {
-                this.getView().setVisible(Boolean.FALSE, new String[]{"tab_invoice"});
-            } else if (!showInvoice && "tab_oversea".equals(tab)) {
-                this.getView().setVisible(Boolean.FALSE, new String[]{"tab_oversea"});
-            }
-
-            JSONObject pcConfigMap = FpzsMainService.getOperateConfigMap(billType, "pc_config_tag");
-            String invoiceUploadType = (String)pcConfigMap.get("operate_upload");
-            String invoiceUploadPermItem = (String)FpzsConstant.createPermMap().get("operate_upload");
-            String overseaUploadType = (String)pcConfigMap.get("pc_oversea_file_upload");
-            String overseaUploadPermItem = (String)FpzsConstant.createPermMap().get("pc_oversea_file_upload");
-            Boolean allowInvoiceUpload = FpzsMainService.getPermissionResult(invoiceUploadType, invoiceUploadPermItem, entityId);
-            Boolean allowOverseaUpload = FpzsMainService.getPermissionResult(overseaUploadType, overseaUploadPermItem, entityId);
-            CustomControl uploadControl = (CustomControl)this.getControl("custom_upload");
-            String title;
-            if (allowOverseaUpload && tab.equalsIgnoreCase("tab_oversea")) {
-                title = "";
-                ScannerServiceEx.initUpload(uploadControl, true, title);
-            } else if (!allowOverseaUpload && tab.equalsIgnoreCase("tab_oversea")) {
-                ScannerServiceEx.removeUpload(uploadControl);
-            }
-
-            if (allowInvoiceUpload && tab.equalsIgnoreCase("tab_invoice")) {
-                title = "";
-                ScannerServiceEx.initUpload(uploadControl, true, title);
-            } else if (!allowInvoiceUpload && tab.equalsIgnoreCase("tab_invoice")) {
-                ScannerServiceEx.removeUpload(uploadControl);
-            }
-        }
-
-        this.showFlex();
-    }
-
-    public void propertyChanged(PropertyChangedArgs e) {
-        IDataEntityProperty proper = e.getProperty();
-        if ("radiogroup".equals(proper.getName())) {
-            this.showSelectInvoice((List)null, (List)null, (JSONArray)null);
-        }
-
-    }
-
-    public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
-        super.afterDoOperation(afterDoOperationEventArgs);
-        String operateKey = afterDoOperationEventArgs.getOperateKey();
-        String serialNo;
-        if ("upload_attach".equals(operateKey)) {
-            serialNo = this.getInvoiceCardSerialNo("invoice_card_entry");
-            if (StringUtils.isNotEmpty(serialNo)) {
-                this.getPageCache().put("add_attach", serialNo);
-            }
-
-            this.showAttachUpload();
-        }
-
-        if ("upload_attach_unimport".equals(operateKey)) {
-            serialNo = this.getInvoiceCardSerialNo("error_invoice_card_entry");
-            if (StringUtils.isNotEmpty(serialNo)) {
-                this.getPageCache().put("add_attach", serialNo);
-            }
-
-            this.showAttachUpload();
-        }
-
-        if ("invoice_view".equals(operateKey)) {
-            serialNo = this.getInvoiceCardSerialNo("invoice_card_entry");
-            if (StringUtils.isNotEmpty(serialNo)) {
-                this.showInvoiceEdit(serialNo);
-            }
-        }
-
-        if ("invoice_view_unimport".equals(operateKey)) {
-            serialNo = this.getInvoiceCardSerialNo("error_invoice_card_entry");
-            if (StringUtils.isNotEmpty(serialNo)) {
-                this.showInvoiceEdit(serialNo);
-            }
-        }
-
-        if ("delete_attach".equals(operateKey)) {
-            this.deleteCurrentEntry("attach_grid_entry");
-        }
-
-        if ("edit_attach".equals(operateKey)) {
-            this.showAttachEdit();
-        }
-
-    }
-
-    public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
-        String actionId = closedCallBackEvent.getActionId();
-        Object returnData = closedCallBackEvent.getReturnData();
-        Map callBackReturn;
-        List invoiceIds;
-        if (returnData != null && "rim_fpzs_company_invoice".equals(actionId)) {
-            callBackReturn = (Map)returnData;
-            invoiceIds = (List)callBackReturn.get("invoiceIds");
-            this.showSelectInvoice(invoiceIds, (List)null, (JSONArray)null);
-            String isPerson = (String)callBackReturn.get("isPerson");
-            if ("1".equals(isPerson)) {
-                this.addPersonalAttach(invoiceIds);
-            }
-        } else if (returnData != null && "rim_fpzs_attach_list".equals(actionId)) {
-            callBackReturn = (Map)returnData;
-            Object[] attachIds = (Object[])((Object[])callBackReturn.get("attachIds"));
-            if (ObjectUtils.isEmpty(attachIds)) {
-                return;
-            }
-
-            DynamicObject[] attachs = BusinessDataServiceHelper.load(attachIds, EntityMetadataCache.getDataEntityType("rim_attach"));
-            this.showAttachs(attachs, "");
-            int attachCount = this.getModel().getEntryRowCount("attach_grid_entry");
-            this.showAttachFlex(attachCount);
-        } else if (returnData != null && "rim_inv_collect_enter".equals(actionId)) {
-            callBackReturn = (Map)returnData;
-            if (null != callBackReturn.get("invoiceIds")) {
-                invoiceIds = (List)callBackReturn.get("invoiceIds");
-                this.showSelectInvoice(invoiceIds, (List)null, (JSONArray)null);
-            }
-        } else if (returnData != null && "rim_fpzs_attach_edit".equals(actionId)) {
-            callBackReturn = (Map)returnData;
-            this.updateAttachData(callBackReturn);
-        } else if (returnData != null && "rim_inv_collect_edit".equals(actionId)) {
-            callBackReturn = (Map)returnData;
-            logger.info("修改结果:" + SerializationUtils.toJsonString(returnData));
-            this.updateInvoiceData(callBackReturn);
-        } else if (returnData != null && "rim_san_gun".equals(actionId)) {
-            callBackReturn = (Map)returnData;
-            invoiceIds = (List)callBackReturn.get("invoiceIds");
-            this.showSelectInvoice(invoiceIds, (List)null, (JSONArray)null);
-        } else {
-            JSONArray mainIds;
-            if (returnData != null && "retryCallback".equals(actionId)) {
-                callBackReturn = (Map)returnData;
-                mainIds = JSONArray.parseArray(callBackReturn.get("successData").toString());
-                logger.info("发票助手采集重试处理完毕:" + mainIds);
-                if (mainIds.size() > 0) {
-                    invoiceIds = new ArrayList(8);
-                    List<Long> uncheckInvoiceIds = new ArrayList(8);
-                    JSONArray showInvoiceArray = new JSONArray();
-                    int invoiceIndex = 0;
-
-                    for(int invoiceSize = mainIds.size(); invoiceIndex < invoiceSize; ++invoiceIndex) {
-                        JSONObject invoice = mainIds.getJSONObject(invoiceIndex);
-                        String mainId = invoice.getString("mainId");
-                        String unCheckId = invoice.getString("unCheckId");
-                        if (StringUtils.isNotEmpty(unCheckId)) {
-                            uncheckInvoiceIds.add(Long.valueOf(unCheckId));
-                        } else if (StringUtils.isNotEmpty(mainId)) {
-                            invoiceIds.add(Long.valueOf(mainId));
-                        } else {
-                            showInvoiceArray.add(invoice);
-                        }
-                    }
-
-                    this.showSelectInvoice(invoiceIds, uncheckInvoiceIds, showInvoiceArray);
-                }
-            } else {
-                JSONArray uncheckIds;
-                if (returnData != null && "rim_attach_upload".equals(actionId)) {
-                    callBackReturn = (Map)returnData;
-                    if (!ObjectUtils.isEmpty(callBackReturn.get("uploadUrls"))) {
-                        String uploadUrlsStr = callBackReturn.get("uploadUrls").toString();
-                        uncheckIds = JSONArray.parseArray(uploadUrlsStr);
-                        Tab tabAp = (Tab)this.getControl("tabap");
-                        tabAp.activeTab("tab_attach");
-                        this.updateAttachView(uncheckIds);
-                    }
-                } else if (returnData != null && "bdm_attach_type".equals(actionId)) {
-                    ListSelectedRowCollection selectedRows = (ListSelectedRowCollection)returnData;
-                    this.modifyAttachType(selectedRows);
-                } else if (returnData != null && "editclass_callback".equals(actionId)) {
-                    callBackReturn = (Map)returnData;
-                    mainIds = (JSONArray)callBackReturn.get("mainIds");
-                    uncheckIds = (JSONArray)callBackReturn.get("uncheckIds");
-                    JSONArray showArray = new JSONArray();
-                    Iterator var8;
-                    Object uncheckId;
-                    JSONObject obj;
-                    if (!CollectionUtils.isEmpty(mainIds)) {
-                        var8 = mainIds.iterator();
-
-                        while(var8.hasNext()) {
-                            uncheckId = var8.next();
-                            obj = new JSONObject();
-                            obj.put("mainId", uncheckId);
-                            showArray.add(obj);
-                        }
-                    }
-
-                    if (!CollectionUtils.isEmpty(uncheckIds)) {
-                        var8 = uncheckIds.iterator();
-
-                        while(var8.hasNext()) {
-                            uncheckId = var8.next();
-                            obj = new JSONObject();
-                            obj.put("unCheckId", uncheckId);
-                            showArray.add(obj);
-                        }
-                    }
-
-                    this.showTipRefresh(showArray, false);
-                }
-            }
-        }
-
-        FpzsOperateService service = FpzsOperateService.newInstance(this, actionId);
-        if (service != null) {
-            service.closedCallBack(closedCallBackEvent);
-        }
-
-    }
-
-    public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) {
-        String callBackId = messageBoxClosedEvent.getCallBackId();
-        if ("downJsScanner".equals(callBackId)) {
-            if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
-                ScannerServiceEx.downJsScanner(this);
-            }
-        } else if ("del_attach".equals(callBackId)) {
-            if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
-                this.deleteEntryData("attach_grid_entry", false);
-            }
-        } else if ("clear_attach".equals(callBackId)) {
-            if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
-                this.deleteEntryData("attach_grid_entry", true);
-            }
-        } else if ("clear_import_invoice_List".equals(callBackId)) {
-            if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
-                this.operateCustomTable("import", "clearTable");
-            }
-        } else if ("clear_error_invoice_List".equals(callBackId)) {
-            if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
-                this.operateCustomTable("error", "clearTable");
-            }
-        } else if ("delete_import_invoice_List".equals(callBackId)) {
-            if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
-                this.operateCustomTable("import", "deleteRow");
-            }
-        } else if ("delete_error_invoice_List".equals(callBackId)) {
-            if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
-                this.operateCustomTable("error", "deleteRow");
-            }
-        } else if ("editclass_callback".equals(callBackId) && MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
-            FormShowParameter param = new FormShowParameter();
-            param.getOpenStyle().setShowType(ShowType.Modal);
-            param.setFormId("rim_chose_invoice_class");
-            CloseCallBack closeCallBack = new CloseCallBack(this, "editclass_callback");
-            param.setCloseCallBack(closeCallBack);
-            String cacheMainIds = this.getView().getPageCache().get("cache_mainIds");
-            String cacheUncheckIds = this.getView().getPageCache().get("cache_uncheckIds");
-            JSONArray mainIds = JSONArray.parseArray(cacheMainIds);
-            JSONArray uncheckIds = JSONArray.parseArray(cacheUncheckIds);
-            param.setCustomParam("mainIds", mainIds);
-            param.setCustomParam("uncheckIds", uncheckIds);
-            this.getView().showForm(param);
-        }
-
-    }
-
-    private void clearInvoiceTable(String eventArgs) {
-        JSONObject json = JSON.parseObject(eventArgs);
-        String tableId = json.getString("tableId");
-        String tableType = tableId.indexOf("error") >= 0 ? "error" : "import";
-        JSONObject dataJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-        JSONArray invoiceVerifyData2 = new JSONArray();
-        if (dataJson != null) {
-            Iterator<Map.Entry<String, Object>> iterator = dataJson.entrySet().iterator();
-
-            while(iterator.hasNext()) {
-                Map.Entry<String, Object> entry = (Map.Entry)iterator.next();
-                String key = (String)entry.getKey();
-                JSONObject obj = dataJson.getJSONObject(key);
-                Boolean filterFlag = FpzsMainService.isFilter(obj);
-                String serialNo = obj.getString("serialNo");
-                if ("error".equals(tableType) && filterFlag) {
-                    invoiceVerifyData2.add(obj);
-                    iterator.remove();
-                }
-
-                if ("import".equals(tableType) && !filterFlag) {
-                    invoiceVerifyData2.add(obj);
-                    iterator.remove();
-                }
-            }
-
-            this.saveInvoiceDataCache(dataJson.toJSONString());
-            this.saveVerifyResult(invoiceVerifyData2);
-            this.showFlex();
-        }
-
-    }
-
-    private JSONArray getSelectedCardInvoice(String tableId) {
-        JSONArray array = new JSONArray();
-        CardEntry errorCardEntry;
-        int[] errorSelectedRows;
-        int i;
-        String serialNo;
-        if (StringUtils.isNotEmpty(tableId) && tableId.endsWith("import")) {
-            errorCardEntry = (CardEntry)this.getControl("invoice_card_entry");
-            errorSelectedRows = errorCardEntry.getSelectRows();
-            if (errorSelectedRows == null || errorSelectedRows.length == 0) {
-                this.getView().showTipNotification(ResManager.loadKDString("请先选择需要删除的发票", "FpzsMainPlugin_123", "imc-rim-formplugin", new Object[0]), 2000);
-                return array;
-            }
-
-            for(i = 0; i < errorSelectedRows.length; ++i) {
-                serialNo = this.getModel().getValue("import_serial_no", errorSelectedRows[i]).toString();
-                array.add(serialNo);
-            }
-        } else if (StringUtils.isNotEmpty(tableId) && tableId.endsWith("error")) {
-            errorCardEntry = (CardEntry)this.getControl("error_invoice_card_entry");
-            errorSelectedRows = errorCardEntry.getSelectRows();
-            if (errorSelectedRows == null || errorSelectedRows.length == 0) {
-                this.getView().showTipNotification(ResManager.loadKDString("请先选择需要删除的发票", "FpzsMainPlugin_123", "imc-rim-formplugin", new Object[0]), 2000);
-                return array;
-            }
-
-            for(i = 0; i < errorSelectedRows.length; ++i) {
-                serialNo = this.getModel().getValue("error_serial_no", errorSelectedRows[i]).toString();
-                array.add(serialNo);
-            }
-        }
-
-        return array;
-    }
-
-    private void deleteCardInvoiceRow(String tableId, JSONArray array) {
-        if (array == null || array.size() == 0) {
-            array = this.getSelectedCardInvoice(tableId);
-        }
-
-        DynamicObjectCollection invoiceCardDatas = this.getModel().getEntryEntity("invoice_card_entry");
-        DynamicObjectCollection errorInvoiceCardDatas = this.getModel().getEntryEntity("error_invoice_card_entry");
-        ArrayList errorIndexList;
-        int i;
-        Iterator var7;
-        DynamicObject errorInvoiceCardData;
-        int[] errorIndex;
-        int m;
-        if (!CollectionUtils.isEmpty(invoiceCardDatas) && StringUtils.isNotEmpty(tableId) && tableId.endsWith("import")) {
-            errorIndexList = new ArrayList(invoiceCardDatas.size());
-            i = 0;
-            var7 = invoiceCardDatas.iterator();
-
-            while(var7.hasNext()) {
-                errorInvoiceCardData = (DynamicObject)var7.next();
-                if (errorInvoiceCardData != null) {
-                    String importSerialNo = errorInvoiceCardData.getString("import_serial_no");
-                    if (array.size() > 0 && array.contains(importSerialNo)) {
-                        errorIndexList.add(i);
-                    }
-
-                    ++i;
-                }
-            }
-
-            if (!CollectionUtils.isEmpty(errorIndexList)) {
-                errorIndex = new int[errorIndexList.size()];
-
-                for(m = 0; m < errorIndex.length; ++m) {
-                    errorIndex[m] = (Integer)errorIndexList.get(m);
-                }
-
-                this.getView().getModel().deleteEntryRows("invoice_card_entry", errorIndex);
-            }
-        }
-
-        if (!CollectionUtils.isEmpty(errorInvoiceCardDatas) && StringUtils.isNotEmpty(tableId) && tableId.endsWith("error")) {
-            errorIndexList = new ArrayList(errorInvoiceCardDatas.size());
-            i = 0;
-            var7 = errorInvoiceCardDatas.iterator();
-
-            while(var7.hasNext()) {
-                errorInvoiceCardData = (DynamicObject)var7.next();
-                if (errorInvoiceCardData != null) {
-                    if (array.contains(errorInvoiceCardData.getString("error_serial_no"))) {
-                        errorIndexList.add(i);
-                    }
-
-                    ++i;
-                }
-            }
-
-            if (!CollectionUtils.isEmpty(errorIndexList)) {
-                errorIndex = new int[errorIndexList.size()];
-
-                for(m = 0; m < errorIndex.length; ++m) {
-                    errorIndex[m] = (Integer)errorIndexList.get(m);
-                }
-
-                this.getView().getModel().deleteEntryRows("error_invoice_card_entry", errorIndex);
-            }
-        }
-
-    }
-
-    private void deleteInvoiceRow(String eventArgs) {
-        JSONObject json = JSON.parseObject(eventArgs);
-        String tableId = json.getString("tableId");
-        new JSONArray();
-        JSONArray array = json.getJSONArray("rows");
-        if (CollectionUtils.isEmpty(array)) {
-            this.getView().showTipNotification(ResManager.loadKDString("请先选择需要删除的发票", "FpzsMainPlugin_123", "imc-rim-formplugin", new Object[0]), 2000);
-        } else {
-            this.updateInvoiceCache(array);
-            this.deleteCardInvoiceRow(tableId, array);
-            this.showFlex();
-        }
-    }
-
-    private void updateInvoiceCache(JSONArray array) {
-        JSONObject dataJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-        JSONArray invoiceVerifyData = new JSONArray();
-        if (dataJson != null) {
-            for(int i = 0; i < array.size(); ++i) {
-                invoiceVerifyData.add(dataJson.getJSONObject(array.getString(i)));
-                dataJson.remove(array.getString(i));
-            }
-
-            if (!dataJson.isEmpty()) {
-                String pageId = this.getView().getPageId();
-                Map<String, Object> customParam = FpzsMainService.getCustomParam(this);
-                VerifyService.verifySequenceNo(customParam, dataJson);
-                FpzsMainService.updateInvoiceGrid(this, dataJson);
-            }
-
-            this.saveInvoiceDataCache(dataJson.toJSONString());
-            this.saveVerifyResult(invoiceVerifyData);
-        }
-
-    }
-
-    private String getInvoiceCardSerialNo(String invoiceEntry) {
-        String serialNo = null;
-        String invoiceModel = this.getView().getPageCache().get("invoice_list_model");
-        if (!StringUtils.isEmpty(invoiceModel) && "card".equals(invoiceModel)) {
-            int rowIndex = this.getModel().getEntryCurrentRowIndex(invoiceEntry);
-            if ("invoice_card_entry".equals(invoiceEntry)) {
-                serialNo = this.getModel().getValue("import_serial_no", rowIndex).toString();
-            } else if ("error_invoice_card_entry".equals(invoiceEntry)) {
-                serialNo = this.getModel().getValue("error_serial_no", rowIndex).toString();
-            }
-
-            return serialNo;
-        } else {
-            return serialNo;
-        }
-    }
-
-    private int[] getSelectedRows(String entryId) {
-        if (StringUtils.isEmpty(entryId)) {
-            return null;
-        } else {
-            int[] selectedAttachRows = null;
-            if ("attach_grid_entry".equals(entryId)) {
-                String attachModel = this.getView().getPageCache().get("attach_list_model");
-                if (StringUtils.isEmpty(attachModel)) {
-                    EntryGrid entryGrid = (EntryGrid)this.getControl("attach_grid_entry");
-                    selectedAttachRows = entryGrid.getSelectRows();
-                } else {
-                    CardEntry entryCard = (CardEntry)this.getControl("attach_card_entry");
-                    selectedAttachRows = entryCard.getSelectRows();
-                }
-            }
-
-            return selectedAttachRows;
-        }
-    }
-
-    private void modifyAttachType(ListSelectedRowCollection selectedBaseDataRows) {
-        int[] selectedAttachRows = this.getSelectedRows("attach_grid_entry");
-        if (selectedAttachRows != null && selectedAttachRows.length != 0) {
-            List<Long> selectedAttachIds = new ArrayList(selectedAttachRows.length);
-
-            for(int i = 0; i < selectedAttachRows.length; ++i) {
-                Long attachId = Long.parseLong(this.getModel().getValue("attachid", selectedAttachRows[i]).toString());
-                selectedAttachIds.add(attachId);
-            }
-
-            QFilter attachFilter = new QFilter("id", "in", selectedAttachIds);
-            DynamicObject[] attachObjs = BusinessDataServiceHelper.load("rim_attach", "id, update_time, attach_category", attachFilter.toArray());
-            if (attachObjs != null && attachObjs.length != 0) {
-                JSONArray newAttachArray = new JSONArray();
-                Object attachCategoryPk = selectedBaseDataRows.getPrimaryKeyValues()[0];
-                List<DynamicObject> listCategoryAttach = new ArrayList(8);
-                DynamicObject[] var9 = attachObjs;
-                int var10 = attachObjs.length;
-
-                String attachCategoryNumber;
-                for(int var11 = 0; var11 < var10; ++var11) {
-                    DynamicObject attachObj = var9[var11];
-                    JSONObject newAttachInfo = new JSONObject();
-                    attachCategoryNumber = attachObj.getString("attach_category.number");
-                    if ("F014".equals(attachCategoryNumber)) {
-                        listCategoryAttach.add(attachObj);
-                    } else {
-                        attachObj.set("attach_category", attachCategoryPk);
-                        attachObj.set("update_time", new Date());
-                        newAttachInfo.put("id", attachObj.get("id"));
-                        newAttachInfo.put("attach_category", attachCategoryPk);
-                        newAttachArray.add(newAttachInfo);
-                    }
-                }
-
-                if (listCategoryAttach.size() > 0) {
-                    this.getView().showTipNotification(ResManager.loadKDString("销货清单附件类型不允许修改", "FpzsMainPlugin_126", "imc-rim-formplugin", new Object[0]));
-                }
-
-                ImcSaveServiceHelper.update(attachObjs);
-                this.updateAttachCache(newAttachArray);
-                DynamicObject attachTypeObj = BusinessDataServiceHelper.loadSingle(attachCategoryPk, "bdm_attach_type");
-                String simplifyName = attachTypeObj.getString("simplify_name");
-                String attachId = attachTypeObj.getString("id");
-
-                for(int i = 0; i < selectedAttachRows.length; ++i) {
-                    DynamicObject categoryObj = (DynamicObject)this.getModel().getValue("attach_category_grid", selectedAttachRows[i]);
-                    attachCategoryNumber = categoryObj.getString("number");
-                    if (!"F014".equals(attachCategoryNumber)) {
-                        this.getModel().setValue("attach_category", simplifyName, selectedAttachRows[i]);
-                        this.getModel().setValue("attach_category_grid", attachId, selectedAttachRows[i]);
-                    }
-                }
-
-            } else {
-                this.getView().showErrorNotification(ResManager.loadKDString("找不到附件信息", "FpzsMainPlugin_125", "imc-rim-formplugin", new Object[0]));
-            }
-        } else {
-            this.getView().showErrorNotification(ResManager.loadKDString("未选中任何数据", "FpzsMainPlugin_124", "imc-rim-formplugin", new Object[0]));
-        }
-    }
-
-    private void showAttachTypeBase() {
-        String attachModel = this.getView().getPageCache().get("attach_list_model");
-        int[] selectedRows = null;
-        EntryGrid entryGrid;
-        if (StringUtils.isEmpty(attachModel)) {
-            entryGrid = (EntryGrid)this.getControl("attach_grid_entry");
-            selectedRows = entryGrid.getSelectRows();
-        } else {
-            entryGrid = (EntryGrid)this.getControl("attach_card_entry");
-            selectedRows = entryGrid.getSelectRows();
-        }
-
-        if (selectedRows != null && selectedRows.length != 0) {
-            int listAttachCount = 0;
-
-            for(int i = 0; i < selectedRows.length; ++i) {
-                int index = selectedRows[i];
-                DynamicObject category = (DynamicObject)this.getModel().getValue("attach_category_grid", index);
-                String number = category.getString("number");
-                if ("F014".equals(number)) {
-                    ++listAttachCount;
-                }
-            }
-
-            if (listAttachCount == selectedRows.length) {
-                this.getView().showTipNotification(ResManager.loadKDString("销货清单类型不允许修改", "FpzsMainPlugin_128", "imc-rim-formplugin", new Object[0]));
-            } else {
-                ListShowParameter listShowParameter = ShowFormHelper.createShowListForm("bdm_attach_type", false);
-                listShowParameter.setShowUsed(true);
-                listShowParameter.setShowApproved(true);
-                listShowParameter.setHasRight(true);
-                ListFilterParameter listFilterParameter = new ListFilterParameter();
-                QFilter enableFilter = (new QFilter("enable", "=", "1")).and("number", "!=", "F014");
-                listFilterParameter.setFilter(enableFilter);
-                listShowParameter.setListFilterParameter(listFilterParameter);
-                CloseCallBack closeCallBack = new CloseCallBack(this, "bdm_attach_type");
-                listShowParameter.setCloseCallBack(closeCallBack);
-                this.getView().showForm(listShowParameter);
-            }
-        } else {
-            this.getView().showErrorNotification(ResManager.loadKDString("请选择需要修改分类的附件", "FpzsMainPlugin_127", "imc-rim-formplugin", new Object[0]));
-        }
-    }
-
-    private JSONArray saveAwsAttach(JSONArray attachmentDatas) {
-        JSONArray newAttachIds = new JSONArray();
-        if (!CollectionUtils.isEmpty(attachmentDatas)) {
-            for(int i = 0; i < attachmentDatas.size(); ++i) {
-                JSONObject attachmentData = (JSONObject)attachmentDatas.get(i);
-                if (!ObjectUtils.isEmpty(attachmentData)) {
-                    QFilter attachNoFilter = new QFilter("attach_no", "=", attachmentData.getString("serialNo"));
-                    DynamicObject attachObj = QueryServiceHelper.queryOne("rim_attach", "id", attachNoFilter.toArray());
-                    if (!ObjectUtils.isEmpty(attachObj)) {
-                        newAttachIds.add(attachObj.getLong("id"));
-                    } else {
-                        attachObj = BusinessDataServiceHelper.newDynamicObject("rim_attach");
-                        attachObj.set("attach_no", attachmentData.getString("serialNo"));
-                        attachObj.set("attach_type", attachmentData.getString("attachmentType"));
-                        attachObj.set("create_time", attachmentData.getDate("gatherTime"));
-                        attachObj.set("attach_name", attachmentData.getString("attachmentName"));
-                        String originalFileName = null;
-                        String awsLocalUrl = attachmentData.getString("localUrl");
-                        String awsSnapshotUrl = attachmentData.getString("snapshotUrl");
-                        String url = null;
-                        String fileExtension = "";
-                        String localUrl = FileUtils.downLoadAndUpload(awsLocalUrl);
-                        String snapshotUrl = FileUtils.downLoadAndUpload(awsSnapshotUrl);
-                        if (StringUtils.isNotBlank(attachmentData.getString("originalFileName"))) {
-                            originalFileName = attachmentData.getString("originalFileName");
-                        } else {
-                            originalFileName = attachmentData.getString("attachmentName");
-                        }
-
-                        if (!StringUtils.isEmpty(awsLocalUrl)) {
-                            fileExtension = awsLocalUrl.substring(awsLocalUrl.lastIndexOf(46) + 1);
-                            originalFileName = originalFileName.concat(".").concat(fileExtension);
-                            url = awsLocalUrl;
-                        } else if (!StringUtils.isEmpty(awsSnapshotUrl)) {
-                            fileExtension = awsSnapshotUrl.substring(awsSnapshotUrl.lastIndexOf(46) + 1);
-                            originalFileName = originalFileName.concat(fileExtension);
-                            url = snapshotUrl;
-                        }
-
-                        String fileHash = null;
-                        if (StringUtils.isNotBlank(url)) {
-                            InputStream inputStream = null;
-
-                            try {
-                                inputStream = FileUtils.getInputStreamByGet(url);
-                                fileHash = FileUtils.getSHA256(inputStream);
-                            } catch (Exception var26) {
-                                logger.error("读取附件失败", var26);
-                            } finally {
-                                if (inputStream != null) {
-                                    try {
-                                        inputStream.close();
-                                    } catch (IOException var25) {
-                                        logger.error("获取aws文件的hash值失败", var25);
-                                    }
-                                }
-
-                            }
-                        }
-
-                        attachObj.set("attach_hash_value", fileHash);
-                        attachObj.set("original_name", originalFileName);
-                        attachObj.set("update_time", new Date());
-                        attachObj.set("snapshot_url", snapshotUrl);
-                        attachObj.set("attach_url", localUrl);
-                        attachObj.set("user", RequestContext.get().getUserId());
-                        attachObj.set("rim_user", FpzsMainService.getCustomParam(this).get("rim_user"));
-                        DynamicObject saveObj = (DynamicObject)SaveServiceHelper.save(new DynamicObject[]{attachObj})[0];
-                        if (!ObjectUtils.isEmpty(saveObj)) {
-                            newAttachIds.add(saveObj.getLong("id"));
-                        }
-                    }
-                }
-            }
-        }
-
-        return newAttachIds;
-    }
-
-    private void updateAttachList(JSONArray attachIds, List<Long> invoiceIds) {
-        String pageId = this.getView().getPageId();
-        Set<String> attachSet = new HashSet(16);
-        Set<Long> attachLongSet = new HashSet(16);
-        if (!CollectionUtils.isEmpty(attachIds)) {
-            for(int i = 0; i < attachIds.size(); ++i) {
-                attachSet.add(attachIds.getString(i));
-                attachLongSet.add(attachIds.getLong(i));
-            }
-        }
-
-        JSONObject cache = FpzsMainService.getInvoiceDataCache(pageId);
-        QFilter serialFilter = new QFilter("relation_id", "in", cache.keySet());
-        QFilter typeFilter = new QFilter("relation_type", "=", "2");
-        DynamicObjectCollection attachCollection = QueryServiceHelper.query("rim_attach_relation", "attach_id,relation_id", new QFilter[]{serialFilter, typeFilter});
-        Map<String, String> attachRelaion = new HashMap(16);
-        Iterator var11 = attachCollection.iterator();
-
-        while(var11.hasNext()) {
-            DynamicObject obj = (DynamicObject)var11.next();
-            String attaId = obj.getString("attach_id");
-            attachSet.add(attaId);
-            attachRelaion.put(attaId, obj.getString("relation_id"));
-        }
-
-        DynamicObject obj;
-        if (!CollectionUtils.isEmpty(invoiceIds)) {
-            QFilter relationFilter = new QFilter("attach_id", "in", attachSet);
-            QFilter type3Filter = new QFilter("relation_type", "=", "3");
-            DynamicObjectCollection attach3Collection = QueryServiceHelper.query("rim_attach_relation", "attach_id,relation_id", new QFilter[]{relationFilter, type3Filter});
-            if (!CollectionUtils.isEmpty(attach3Collection)) {
-                QFilter idFilter = new QFilter("id", "in", invoiceIds);
-                DynamicObjectCollection collection = QueryServiceHelper.query("rim_invoice", "id,serial_no", new QFilter[]{idFilter});
-                if (!CollectionUtils.isEmpty(collection)) {
-                    Map<String, Long> serialMap = new HashMap(collection.size());
-                    Iterator var17 = collection.iterator();
-
-                    while(var17.hasNext()) {
-                        obj = (DynamicObject)var17.next();
-                        serialMap.put(obj.getString("serial_no"), obj.getLong("id"));
-                    }
-
-                    var17 = attach3Collection.iterator();
-
-                    while(var17.hasNext()) {
-                        obj = (DynamicObject)var17.next();
-                        String serialNo = obj.getString("relation_id");
-                        Long invoiceId = (Long)serialMap.get(serialNo);
-                        if (invoiceId != null && invoiceIds.contains(invoiceId)) {
-                            String attaId = obj.getString("attach_id");
-                            attachRelaion.put(attaId, serialNo);
-                        }
-                    }
-                }
-            }
-        }
-
-        if (!CollectionUtils.isEmpty(attachSet)) {
-            int count = this.getModel().getEntryRowCount("attach_grid_entry");
-            Set<String> existsAttach = new HashSet(16);
-
-            for(int i = 0; i < count; ++i) {
-                String attachId = String.valueOf(this.getModel().getValue("attachid", i));
-                existsAttach.add(attachId);
-                attachSet.remove(attachId);
-                String serialNo = (String)attachRelaion.get(attachId);
-                if (!StringUtils.isEmpty(serialNo)) {
-                    this.getModel().setValue("serial_no3", serialNo, i);
-                }
-            }
-
-            MainEntityType mainEntityType = EntityMetadataCache.getDataEntityType("rim_attach");
-            DynamicObject[] dynamicObject = BusinessDataServiceHelper.load(attachLongSet.toArray(), mainEntityType);
-            DynamicObject[] var33 = dynamicObject;
-            int var34 = dynamicObject.length;
-
-            for(int var35 = 0; var35 < var34; ++var35) {
-                obj = var33[var35];
-                Long attachId = obj.getLong("id");
-                if (existsAttach.add(String.valueOf(attachId))) {
-                    if (obj.get("attach_category") != null && obj.get("attach_category.id") != null) {
-                        obj.set("attach_category", obj.get("attach_category.id"));
-                    } else {
-                        obj.set("attach_category", AttachConstant.ATTACH_OTHER_CATEGORY_ID);
-                    }
-
-                    this.updateAttachModel(obj, (String)attachRelaion.get(String.valueOf(attachId)));
-                }
-            }
-
-            this.showFlex();
-        }
-
-    }
-
-    private void updateAttachView(JSONArray uploadUrls) {
-        if (!CollectionUtils.isEmpty(uploadUrls)) {
-            logger.info("附件上传请求参数:{}", uploadUrls);
-            IPageCache pageCache = new PageCache(this.getView().getPageId());
-            String serialNo = pageCache.get("add_attach");
-            if (!StringUtils.isEmpty(serialNo)) {
-                this.getPageCache().remove("add_attach");
-            }
-
-            Map<String, Object> customParam = FpzsMainService.getCustomParam(this);
-            TempFileCache tempFileCache = CacheFactory.getCommonCacheFactory().getTempFileCache();
-            Long userId = Long.valueOf(RequestContext.get().getUserId());
-
-            int attachCount;
-            for(attachCount = 0; attachCount < uploadUrls.size(); ++attachCount) {
-                Map<String, Object> urlObj = (Map)uploadUrls.get(attachCount);
-                if (!CollectionUtils.isEmpty(urlObj)) {
-                    Object resource = urlObj.get("resource");
-                    DynamicObject attachObject = null;
-                    String strUrl = urlObj.get("url").toString();
-                    String originalName = urlObj.get("name").toString();
-                    String fileName = StringUtils.substring(originalName.substring(0, originalName.lastIndexOf(46)), 0, 80);
-                    if (StringUtils.isEmpty(fileName)) {
-                        this.getView().showErrorNotification(ResManager.loadKDString("请注意,文件名称不能为空", "FpzsMainPlugin_129", "imc-rim-formplugin", new Object[0]));
-                    } else {
-                        String fileExtension = originalName.substring(originalName.lastIndexOf(46) + 1);
-                        if (StringUtils.isEmpty(fileExtension)) {
-                            this.getView().showErrorNotification(ResManager.loadKDString("无法识别文件格式,请确认文件是否正常", "FpzsMainPlugin_130", "imc-rim-formplugin", new Object[0]));
-                        } else {
-                            String fileFormat = FileUtils.getFileType(originalName);
-                            String attachHash = null;
-                            boolean isTempFile = false;
-                            if (!ObjectUtils.isEmpty(resource) && "scanner".equals(resource.toString())) {
-                                attachObject = this.newAttachDynamicObj();
-                                attachHash = FileUploadUtils.getSHA256FromAttach(strUrl);
-                                logger.info("【发票助手上传附件】-url地址:{}hash值:{},文件名:{}", new Object[]{strUrl, attachHash, originalName});
-                            } else {
-                                try {
-                                    isTempFile = strUrl.startsWith("http");
-                                } catch (Exception var31) {
-                                    logger.error("临时文件判断异常:", var31);
-                                    isTempFile = false;
-                                }
-
-                                if (isTempFile) {
-                                    attachHash = FileUploadUtils.getSHA256FromCache(strUrl);
-                                } else {
-                                    attachHash = FileUploadUtils.getSHA256FromAttach(strUrl);
-                                }
-
-                                attachObject = this.newAttachDynamicObj();
-                                logger.info("上传附件临时文件,isTempFlie:{},url:{}", isTempFile, strUrl);
-                                if (isTempFile) {
-                                    InputStream inputStream = null;
-
-                                    try {
-                                        inputStream = tempFileCache.getInputStream(strUrl);
-                                        strUrl = FileUploadUtils.upload(FileUploadUtils.getInvoiceDir("attach") + attachHash + '.' + fileFormat, originalName, inputStream);
-                                        if (StringUtils.isEmpty(strUrl)) {
-                                            this.getView().showTipNotification(String.format(ResManager.loadKDString("%1$s文件上传失败,请重试", "FpzsMainPlugin_131", "imc-rim-formplugin", new Object[0]), originalName), 2000);
-                                            continue;
-                                        }
-                                    } catch (Exception var32) {
-                                        logger.error("临时文件上传异常:", var32);
-                                        this.getView().showTipNotification(String.format(ResManager.loadKDString("%1$s文件上传超时,请重试", "FpzsMainPlugin_132", "imc-rim-formplugin", new Object[0]), originalName), 2000);
-                                        continue;
-                                    } finally {
-                                        if (inputStream != null) {
-                                            try {
-                                                inputStream.close();
-                                            } catch (IOException var30) {
-                                                logger.error("附件文件流关闭失败:", var30);
-                                            }
-                                        }
-
-                                    }
-                                }
-                            }
-
-                            attachObject.set("update_time", new Date());
-                            attachObject.set("attach_hash_value", attachHash);
-                            attachObject.set("attach_url", strUrl);
-                            if (ObjectUtils.isEmpty(attachObject.get("attach_category")) && ObjectUtils.isEmpty(attachObject.get("attach_category.id"))) {
-                                attachObject.set("attach_category", AttachConstant.ATTACH_OTHER_CATEGORY_ID);
-                            } else if (!ObjectUtils.isEmpty(attachObject.get("attach_category.id"))) {
-                                attachObject.set("attach_category", attachObject.getLong("attach_category.id"));
-                            }
-
-                            String iconImage = "";
-                            if (!"pdf".equalsIgnoreCase(fileFormat) && !"ofd".equalsIgnoreCase(fileFormat)) {
-                                if (!"doc".equalsIgnoreCase(fileFormat) && !"docx".equalsIgnoreCase(fileFormat)) {
-                                    if (!"xls".equalsIgnoreCase(fileFormat) && !"xlsx".equalsIgnoreCase(fileFormat)) {
-                                        if ("pptx".equalsIgnoreCase(fileFormat)) {
-                                            attachObject.set("attach_type", "7");
-                                        } else if ("txt".equalsIgnoreCase(fileFormat)) {
-                                            attachObject.set("attach_type", "8");
-                                        } else {
-                                            attachObject.set("attach_type", "2");
-                                        }
-                                    } else {
-                                        attachObject.set("attach_type", "6");
-                                    }
-                                } else {
-                                    attachObject.set("attach_type", "5");
-                                }
-                            } else {
-                                iconImage = FpzsAttachService.getAttachIconUrl(strUrl);
-                                attachObject.set("icon_url", iconImage);
-                                attachObject.set("snapshot_url", iconImage);
-                                if ("pdf".equalsIgnoreCase(fileFormat)) {
-                                    attachObject.set("attach_type", "1");
-                                } else {
-                                    attachObject.set("attach_type", "4");
-                                }
-                            }
-
-                            attachObject.set("file_extension", fileExtension);
-                            attachObject.set("attach_name", fileName);
-                            attachObject.set("remark", urlObj.get("description"));
-                            attachObject.set("original_name", fileName + '.' + fileExtension);
-                            DynamicObject attachSaveObject = (DynamicObject)SaveServiceHelper.save(new DynamicObject[]{attachObject})[0];
-                            JSONObject attachInfo = new JSONObject(DynamicObjectUtil.dynamicObject2Map(attachSaveObject));
-                            JSONArray attachArray = new JSONArray();
-                            attachArray.add(attachInfo);
-                            if (!StringUtils.isEmpty(serialNo)) {
-                                this.saveAttachRelation(serialNo, attachObject.getPkValue().toString());
-                            }
-
-                            String pageId = this.getView().getPageId();
-                            FpzsMainService.cacheAttachList(pageId, SerializationUtils.toJsonString(attachArray));
-                            this.updateAttachModel(attachObject, serialNo);
-                        }
-                    }
-                }
-            }
-
-            attachCount = this.getModel().getEntryRowCount("attach_grid_entry");
-            this.showAttachFlex(attachCount);
-            this.calculationSum();
-        }
-    }
-
-    private void addPersonalAttach(List<Long> invoiceIds) {
-        QFilter qFilter = new QFilter("id", "in", invoiceIds);
-        DynamicObjectCollection objects = QueryServiceHelper.query("rim_invoice", "serial_no", qFilter.toArray());
-        if (!CollectionUtils.isEmpty(objects)) {
-            Iterator var4 = objects.iterator();
-
-            while(var4.hasNext()) {
-                DynamicObject object = (DynamicObject)var4.next();
-                this.addPersonalAttach(object.getString("serial_no"));
-            }
-        }
-
-    }
-
-    private void addPersonalAttach(String serialNo) {
-        AttachQueryService attachQueryService = new AttachQueryService();
-        DynamicObject[] attachs = attachQueryService.getAttachsByInvoiceSerialNo(serialNo);
-        this.showAttachs(attachs, serialNo);
-    }
-
-    private void showAttachs(DynamicObject[] attachs, String serialNo) {
-        if (!ObjectUtils.isEmpty(attachs)) {
-            Set<String> existsSet = new HashSet(8);
-            int count = this.getModel().getEntryRowCount("attach_grid_entry");
-            if (count > 0) {
-                for(int i = 0; i < count; ++i) {
-                    existsSet.add(String.valueOf(this.getModel().getValue("attachid", i)));
-                }
-            }
-
-            JSONArray attachArray = new JSONArray();
-            DynamicObject[] var6 = attachs;
-            int var7 = attachs.length;
-
-            for(int var8 = 0; var8 < var7; ++var8) {
-                DynamicObject attach = var6[var8];
-                String attachId = String.valueOf(attach.getLong("id"));
-                if (existsSet.add(attachId)) {
-                    attachArray.add(DynamicObjectUtil.dynamicObject2Map(attach));
-                    this.updateAttachModel(attach, serialNo);
-                }
-            }
-
-            String pageId = this.getView().getPageId();
-            FpzsMainService.cacheAttachList(pageId, SerializationUtils.toJsonString(attachArray));
-            this.calculationSum();
-        }
-
-    }
-
-    private String officeToPdf(String originalFileName, String officeUrl) {
-        Map<String, Object> preview = FileServiceFactory.getAttachmentFileService().preview(originalFileName, officeUrl, "userAgent");
-        this.getView().previewAttachment(preview);
-        String pdfUrl = "";
-        InputStream pdfInputStream = null;
-
-        try {
-            pdfInputStream = (InputStream)preview.get(PreviewParams.RESULT.getEnumName());
-            String fileName = originalFileName.substring(0, originalFileName.lastIndexOf(46));
-            String pdfFileName = fileName.concat(".pdf");
-            String pdfFilePath = "/rim/attach/pdf/" + pdfFileName;
-            pdfUrl = FileServiceFactory.getAttachmentFileService().upload(new FileItem(pdfFileName, pdfFilePath, pdfInputStream));
-        } catch (Exception var12) {
-            logger.info("发票助手-office文件转pdf失败:" + var12);
-            this.getView().showErrorNotification(ResManager.loadKDString("office文件转pdf失败,该文件将无法进行预览", "FpzsMainPlugin_133", "imc-rim-formplugin", new Object[0]));
-        } finally {
-            IOUtils.closeQuietly(pdfInputStream);
-        }
-
-        return pdfUrl;
-    }
-
-    private void saveAttachRelation(String serialNo, String attachPkValue) {
-        if (!StringUtils.isEmpty(serialNo)) {
-            QFilter attachRelationFilter = (new QFilter("attach_id", "=", attachPkValue)).and("relation_type", "=", "3").and("relation_id", "=", serialNo);
-            DynamicObjectCollection relations = QueryServiceHelper.query("rim_attach_relation", "id", attachRelationFilter.toArray());
-            if (relations == null || relations.size() == 0) {
-                DynamicObject relationObject = BusinessDataServiceHelper.newDynamicObject("rim_attach_relation");
-                relationObject.set("attach_id", attachPkValue);
-                relationObject.set("relation_type", "3");
-                relationObject.set("relation_id", serialNo);
-                SaveServiceHelper.save(new DynamicObject[]{relationObject});
-            }
-
-        }
-    }
-
-    private void updateAttachModel(DynamicObject attachObject, String serialNo) {
-        Object categoryId = DynamicObjectUtil.getDynamicObjectLongValue(attachObject.get("attach_category"));
-        QFilter categoryFilter = new QFilter("id", "=", categoryId);
-        DynamicObject attachCategory = QueryServiceHelper.queryOne("bdm_attach_type", "name,simplify_name", categoryFilter.toArray());
-        if (attachCategory == null) {
-            this.getView().showTipNotification(ResManager.loadKDString("找不到附件分类", "FpzsMainPlugin_134", "imc-rim-formplugin", new Object[0]));
-        } else {
-            String categorySimplifyName = attachCategory.getString("simplify_name");
-            String categoryName = attachCategory.getString("name");
-            if (StringUtils.isEmpty(categorySimplifyName)) {
-                categorySimplifyName = ResManager.loadKDString("其他", "FpzsMainPlugin_135", "imc-rim-formplugin", new Object[0]);
-            }
-
-            if (StringUtils.isEmpty(categoryName)) {
-                categoryName = ResManager.loadKDString("其他附件", "FpzsMainPlugin_136", "imc-rim-formplugin", new Object[0]);
-            }
-
-            int attachIndex = this.getModel().createNewEntryRow("attach_grid_entry");
-            String attachType = attachObject.getString("attach_type");
-            String fileExtension = attachObject.getString("file_extension");
-            this.getModel().setValue("attach_no", attachObject.get("attach_no"), attachIndex);
-            this.getModel().setValue("attach_type", attachType, attachIndex);
-            this.getModel().setValue("attach_name", attachObject.get("attach_name"), attachIndex);
-            Date uploadDate = attachObject.getDate("create_time");
-            uploadDate = (Date)Optional.ofNullable(uploadDate).orElseGet(() -> {
-                return new Date();
-            });
-            this.getModel().setValue("upload_date", uploadDate, attachIndex);
-            this.getModel().setValue("attach_path", attachObject.get("attach_url"), attachIndex);
-            this.getModel().setValue("original_name", attachObject.get("original_name"), attachIndex);
-            this.getModel().setValue("attach_icon", attachObject.get("icon_url"), attachIndex);
-            this.getModel().setValue("attach_no", attachObject.getString("attach_no"), attachIndex);
-            this.getModel().setValue("attach_category_grid", categoryId, attachIndex);
-            this.getModel().setValue("attach_categoryid", categoryId, attachIndex);
-            this.getModel().setValue("file_extension", fileExtension, attachIndex);
-            if (!StringUtils.isEmpty(serialNo)) {
-                this.getModel().setValue("serial_no3", serialNo, attachIndex);
-            }
-
-            this.getModel().setValue("attachid", attachObject.getPkValue(), attachIndex);
-            this.getModel().setValue("attach_remark", attachObject.getString("remark"), attachIndex);
-            int attachCardIndex = this.getModel().createNewEntryRow("attach_card_entry");
-            this.getModel().setValue("attach_category", categorySimplifyName, attachCardIndex);
-            this.getModel().setValue("attach_name_grid", attachObject.get("attach_name"), attachCardIndex);
-            String imageUrl = this.getAttachSnapshotUrl(attachObject);
-            this.getModel().setValue("attach_image_grid", imageUrl, attachCardIndex);
-        }
-    }
-
-    private String getAttachSnapshotUrl(DynamicObject attachObject) {
-        String attachType = attachObject.getString("attach_type");
-        String imageUrl = "";
-        String domain = UrlService.getDomainContextUrl();
-        if (!"1".equals(attachType) && !"4".equals(attachType)) {
-            if ("8".equals(attachType)) {
-                imageUrl = domain.concat("/icons/pc/label/fpy_txt.png");
-            } else if ("5".equals(attachType)) {
-                imageUrl = domain.concat("/icons/pc/label/fpy_word_doc.png");
-            } else if ("6".equals(attachType)) {
-                imageUrl = domain.concat("/icons/pc/label/fpy_excel_xls.png");
-            } else if ("7".equals(attachType)) {
-                imageUrl = domain.concat("/icons/pc/label/fpy_ppt.png");
-            } else if (!"3".equals(attachType)) {
-                imageUrl = UrlServiceUtils.getDownloadUrl(attachObject.get("attach_url").toString());
-            }
-        } else {
-            imageUrl = UrlServiceUtils.getDownloadUrl(attachObject.get("icon_url").toString());
-        }
-
-        return imageUrl;
-    }
-
-    private DynamicObject newAttachDynamicObj() {
-        Long userId = Long.valueOf(RequestContext.get().getUserId());
-        Map<String, Object> customParam = FpzsMainService.getCustomParam(this);
-        DynamicObject attachObject = BusinessDataServiceHelper.newDynamicObject("rim_attach");
-        attachObject.set("create_time", new Date());
-        attachObject.set("update_time", new Date());
-        attachObject.set("user", userId);
-        attachObject.set("rim_user", customParam.get("rim_user"));
-        String attachNo = UUID.randomUUID();
-        attachObject.set("attach_no", attachNo);
-        attachObject.set("attach_category", AttachConstant.ATTACH_OTHER_CATEGORY_ID);
-        return attachObject;
-    }
-
-    private void showAttachUpload() {
-        FormShowParameter showParameter = new FormShowParameter();
-        showParameter.setShowTitle(true);
-        showParameter.setFormId("rim_attach_upload");
-        showParameter.getOpenStyle().setShowType(ShowType.Modal);
-        CloseCallBack closeCallBack = new CloseCallBack(this, "rim_attach_upload");
-        showParameter.setCloseCallBack(closeCallBack);
-        this.getView().showForm(showParameter);
-    }
-
-    private Boolean showSelectInvoice(List<Long> invoiceIds, List<Long> unchekInvoiceIds, JSONArray invoiceArray) {
-        JSONArray showArray = new JSONArray();
-        Iterator var5;
-        Long id;
-        JSONObject obj;
-        if (!CollectionUtils.isEmpty(invoiceIds)) {
-            var5 = invoiceIds.iterator();
-
-            while(var5.hasNext()) {
-                id = (Long)var5.next();
-                obj = new JSONObject();
-                obj.put("mainId", id);
-                showArray.add(obj);
-            }
-        }
-
-        if (!CollectionUtils.isEmpty(unchekInvoiceIds)) {
-            var5 = unchekInvoiceIds.iterator();
-
-            while(var5.hasNext()) {
-                id = (Long)var5.next();
-                obj = new JSONObject();
-                obj.put("unCheckId", id);
-                showArray.add(obj);
-            }
-        }
-
-        if (!CollectionUtils.isEmpty(invoiceArray)) {
-            showArray.addAll(invoiceArray);
-        }
-
-        this.refreshInvoiceList(showArray);
-        return Boolean.TRUE;
-    }
-
-    private void refreshInvoiceList(JSONArray invoiceArray) {
-        this.showTipRefresh(invoiceArray, true);
-    }
-
-    private void showTipRefresh(JSONArray invoiceArray, boolean isShowTips) {
-        JSONArray attachArray = (JSONArray)invoiceArray.stream().filter((f) -> {
-            JSONObject info = (JSONObject)f;
-            String attach_no = info.getString("attach_no");
-            return StringUtils.isNotEmpty(attach_no);
-        }).collect(Collectors.toCollection(JSONArray::new));
-        invoiceArray.removeAll(attachArray);
-        Pair<JSONObject, Boolean> cachePair = FpzsMainService.cacheInvoiceList(this.getView().getPageId(), FpzsMainService.getCustomParam(this), invoiceArray, attachArray);
-        JSONObject invoiceJson = (JSONObject)cachePair.getLeft();
-        if (!ObjectUtils.isEmpty(invoiceJson)) {
-            FpzsMainService.updateInvoiceGrid(this, invoiceJson);
-            this.updateInvoiceCard(invoiceJson);
-        }
-
-        JSONObject data = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-        Map<String, String> attIdSerialMap = Maps.newLinkedHashMap();
-        Iterator var8 = data.entrySet().iterator();
-
-        while(true) {
-            JSONObject invoiceInfo;
-            List attachList;
-            do {
-                do {
-                    if (!var8.hasNext()) {
-                        JSONArray attachCache = FpzsMainService.getAttachDataCache(this.getView().getPageId());
-                        if (attachCache.size() != 0) {
-                            this.getModel().deleteEntryData("attach_grid_entry");
-                            this.getModel().deleteEntryData("attach_card_entry");
-                            Iterator var19 = attachCache.iterator();
-
-                            while(var19.hasNext()) {
-                                Object attach = var19.next();
-                                JSONObject attachJson = (JSONObject)attach;
-                                String id = attachJson.getString("id");
-                                Iterator var23 = attIdSerialMap.entrySet().iterator();
-
-                                while(var23.hasNext()) {
-                                    Map.Entry<String, String> entry = (Map.Entry)var23.next();
-                                    if (id.equals(entry.getKey())) {
-                                        attachJson.put("serial_no", entry.getValue());
-                                    }
-                                }
-
-                                this.handleAttachCategory(attachJson);
-                                int row = this.getModel().createNewEntryRow("attach_grid_entry");
-                                this.getModel().setValue("attachid", attachJson.get("id"), row);
-                                this.getModel().setValue("attach_category_grid", attachJson.get("attach_category"), row);
-                                this.getModel().setValue("attach_name", attachJson.get("attach_name"), row);
-                                this.getModel().setValue("serial_no3", attachJson.get("serial_no"), row);
-                                this.getModel().setValue("attach_type", attachJson.get("attach_type"), row);
-                                this.getModel().setValue("upload_date", attachJson.getDate("create_time"), row);
-                                this.getModel().setValue("attach_remark", attachJson.get("remark"), row);
-                                this.getModel().setValue("attach_path", attachJson.get("attach_url"), row);
-                                this.getModel().setValue("file_extension", attachJson.get("file_extension"), row);
-                                this.getModel().setValue("attach_no", attachJson.get("attach_no"), row);
-                                int attachGridIndex = this.getModel().createNewEntryRow("attach_card_entry");
-                                String simplify_name = attachJson.getString("simplify_name");
-                                if (StringUtils.isEmpty(simplify_name)) {
-                                    Long attachCategoryId = DynamicObjectUtil.getDynamicObjectLongValue(attachJson.get("attach_category"));
-                                    DynamicObject attachTypeObj = BusinessDataServiceHelper.loadSingle(attachCategoryId, "bdm_attach_type");
-                                    simplify_name = attachTypeObj.getString("simplify_name");
-                                }
-
-                                this.getModel().setValue("attach_category", simplify_name, attachGridIndex);
-                                this.getModel().setValue("attach_name_grid", attachJson.get("attach_name"), attachGridIndex);
-                                DynamicObject attachObj = BusinessDataServiceHelper.newDynamicObject("rim_attach");
-                                attachObj = DynamicObjectUtil.jsonToDynamicObject(attachJson, attachObj);
-                                String imageUrl = this.getAttachSnapshotUrl(attachObj);
-                                this.getModel().setValue("attach_image_grid", imageUrl, attachGridIndex);
-                            }
-                        }
-
-                        this.showFlex();
-                        if ((Boolean)cachePair.getRight() && isShowTips) {
-                            this.getView().showSuccessNotification(ResManager.loadKDString("发票已存在列表", "FpzsMainPlugin_137", "imc-rim-formplugin", new Object[0]));
-                        }
-
-                        return;
-                    }
-
-                    Map.Entry<String, Object> entry = (Map.Entry)var8.next();
-                    invoiceInfo = (JSONObject)entry.getValue();
-                    attachList = (List)invoiceInfo.get("attachList");
-                } while(attachList == null);
-            } while(attachList.size() == 0);
-
-            Iterator var12 = attachList.iterator();
-
-            while(var12.hasNext()) {
-                Map<String, Object> attachInfo = (Map)var12.next();
-                String id = (String)attachInfo.get("id");
-                attIdSerialMap.put(id, invoiceInfo.getString("serialNo"));
-            }
-        }
-    }
-
-    private void handleAttachCategory(JSONObject attachJson) {
-        if (ObjectUtils.isEmpty(attachJson.get("attach_category")) && ObjectUtils.isEmpty(attachJson.get("attach_category.id")) && ObjectUtils.isEmpty(attachJson.get("attach_category_id"))) {
-            attachJson.put("attach_category", AttachConstant.ATTACH_OTHER_CATEGORY_ID);
-        } else if (!ObjectUtils.isEmpty(attachJson.get("attach_category_id"))) {
-            attachJson.put("attach_category", attachJson.getLong("attach_category_id"));
-        } else if (!ObjectUtils.isEmpty(attachJson.get("attach_category.id"))) {
-            attachJson.put("attach_category", attachJson.getLong("attach_category.id"));
-        }
-
-    }
-
-    private void updateInvoiceCard(JSONObject invoiceArray) {
-        this.getModel().deleteEntryData("invoice_card_entry");
-        this.getModel().deleteEntryData("error_invoice_card_entry");
-        JSONObject obj;
-        Boolean isFilter;
-        int cardIndex;
-        if (!ObjectUtils.isEmpty(invoiceArray)) {
-            for(Iterator var2 = invoiceArray.entrySet().iterator(); var2.hasNext(); this.showWarningAndEdit(isFilter, obj, cardIndex)) {
-                Map.Entry<String, Object> entry = (Map.Entry)var2.next();
-                obj = (JSONObject)entry.getValue();
-                String invoiceType = obj.getString("invoiceType");
-                String level = (String)obj.get("errorLevel");
-                String snapshotUrl = obj.getString("snapshotUrl");
-                String imageUrl = UrlServiceUtils.getDownloadUrl(snapshotUrl);
-                String serialNo = obj.getString("serialNo");
-                isFilter = FpzsMainService.isFilter(obj);
-                if (isFilter) {
-                    cardIndex = this.getModel().createNewEntryRow("error_invoice_card_entry");
-                    this.getModel().setValue("error_invoice_card_image", imageUrl, cardIndex);
-                    this.getModel().setValue("error_serial_no", serialNo, cardIndex);
-                } else {
-                    cardIndex = this.getModel().createNewEntryRow("invoice_card_entry");
-                    this.getModel().setValue("invoice_card_image", imageUrl, cardIndex);
-                    this.getModel().setValue("import_serial_no", serialNo, cardIndex);
-                }
-            }
-        }
-
-    }
-
-    private void createTips(String entry, String verifyMessage, int index, String key) {
-        ClientViewProxy client = (ClientViewProxy)this.getView().getService(IClientViewProxy.class);
-        Map<String, Object> pmap = new HashMap(2);
-        Map<String, Object> operateHoverPropMap = new HashMap(4);
-        Map<String, Object> tips = new HashMap(2);
-        tips.put("type", "text");
-        if (verifyMessage != null && verifyMessage.length() > 3) {
-            verifyMessage = verifyMessage.substring(0, verifyMessage.length() - 3);
-        }
-
-        tips.put("content", new LocaleString(verifyMessage));
-        tips.put("showIcon", Boolean.TRUE);
-        operateHoverPropMap.put("tips", tips);
-        operateHoverPropMap.put("text", "");
-        pmap.put(key, operateHoverPropMap);
-        client.invokeControlMethod(entry, "setCustomProperties", new Object[]{index, pmap});
-    }
-
-    private void showWarningAndEdit(Boolean isFilter, JSONObject invoiceObj, int index) {
-        String entry = "invoice_card_entry";
-        if (isFilter) {
-            entry = "error_invoice_card_entry";
-        }
-
-        CardEntry cardEntry = (CardEntry)this.getControl(entry);
-        String level = (String)invoiceObj.get("errorLevel");
-        String verifyResultHtml = invoiceObj.getString("validateMessage_html");
-        String verifyMessage = invoiceObj.getString("validateMessage");
-        JSONArray verifyResultArray = invoiceObj.getJSONArray("verifyResult");
-        StringBuilder filterMsg = new StringBuilder();
-        StringBuilder redMsg = new StringBuilder();
-        StringBuilder yellowMsg = new StringBuilder();
-        String showAttachUpload;
-        if (verifyResultArray != null && verifyResultArray.size() > 0) {
-            for(int i = 0; i < verifyResultArray.size(); ++i) {
-                JSONObject verifyResult = verifyResultArray.getJSONObject(i);
-                if (verifyResult != null) {
-                    showAttachUpload = verifyResult.getString("config");
-                    String msg = verifyResult.getString("msg");
-                    if ("0".equals(showAttachUpload)) {
-                        if (StringUtils.isEmpty(filterMsg) && !StringUtils.isEmpty(msg)) {
-                            filterMsg.append(ResManager.loadKDString("严重警示:", "FpzsMainPlugin_159", "imc-rim-formplugin", new Object[0])).append("\r\n\t");
-                            filterMsg.append(msg);
-                        } else if (!StringUtils.isEmpty(filterMsg) && !StringUtils.isEmpty(msg)) {
-                            filterMsg.append("\r\n\t").append(msg);
-                        }
-                    } else if ("1".equals(showAttachUpload)) {
-                        if (StringUtils.isEmpty(redMsg) && !StringUtils.isEmpty(msg)) {
-                            redMsg.append(ResManager.loadKDString("中度警示:", "FpzsMainPlugin_160", "imc-rim-formplugin", new Object[0])).append("\r\n\t");
-                            redMsg.append(msg);
-                        } else if (!StringUtils.isEmpty(redMsg) && !StringUtils.isEmpty(msg)) {
-                            redMsg.append("\r\n\t").append(msg);
-                        }
-                    } else if ("2".equals(showAttachUpload)) {
-                        if (StringUtils.isEmpty(yellowMsg) && !StringUtils.isEmpty(msg)) {
-                            yellowMsg.append(ResManager.loadKDString("轻度提醒:", "FpzsMainPlugin_161", "imc-rim-formplugin", new Object[0])).append("\r\n\t");
-                            yellowMsg.append(msg);
-                        } else if (!StringUtils.isEmpty(yellowMsg) && !StringUtils.isEmpty(msg)) {
-                            yellowMsg.append("\r\n\t").append(msg);
-                        }
-                    }
-                }
-            }
-        }
-
-        StringBuilder allMsg = new StringBuilder();
-        if (!StringUtils.isEmpty(filterMsg)) {
-            if (!StringUtils.isEmpty(allMsg)) {
-                allMsg.append("\r\n");
-            }
-
-            allMsg.append(filterMsg);
-        }
-
-        if (!StringUtils.isEmpty(redMsg)) {
-            if (!StringUtils.isEmpty(allMsg)) {
-                allMsg.append("\r\n");
-            }
-
-            allMsg.append(redMsg);
-        }
-
-        if (!StringUtils.isEmpty(yellowMsg)) {
-            if (!StringUtils.isEmpty(allMsg)) {
-                allMsg.append("\r\n");
-            }
-
-            allMsg.append(yellowMsg);
-        }
-
-        if ("0".equals(level)) {
-            if (isFilter) {
-                if (StringUtils.isEmpty(allMsg) && !StringUtils.isEmpty(verifyResultHtml) && verifyResultHtml.contains(ResManager.loadKDString("发票必要字段缺失", "FpzsMainPlugin_141", "imc-rim-formplugin", new Object[0]))) {
-                    allMsg.append(ResManager.loadKDString("严重警示:", "FpzsMainPlugin_159", "imc-rim-formplugin", new Object[0])).append("\r\n\t").append(ResManager.loadKDString("发票必要字段缺失,请编辑补全", "FpzsMainPlugin_142", "imc-rim-formplugin", new Object[0])).append("\r\n\t");
-                }
-
-                this.createTips(entry, allMsg.toString(), index, "error_filter_msg");
-                this.showTipsTag(isFilter, "error_filter_msg", index);
-            } else {
-                this.createTips(entry, allMsg.toString(), index, "import_filter_msg");
-                this.showTipsTag(isFilter, "import_filter_msg", index);
-            }
-        } else if ("1".equals(level)) {
-            if (isFilter) {
-                this.createTips(entry, allMsg.toString(), index, "error_red_msg");
-                this.showTipsTag(isFilter, "error_red_msg", index);
-            } else {
-                this.createTips(entry, allMsg.toString(), index, "import_red_msg");
-                this.showTipsTag(isFilter, "import_red_msg", index);
-            }
-        } else if ("2".equals(level)) {
-            if (isFilter) {
-                this.createTips(entry, allMsg.toString(), index, "error_yellow_msg");
-                this.showTipsTag(isFilter, "error_yellow_msg", index);
-            } else {
-                this.createTips(entry, allMsg.toString(), index, "import_yellow_msg");
-                this.showTipsTag(isFilter, "import_yellow_msg", index);
-            }
-        } else {
-            this.showTipsTag(isFilter, "null", index);
-        }
-
-        Boolean canEdit = FpzsMainService.canEdit(invoiceObj);
-        showAttachUpload = this.getPageCache().get("showAttachUpload");
-        boolean allowAttachUpload = StringUtils.isEmpty(showAttachUpload) || !"false".equals(showAttachUpload);
-        if (isFilter) {
-            if (canEdit) {
-                cardEntry.setChildVisible(true, index, new String[]{"error_edit_button"});
-                cardEntry.setChildVisible(false, index, new String[]{"error_view_button"});
-            } else {
-                cardEntry.setChildVisible(false, index, new String[]{"error_edit_button"});
-                cardEntry.setChildVisible(true, index, new String[]{"error_view_button"});
-            }
-
-            if (allowAttachUpload) {
-                cardEntry.setChildVisible(true, index, new String[]{"error_upload_attach"});
-            } else {
-                cardEntry.setChildVisible(false, index, new String[]{"error_upload_attach"});
-            }
-
-        } else {
-            if (canEdit) {
-                cardEntry.setChildVisible(true, index, new String[]{"import_edit_button"});
-                cardEntry.setChildVisible(false, index, new String[]{"import_view_button"});
-            } else {
-                cardEntry.setChildVisible(false, index, new String[]{"import_edit_button"});
-                cardEntry.setChildVisible(true, index, new String[]{"import_view_button"});
-            }
-
-            if (allowAttachUpload) {
-                cardEntry.setChildVisible(true, index, new String[]{"import_upload_attach"});
-            } else {
-                cardEntry.setChildVisible(false, index, new String[]{"import_upload_attach"});
-            }
-
-        }
-    }
-
-    private void showTipsTag(Boolean isFilter, String tagKey, int index) {
-        String entry = "invoice_card_entry";
-        CardEntry cardEntry;
-        Iterator var6;
-        String msgKey;
-        if (isFilter) {
-            entry = "error_invoice_card_entry";
-            cardEntry = (CardEntry)this.getControl(entry);
-            var6 = ERROR_MSG_LIST.iterator();
-
-            while(var6.hasNext()) {
-                msgKey = (String)var6.next();
-                if (msgKey.equals(tagKey)) {
-                    cardEntry.setChildVisible(true, index, new String[]{msgKey});
-                } else {
-                    cardEntry.setChildVisible(false, index, new String[]{msgKey});
-                }
-            }
-        } else {
-            cardEntry = (CardEntry)this.getControl(entry);
-            var6 = IMPORT_MSG_LIST.iterator();
-
-            while(var6.hasNext()) {
-                msgKey = (String)var6.next();
-                if (msgKey.equals(tagKey)) {
-                    cardEntry.setChildVisible(true, index, new String[]{msgKey});
-                } else {
-                    cardEntry.setChildVisible(false, index, new String[]{msgKey});
-                }
-            }
-        }
-
-    }
-
-    private void showInvoiceEdit(String serialNo) {
-        FormShowParameter param = new FormShowParameter();
-        param.setCaption(ResManager.loadKDString("发票预览", "FpzsMainPlugin_143", "imc-rim-formplugin", new Object[0]));
-        Map<String, Object> customParams = new HashMap(8);
-        JSONObject cacheJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-        JSONObject invoiceJson = cacheJson.getJSONObject(serialNo);
-        if (ObjectUtils.isEmpty(invoiceJson)) {
-            Map<String, DynamicObject> mainDetailMap = VerifyUtil.queryInvoiceDynamicObjectBySerialNo(serialNo);
-            DynamicObject detail = (DynamicObject)mainDetailMap.get("detail");
-
-            try {
-                invoiceJson = JSON.parseObject(JSON.toJSONString(detail));
-            } catch (Exception var10) {
-                this.getView().showTipNotification(ResManager.loadKDString("页面数据已过期,请重新采集!", "FpzsMainPlugin_144", "imc-rim-formplugin", new Object[0]), 5000);
-                return;
-            }
-        }
-
-        if (ObjectUtils.isEmpty(invoiceJson)) {
-            this.getView().showTipNotification(ResManager.loadKDString("页面数据已过期,请重新采集!", "FpzsMainPlugin_144", "imc-rim-formplugin", new Object[0]), 5000);
-        } else {
-            this.setInvoiceFiled(invoiceJson);
-            int invoiceIndex = 0;
-            customParams.put("invoice", invoiceJson);
-            customParams.put("row", Integer.valueOf(invoiceIndex));
-            if (FpzsMainService.canEdit(invoiceJson)) {
-                customParams.put("editAllow", Boolean.TRUE);
-                param.setCaption(ResManager.loadKDString("发票编辑", "FpzsMainPlugin_145", "imc-rim-formplugin", new Object[0]));
-            }
-
-            String pageId = this.getView().getPageId();
-            JSONObject businessParam = FpzsMainService.getBusinessParam(pageId, CollectTypeEnum.PC_UPLOAD.getCode());
-            invoiceJson.put("org_id", businessParam.getString("org_id"));
-            invoiceJson.put("rim_user", businessParam.get("rim_user"));
-            param.setCustomParams(customParams);
-            param.getOpenStyle().setShowType(ShowType.Modal);
-            param.setFormId("rim_inv_collect_edit");
-            CloseCallBack closeCallBack = new CloseCallBack(this, "rim_inv_collect_edit");
-            param.setCloseCallBack(closeCallBack);
-            this.getView().showForm(param);
-        }
-    }
-
-    private void setInvoiceFiled(JSONObject invoiceJson) {
-        String serialNo = invoiceJson.getString("serialNo");
-        if (!StringUtils.isBlank(serialNo)) {
-            QFilter qFilter = new QFilter("serial_no", "=", serialNo);
-            InvoiceQueryService invoiceQueryService = new InvoiceQueryService();
-            DynamicObjectCollection collection = invoiceQueryService.findByFilter("collect_type", qFilter);
-            if (!CollectionUtils.isEmpty(collection)) {
-                invoiceJson.put("collect_type", ((DynamicObject)collection.get(0)).getString("collect_type"));
-            }
-
-        }
-    }
-
-    private void showAttachEdit() {
-        FormShowParameter param = new FormShowParameter();
-        Map<String, Object> customParams = new HashMap(8);
-        int attachIndex = 0;
-        String attachModel = this.getView().getPageCache().get("attach_list_model");
-        if (StringUtils.isEmpty(attachModel)) {
-            attachIndex = this.getModel().getEntryCurrentRowIndex("attach_grid_entry");
-        } else {
-            attachIndex = this.getModel().getEntryCurrentRowIndex("attach_card_entry");
-        }
-
-        DynamicObject obj = this.getModel().getEntryRowEntity("attach_grid_entry", attachIndex);
-        customParams.put("attach_name", obj.getString("attach_name"));
-        customParams.put("attach_remark", obj.getString("attach_remark"));
-        customParams.put("file_extension", obj.get("file_extension"));
-        Date uploadDate = obj.getDate("upload_date");
-        customParams.put("update_time", uploadDate);
-        customParams.put("attach_type", obj.getInt("attach_type"));
-        customParams.put("attachid", obj.getLong("attachid"));
-        customParams.put("url", obj.getString("attach_path"));
-        customParams.put("attach_category", obj.getString("attach_categoryid"));
-        param.setCustomParams(customParams);
-        param.getOpenStyle().setShowType(ShowType.Modal);
-        param.setFormId("rim_fpzs_attach_edit");
-        CloseCallBack closeCallBack = new CloseCallBack(this, "rim_fpzs_attach_edit");
-        param.setCloseCallBack(closeCallBack);
-        this.getView().showForm(param);
-    }
-
-    private void updateAttachData(Map<String, Object> returnData) {
-        int attachIndex = this.getCurrentAttachIndex();
-        Object attachName = returnData.get("attach_name");
-        Object remark = returnData.get("attach_remark");
-        Object attachCategory = returnData.get("attach_category");
-        this.getModel().setValue("attach_name", attachName, attachIndex);
-        this.getModel().setValue("attach_type", returnData.get("attach_type"), attachIndex);
-        this.getModel().setValue("attach_remark", remark, attachIndex);
-        this.getModel().setValue("attach_category_grid", returnData.get("attach_category"), attachIndex);
-        this.getModel().setValue("attach_category", returnData.get("attach_category_simplify"), attachIndex);
-        this.getModel().setValue("attach_name_grid", returnData.get("attach_name"), attachIndex);
-        JSONObject attachInfo = new JSONObject();
-        attachInfo.put("attach_name", attachName);
-        attachInfo.put("remark", remark);
-        attachInfo.put("attach_category", attachCategory);
-        attachInfo.put("id", this.getModel().getValue("attachid", attachIndex));
-        JSONArray updatedAttachArray = new JSONArray();
-        updatedAttachArray.add(attachInfo);
-        this.updateAttachCache(updatedAttachArray);
-    }
-
-    private void updateAttachCache(JSONArray newAttachArray) {
-        String pageId = this.getView().getPageId();
-        JSONArray attachDataCache = FpzsMainService.getAttachDataCache(pageId);
-        if (attachDataCache != null && attachDataCache.size() != 0 && newAttachArray != null && newAttachArray.size() != 0) {
-            Boolean isUpdated = Boolean.FALSE;
-
-            for(int i = 0; i < attachDataCache.size(); ++i) {
-                JSONObject oldAttachInfo = attachDataCache.getJSONObject(i);
-                Long oldId = oldAttachInfo.getLong("id");
-
-                for(int j = 0; j < newAttachArray.size(); ++j) {
-                    JSONObject newAttachInfo = newAttachArray.getJSONObject(j);
-                    Long newId = newAttachInfo.getLong("id");
-                    if (oldId.equals(newId)) {
-                        String attachName = newAttachInfo.getString("attach_name");
-                        Long attachCategoryId = newAttachInfo.getLong("attach_category");
-                        String remark = newAttachInfo.getString("remark");
-                        if (!StringUtils.isEmpty(attachName)) {
-                            oldAttachInfo.put("attach_name", attachName);
-                        }
-
-                        if (!StringUtils.isEmpty(remark)) {
-                            oldAttachInfo.put("remark", remark);
-                        }
-
-                        if (!ObjectUtils.isEmpty(attachCategoryId)) {
-                            oldAttachInfo.put("attach_category", attachCategoryId);
-                        }
-
-                        isUpdated = Boolean.TRUE;
-                        break;
-                    }
-                }
-            }
-
-            if (isUpdated) {
-                FpzsMainService.setAttachDataCache(pageId, attachDataCache.toJSONString());
-            }
-
-        }
-    }
-
-    private int getCurrentAttachIndex() {
-        String attachModel = this.getView().getPageCache().get("attach_list_model");
-        int attachIndex = 0;
-        if (StringUtils.isEmpty(attachModel)) {
-            attachIndex = this.getModel().getEntryCurrentRowIndex("attach_grid_entry");
-        } else {
-            attachIndex = this.getModel().getEntryCurrentRowIndex("attach_card_entry");
-        }
-
-        return attachIndex;
-    }
-
-    private void updateInvoiceData(Map<String, Object> returnData) {
-        JSONObject dataJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-        if (dataJson == null) {
-            dataJson = new JSONObject();
-        }
-
-        JSONObject invoice = (JSONObject)returnData.get("invoice");
-        String oldSerialNo = (String)returnData.get("oldSerialNo");
-        String newSerialNo = invoice.getString("serialNo");
-        JSONObject oldInvoice = dataJson.getJSONObject(oldSerialNo);
-        Long mainId;
-        if (oldInvoice != null) {
-            mainId = BigDecimalUtil.transDecimal(oldInvoice.get("uploadSeq")).longValue();
-            if (mainId >= 0L) {
-                invoice.put("uploadSeq", mainId);
-            }
-        }
-
-        dataJson.put(newSerialNo, invoice);
-        if (!newSerialNo.equals(oldSerialNo)) {
-            dataJson.remove(oldSerialNo);
-        }
-
-        this.saveInvoiceDataCache(dataJson.toJSONString());
-        mainId = invoice.getLong("mainId");
-        Long unCheckId = invoice.getLong("unCheckId");
-        if (unCheckId != null) {
-            this.showSelectInvoice((List)null, (List)Stream.of(unCheckId).collect(Collectors.toList()), (JSONArray)null);
-        } else {
-            this.showSelectInvoice((List)Stream.of(mainId).collect(Collectors.toList()), (List)null, (JSONArray)null);
-        }
-
-    }
-
-    private void deleteCurrentEntry(String entryId) {
-        int attachIndex = this.getModel().getEntryCurrentRowIndex(entryId);
-        if ("attach_grid_entry".equals(entryId)) {
-            Object attachid = this.getModel().getValue("attachid", attachIndex);
-            if (attachid != null) {
-                Long attachId = Long.valueOf(attachid.toString());
-                QFilter deleteFilter = new QFilter("id", "=", attachId);
-                DeleteServiceHelper.delete("rim_attach", deleteFilter.toArray());
-            }
-
-            this.getModel().deleteEntryRow(entryId, attachIndex);
-            this.getModel().deleteEntryRow("attach_card_entry", attachIndex);
-            this.calculationSum();
-        } else {
-            this.getModel().deleteEntryRow(entryId, attachIndex);
-        }
-
-    }
-
-    private void showDeleteConfirm(String confirmMsg, String callBackId) {
-        Map<Integer, String> btnNameMaps = new HashMap(2);
-        btnNameMaps.put(MessageBoxResult.No.getValue(), ResManager.loadKDString("取消", "FpzsMainPlugin_146", "imc-rim-formplugin", new Object[0]));
-        btnNameMaps.put(MessageBoxResult.Yes.getValue(), ResManager.loadKDString("确认", "FpzsMainPlugin_147", "imc-rim-formplugin", new Object[0]));
-        this.getView().showConfirm(confirmMsg, "", MessageBoxOptions.YesNo, ConfirmTypes.Default, new ConfirmCallBackListener(callBackId), btnNameMaps);
-    }
-
-    private void deleteEntryData(String entryId, boolean clear) {
-        String pageId = this.getView().getPageId();
-        if (clear) {
-            if ("attach_grid_entry".equals(entryId)) {
-                this.deleteAttachRelation(Boolean.TRUE, (int[])null);
-            }
-
-            this.getModel().deleteEntryData(entryId);
-            FpzsMainService.removeAttachDataCache(pageId);
-        } else {
-            EntryGrid entryGrid = (EntryGrid)this.getControl(entryId);
-            int[] selectRows = entryGrid.getSelectRows();
-            if ("attach_grid_entry".equals(entryId)) {
-                selectRows = this.getSelectedRows("attach_grid_entry");
-            }
-
-            if (selectRows != null && selectRows.length >= 1) {
-                List<String> deleteAttachIds;
-                if ("attach_grid_entry".equals(entryId)) {
-                    deleteAttachIds = this.deleteAttachRelation(Boolean.FALSE, selectRows);
-                } else {
-                    deleteAttachIds = new ArrayList(selectRows.length);
-                }
-
-                this.getModel().deleteEntryRows(entryId, selectRows);
-                JSONArray attachDataCache = FpzsMainService.getAttachDataCache(pageId);
-                JSONArray newAttachDataCache = (JSONArray)attachDataCache.stream().filter((f) -> {
-                    JSONObject attachInfo = (JSONObject)f;
-                    String attach_id = attachInfo.getString("attach_id");
-                    return !deleteAttachIds.contains(attach_id);
-                }).collect(Collectors.toCollection(JSONArray::new));
-                FpzsMainService.setAttachDataCache(pageId, newAttachDataCache.toJSONString());
-            } else {
-                this.getView().showTipNotification(ResManager.loadKDString("请先选择记录", "FpzsMainPlugin_148", "imc-rim-formplugin", new Object[0]), 2000);
-            }
-        }
-
-        this.calculationSum();
-    }
-
-    private List<String> deleteAttachRelation(Boolean isClear, int[] selectRows) {
-        List<String> deleteAttachIds = new ArrayList(16);
-        List<String> deleteAttachSerialNos = new ArrayList(16);
-        int count;
-        if (!isClear && selectRows != null) {
-            for(count = 0; count < selectRows.length; ++count) {
-                deleteAttachIds.add(this.getModel().getValue("attachid", selectRows[count]).toString());
-                Object serialNoObj = this.getModel().getValue("serial_no3", selectRows[count]);
-                if (serialNoObj != null && !"".equals(serialNoObj)) {
-                    deleteAttachSerialNos.add(serialNoObj.toString());
-                }
-            }
-        } else {
-            count = this.getModel().getEntryRowCount("attach_grid_entry");
-
-            for(int i = 0; i < count; ++i) {
-                DynamicObject dynamicObject = (DynamicObject)this.getView().getModel().getEntryEntity("attach_grid_entry").get(i);
-                deleteAttachIds.add(dynamicObject.getString("attachid"));
-                Object serialNoObj = this.getModel().getValue("serial_no3", i);
-                if (serialNoObj != null && !"".equals(serialNoObj)) {
-                    deleteAttachSerialNos.add(serialNoObj.toString());
-                }
-            }
-        }
-
-        Map<String, Object> param = FpzsMainService.getCustomParam(this);
-        String billId = "billId";
-        if (!CollectionUtils.isEmpty(param)) {
-            billId = (String)param.get("billId");
-        }
-
-        QFilter serialNoFilter = new QFilter("relation_id", "in", deleteAttachSerialNos);
-        QFilter deleteFilter = new QFilter("attach_id", "in", deleteAttachIds);
-        QFilter relationTypeFilter = new QFilter("relation_type", "=", "3");
-        DeleteServiceHelper.delete("rim_attach_relation", new QFilter[]{deleteFilter, serialNoFilter, relationTypeFilter});
-        if (isClear) {
-            this.getModel().deleteEntryData("attach_card_entry");
-        } else {
-            this.getModel().deleteEntryRows("attach_card_entry", selectRows);
-        }
-
-        return deleteAttachIds;
-    }
-
-    private void showFlex() {
-        int attachCount = this.getModel().getEntryRowCount("attach_grid_entry");
-        String tab = "tab_invoice";
-        if (null != this.getPageCache().get("tabSelect")) {
-            tab = this.getPageCache().get("tabSelect");
-        }
-
-        if (!tab.equalsIgnoreCase("tab_invoice") && !tab.equalsIgnoreCase("tab_oversea")) {
-            if (tab.equalsIgnoreCase("tab_attach")) {
-                this.showAttachFlex(attachCount);
-            } else if (tab.equalsIgnoreCase("tab_oversea")) {
-                this.showInvoiceFlex(tab);
-            }
-        } else {
-            this.showInvoiceFlex(tab);
-        }
-
-        this.calculationSum();
-    }
-
-    private void showInvoiceFlex(String tab) {
-        int importCount = 0;
-        int errorCount = 0;
-        JSONObject dataJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-        logger.info("scannerProcess showFlex dataJson : " + dataJson);
-        if (dataJson == null) {
-            importCount = 0;
-            errorCount = 0;
-        } else {
-            Set<String> keySet = dataJson.keySet();
-            Iterator<String> iterator = keySet.iterator();
-
-            while(iterator.hasNext()) {
-                String key = (String)iterator.next();
-                JSONObject obj = dataJson.getJSONObject(key);
-                if (FpzsMainService.isFilter(obj)) {
-                    ++errorCount;
-                } else {
-                    ++importCount;
-                }
-            }
-        }
-
-        String flex_init_description = ResManager.loadKDString("请从左侧选择导入发票的方式。", "FpzsMainPlugin_149", "imc-rim-formplugin", new Object[0]);
-        String radioGroup = (String)this.getModel().getValue("radiogroup");
-        this.getView().setVisible(Boolean.FALSE, new String[]{"flexpanelap11"});
-        this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap1"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"attach_panel"});
-        this.getView().setVisible(Boolean.TRUE, new String[]{"radio_flex"});
-        this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap131"});
-        this.getView().setVisible(Boolean.TRUE, new String[]{"all_invoice"});
-        if (importCount <= 0 || !"1".equals(radioGroup) && !"2".equals(radioGroup)) {
-            this.getView().setVisible(Boolean.FALSE, new String[]{"advconap_import"});
-        } else {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"advconap_import"});
-        }
-
-        if (errorCount <= 0 || !"1".equals(radioGroup) && !"3".equals(radioGroup)) {
-            this.getView().setVisible(Boolean.FALSE, new String[]{"advconap_error"});
-        } else {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"advconap_error"});
-        }
-
-        if (importCount == 0 && errorCount == 0) {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"flex_init"});
-            this.getView().setVisible(Boolean.FALSE, new String[]{"all_invoice"});
-            this.getView().setVisible(Boolean.FALSE, new String[]{"advconap_import"});
-            this.getView().setVisible(Boolean.FALSE, new String[]{"advconap_error"});
-            this.getView().setVisible(Boolean.FALSE, new String[]{"attach_panel"});
-            this.getModel().setValue("flex_init_description", flex_init_description);
-        } else {
-            this.getView().setVisible(Boolean.FALSE, new String[]{"flex_init"});
-        }
-
-        this.showInvoiceModel();
-    }
-
-    private void showAttachFlex(int attachCount) {
-        this.getView().setVisible(Boolean.FALSE, new String[]{"flexpanelap1"});
-        this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap11"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"all_invoice"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"advconap_import"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"advconap_error"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"radio_flex"});
-        this.getView().setVisible(Boolean.FALSE, new String[]{"flexpanelap131"});
-        if (attachCount > 0) {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"attach_panel"});
-        }
-
-        String flex_init_description = ResManager.loadKDString("请从左侧选择导入附件的方式。", "FpzsMainPlugin_150", "imc-rim-formplugin", new Object[0]);
-        if (attachCount == 0) {
-            this.getView().setVisible(Boolean.TRUE, new String[]{"flex_init"});
-            this.getView().setVisible(Boolean.FALSE, new String[]{"attach_panel"});
-            this.getModel().setValue("flex_init_description", flex_init_description);
-        } else {
-            this.getView().setVisible(Boolean.FALSE, new String[]{"flex_init"});
-        }
-
-        this.showAttachModel();
-    }
-
-    private void showInvoiceModel() {
-        String invoiceModel = this.getView().getPageCache().get("invoice_list_model");
-        Map<String, Object> falseCtrl = new HashMap(1);
-        falseCtrl.put("vi", 0);
-        Map<String, Object> trueCtrl = new HashMap(1);
-        trueCtrl.put("vi", 1);
-        if (StringUtils.isEmpty(invoiceModel)) {
-            this.getView().updateControlMetadata("list_invoice_flex", trueCtrl);
-            this.getView().updateControlMetadata("error_list_invoice_flex", trueCtrl);
-            this.getView().updateControlMetadata("error_card_invoice_flex", falseCtrl);
-            this.getView().updateControlMetadata("card_invoice_flex", falseCtrl);
-        } else {
-            this.getView().updateControlMetadata("list_invoice_flex", falseCtrl);
-            this.getView().updateControlMetadata("error_list_invoice_flex", falseCtrl);
-            this.getView().updateControlMetadata("error_card_invoice_flex", trueCtrl);
-            this.getView().updateControlMetadata("card_invoice_flex", trueCtrl);
-        }
-
-    }
-
-    private void showAttachModel() {
-        String attachModel = this.getView().getPageCache().get("attach_list_model");
-        if (StringUtils.isEmpty(attachModel)) {
-            this.getView().setVisible(Boolean.FALSE, new String[]{"picture_attach"});
-            this.getView().setVisible(Boolean.TRUE, new String[]{"list_attach"});
-        } else {
-            this.getView().setVisible(Boolean.FALSE, new String[]{"list_attach"});
-            this.getView().setVisible(Boolean.TRUE, new String[]{"picture_attach"});
-        }
-
-    }
-
-    private void calculationSum() {
-        JSONObject cacheJson = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-        BigDecimal importAmount = BigDecimal.ZERO;
-        BigDecimal importTaxAmount = BigDecimal.ZERO;
-        BigDecimal errorAmount = BigDecimal.ZERO;
-        BigDecimal errorTaxAmount = BigDecimal.ZERO;
-        int errorTotal = 0;
-        int importTotal = 0;
-        if (cacheJson != null) {
-            Iterator<String> iterator = cacheJson.keySet().iterator();
-
-            while(iterator.hasNext()) {
-                String key = (String)iterator.next();
-                JSONObject obj = cacheJson.getJSONObject(key);
-                BigDecimal objTotalAmount = BigDecimal.ZERO;
-                BigDecimal objTotalTaxAmount = BigDecimal.ZERO;
-
-                try {
-                    objTotalAmount = BigDecimalUtil.transDecimal(obj.getBigDecimal("totalAmount"));
-                    objTotalTaxAmount = BigDecimalUtil.transDecimal(obj.getBigDecimal("totalTaxAmount"));
-                } catch (Exception var16) {
-                    logger.info("合计金额计算失败,格式不正确:" + obj.get("totalAmount") + "," + obj.get("totalTaxAmount"));
-                }
-
-                if (FpzsMainService.isFilter(obj)) {
-                    ++errorTotal;
-                    errorAmount = errorAmount.add(objTotalAmount);
-                    errorTaxAmount = errorTaxAmount.add(objTotalTaxAmount);
-                } else {
-                    ++importTotal;
-                    importAmount = importAmount.add(objTotalAmount);
-                    importTaxAmount = importTaxAmount.add(objTotalTaxAmount);
-                }
-            }
-        }
-
-        int attachTotal = this.getModel().getEntryRowCount("attach_grid_entry");
-        Label labelapImportMsgCount = (Label)this.getView().getControl("labelap_import_msg_count");
-        Label labelapErrorMsgCount = (Label)this.getView().getControl("labelap_error_msg_count");
-        Label labelapAttachMsgCount = (Label)this.getView().getControl("labelap_attach_msg_count");
-        labelapImportMsgCount.setText(String.format(ResManager.loadKDString("共%1$s张,价税合计:%2$s元  税额:%3$s元", "FpzsMainPlugin_151", "imc-rim-formplugin", new Object[0]), importTotal, BigDecimalUtil.format(importAmount, "###,##0.00"), BigDecimalUtil.format(importTaxAmount, "###,##0.00")));
-        labelapErrorMsgCount.setText(String.format(ResManager.loadKDString("共%1$s张,价税合计:%2$s元  税额:%3$s元", "FpzsMainPlugin_151", "imc-rim-formplugin", new Object[0]), errorTotal, BigDecimalUtil.format(errorAmount, "###,##0.00"), BigDecimalUtil.format(errorTaxAmount, "###,##0.00")));
-        labelapAttachMsgCount.setText(String.format(ResManager.loadKDString("共%s份", "FpzsMainPlugin_152", "imc-rim-formplugin", new Object[0]), attachTotal));
-        Label labelapInvTotal = (Label)this.getView().getControl("labelap_inv_total");
-        Label labelapInvamountTotal = (Label)this.getView().getControl("labelap_invamount_total");
-        Label labelapInvtaxTotal = (Label)this.getView().getControl("labelap_invtax_total");
-        Label labelapAttachTotal = (Label)this.getView().getControl("labelap_attach_total");
-        labelapInvTotal.setText(importTotal + errorTotal + "");
-        labelapInvamountTotal.setText(BigDecimalUtil.format(importAmount.add(errorAmount), "###,##0.00"));
-        labelapInvtaxTotal.setText(BigDecimalUtil.format(errorTaxAmount.add(importTaxAmount), "###,##0.00"));
-        labelapAttachTotal.setText(attachTotal + "");
-    }
-
-    private void operateCustomTable(String type, String operate) {
-        String entryId = null;
-        if ("error".equals(type)) {
-            entryId = "error_invoice_card_entry";
-        } else if ("import".equals(type)) {
-            entryId = "invoice_card_entry";
-        }
-
-        if (entryId != null && "clearTable".equals(operate)) {
-            this.getModel().deleteEntryData(entryId);
-            JSONObject table = new JSONObject();
-            table.put("tableId", this.getTableId(type));
-            this.clearInvoiceTable(table.toJSONString());
-        }
-
-        String invoiceModel = this.getView().getPageCache().get("invoice_list_model");
-        JSONObject map;
-        if (!StringUtils.isEmpty(invoiceModel) && "card".equals(invoiceModel) && "deleteRow".equals(operate)) {
-            JSONArray array = this.getSelectedCardInvoice(this.getTableId(type));
-            this.deleteCardInvoiceRow(this.getTableId(type), array);
-            this.updateInvoiceCache(array);
-            map = FpzsMainService.getInvoiceDataCache(this.getView().getPageId());
-            FpzsMainService.updateInvoiceGrid(this, map);
-            this.updateInvoiceCard(map);
-            this.showFlex();
-        } else {
-            CustomControl control = (CustomControl)this.getControl(this.getCustomId(type));
-            map = new JSONObject();
-            map.put("operate", operate);
-            map.put("tableId", this.getTableId(type));
-            map.put("time", System.currentTimeMillis());
-            control.setData(map);
-        }
-    }
-
-    private void editClass(String eventArgs) {
-        this.getView().setEnable(Boolean.TRUE, new String[]{"edit_class"});
-        JSONObject json = JSON.parseObject(eventArgs);
-        JSONArray array = json.getJSONArray("rows");
-        if (CollectionUtils.isEmpty(array)) {
-            this.getView().showTipNotification(ResManager.loadKDString("请先选择记录", "FpzsMainPlugin_148", "imc-rim-formplugin", new Object[0]), 2000);
-        } else {
-            DynamicObjectCollection invoiceCardDatas = this.getModel().getEntryEntity("invoice_card_entry");
-            List<String> serialNoList = new ArrayList(invoiceCardDatas.size());
-            int i = 0;
-            Iterator var7 = invoiceCardDatas.iterator();
-
-            while(var7.hasNext()) {
-                DynamicObject invoiceCardData = (DynamicObject)var7.next();
-                if (invoiceCardData != null) {
-                    String importSerialNo = invoiceCardData.getString("import_serial_no");
-                    if (array.size() > 0 && array.contains(importSerialNo)) {
-                        serialNoList.add(importSerialNo);
-                    }
-
-                    ++i;
-                }
-            }
-
-            if (!CollectionUtils.isEmpty(serialNoList)) {
-                DynamicObject[] invoices = BusinessDataServiceHelper.load("rim_invoice", "id, check_status, mul_class", new QFilter[]{new QFilter("serial_no", "in", serialNoList)});
-                this.beginEdit(invoices);
-            }
-
-        }
-    }
-
-    private void beginEdit(DynamicObject[] invoices) {
-        if (invoices != null) {
-            boolean flag = false;
-            List<String> mainIds = Lists.newArrayList();
-            List<String> uncheckIds = Lists.newArrayList();
-            List<String> ids = Lists.newArrayList();
-            DynamicObject[] var6 = invoices;
-            int var7 = invoices.length;
-
-            for(int var8 = 0; var8 < var7; ++var8) {
-                DynamicObject invoice = var6[var8];
-                if ("1".equals(invoice.getString("check_status"))) {
-                    mainIds.add(invoice.getString("id"));
-                } else {
-                    uncheckIds.add(invoice.getString("id"));
-                }
-
-                DynamicObjectCollection mul_class = invoice.getDynamicObjectCollection("mul_class");
-                if (!CollectionUtils.isEmpty(mul_class)) {
-                    Iterator var11 = mul_class.iterator();
-
-                    while(var11.hasNext()) {
-                        DynamicObject obj = (DynamicObject)var11.next();
-                        DynamicObject sysOrg = obj.getDynamicObject("fbasedataid");
-                        ids.add(sysOrg.getPkValue() + "");
-                    }
-
-                    flag = true;
-                }
-            }
-
-            if (flag) {
-                this.getView().getPageCache().put("cache_mainIds", JSON.toJSONString(mainIds));
-                this.getView().getPageCache().put("cache_uncheckIds", JSON.toJSONString(uncheckIds));
-                Map<Integer, String> confirmBtnNameMaps = new HashMap(2);
-                confirmBtnNameMaps.put(MessageBoxResult.No.getValue(), ResManager.loadKDString("取消", "FpzsMainPlugin_146", "imc-rim-formplugin", new Object[0]));
-                confirmBtnNameMaps.put(MessageBoxResult.Yes.getValue(), ResManager.loadKDString("确认", "FpzsMainPlugin_147", "imc-rim-formplugin", new Object[0]));
-                this.getView().showConfirm(ResManager.loadKDString("所选发票已有发票标签,请确认是否修改?", "FpzsMainPlugin_163", "imc-rim-formplugin", new Object[0]), "", MessageBoxOptions.YesNo, ConfirmTypes.Delete, new ConfirmCallBackListener("editclass_callback"), confirmBtnNameMaps);
-            } else {
-                FormShowParameter param = new FormShowParameter();
-                param.getOpenStyle().setShowType(ShowType.Modal);
-                param.setFormId("rim_chose_invoice_class");
-                CloseCallBack closeCallBack = new CloseCallBack(this, "editclass_callback");
-                param.setCloseCallBack(closeCallBack);
-                param.setCustomParam("mainIds", mainIds);
-                param.setCustomParam("uncheckIds", uncheckIds);
-                this.getView().showForm(param);
-            }
-
-        }
-    }
-
-    private String getTableId(String type) {
-        return this.getView().getPageId() + type;
-    }
-
-    private String getCustomId(String type) {
-        return "customcontrol_" + type;
-    }
-
-    private void scannerProcess(String type) {
-        String pageId = this.getView().getPageId();
-        logger.info("scannerProcess-{}-{} coming", pageId, type);
-        DLock lock = DLock.create("scannerProcess" + pageId, ResManager.loadKDString("刷新卡片锁", "FpzsMainPlugin_153", "imc-rim-formplugin", new Object[0]));
-        Throwable var4 = null;
-
-        try {
-            int times = 0;
-            String dialogId = "scanner";
-
-            while(true) {
-                String failResultDataStr;
-                FormShowParameter failedListForm;
-                label605:
-                while(true) {
-                    do {
-                        if (times >= 30) {
-                            return;
-                        }
-
-                        ++times;
-                    } while(!lock.tryLock(500L));
-
-                    times = 100;
-                    JSONObject result = RecognitionCheckTask.queryCacheFile(pageId);
-                    logger.info("scannerProcess-{}:{}", pageId, result);
-                    boolean var43 = false;
-
-                    try {
-                        var43 = true;
-                        CustomControl customcontrol = (CustomControl)this.getControl("progressBar_customcontrol");
-                        DialogService service = new DialogService(customcontrol);
-                        Set<String> urlSet = result.keySet();
-                        Iterator<String> it = urlSet.iterator();
-                        int waiting = 0;
-                        int fail = 0;
-
-                        String repeatFlag;
-                        while(it.hasNext()) {
-                            String url = (String)it.next();
-                            repeatFlag = result.getString(url);
-                            if ("waiting".equals(repeatFlag)) {
-                                ++waiting;
-                            } else if ("fail".equals(repeatFlag)) {
-                                ++fail;
-                            }
-                        }
-
-                        int total = result.size();
-                        logger.info("scannerProcess-{} waiting:{},fail:{},total:{}", new Object[]{pageId, waiting, fail, total});
-                        JSONArray retryArray;
-                        JSONObject attachJson;
-                        JSONObject invoiceInfo;
-                        if ("dialog".equals(type) && (total == 0 || waiting == 0)) {
-                            if (total > 0) {
-                                RecognitionCheckTask.clearCacheFile(pageId);
-                            }
-
-                            if (fail > 0) {
-                                Set<String> urlSet2 = result.keySet();
-                                Iterator<String> it2 = urlSet2.iterator();
-                                retryArray = new JSONArray();
-
-                                label579:
-                                while(true) {
-                                    String url;
-                                    String status;
-                                    do {
-                                        if (!it2.hasNext()) {
-                                            if (!retryArray.isEmpty()) {
-                                                Map<String, Object> customParams = new HashMap(4);
-                                                customParams.put("retryArray", retryArray);
-                                                invoiceInfo = FpzsMainService.getBusinessParam(pageId, CollectTypeEnum.PC_UPLOAD.getCode());
-                                                customParams.put("businessParam", invoiceInfo);
-                                                FormShowParameter showParameter = this.newPage("rim_inv_recognition_retry", customParams, "retryCallback");
-                                                showParameter.setCaption(ResManager.loadKDString("识别失败重试列表", "FpzsMainPlugin_155", "imc-rim-formplugin", new Object[0]));
-                                                this.getView().showForm(showParameter);
-                                            }
-                                            break label579;
-                                        }
-
-                                        url = (String)it2.next();
-                                        status = result.getString(url);
-                                    } while(!"fail".equals(status));
-
-                                    attachJson = new JSONObject();
-                                    attachJson.put("fileUrl", url);
-                                    attachJson.put("fileName", url.substring(url.lastIndexOf(47) + 1, url.length()));
-                                    JSONObject cause = RecognitionCheckTask.queryCacheCause(pageId);
-                                    if (cause != null && StringUtils.isNotEmpty(cause.getString(url))) {
-                                        attachJson.put("failDescription", cause.getString(url));
-                                    } else {
-                                        attachJson.put("failDescription", ResManager.loadKDString("处理失败", "FpzsMainPlugin_154", "imc-rim-formplugin", new Object[0]));
-                                    }
-
-                                    retryArray.add(attachJson);
-                                }
-                            }
-
-                            if (total > 0 && fail > 0) {
-                                this.getView().showTipNotification(String.format(ResManager.loadKDString("上传%1$s个文件,处理失败%2$s个", "FpzsMainPlugin_106", "imc-rim-formplugin", new Object[0]), total, fail), 10000);
-                            } else if (total > 0) {
-                                this.getView().showSuccessNotification(String.format(ResManager.loadKDString("上传%1$s个文件,处理成功%2$s个", "FpzsMainPlugin_107", "imc-rim-formplugin", new Object[0]), total, total, 10000));
-                            }
-
-                            service.hide();
-                            repeatFlag = this.getView().getPageId() + "scannerProcessRepeat";
-                            String scannerProcessRepeat = CacheHelper.get(repeatFlag);
-                            if (StringUtils.isNotEmpty(scannerProcessRepeat) && "true".equals(scannerProcessRepeat)) {
-                                this.getView().showSuccessNotification(ResManager.loadKDString("发票已存在列表", "FpzsMainPlugin_137", "imc-rim-formplugin", new Object[0]));
-                                CacheHelper.remove(repeatFlag);
-                            }
-                        } else {
-                            String[] content = new String[]{String.format(ResManager.loadKDString("待处理文件剩余%1$s个", "FpzsMainPlugin_156", "imc-rim-formplugin", new Object[0]), waiting), String.format(ResManager.loadKDString("正在处理中(%1$s/%2$s)", "FpzsMainPlugin_157", "imc-rim-formplugin", new Object[0]), total - waiting, total)};
-                            service.show(dialogId, content, 1000);
-                        }
-
-                        JSONObject data = FpzsMainService.getInvoiceDataCache(pageId);
-                        FpzsMainService.updateInvoiceGrid(this, data);
-                        this.updateInvoiceCard(data);
-                        Map<String, String> attIdSerialMap = Maps.newLinkedHashMap();
-                        Iterator var57 = data.entrySet().iterator();
-
-                        label551:
-                        while(true) {
-                            if (var57.hasNext()) {
-                                Map.Entry<String, Object> entry = (Map.Entry)var57.next();
-                                invoiceInfo = (JSONObject)entry.getValue();
-                                List<Map<String, Object>> attachList = (List)invoiceInfo.get("attachList");
-                                if (attachList == null || attachList.size() == 0) {
-                                    continue;
-                                }
-
-                                Iterator var66 = attachList.iterator();
-
-                                while(true) {
-                                    if (!var66.hasNext()) {
-                                        continue label551;
-                                    }
-
-                                    Map<String, Object> attachInfo = (Map)var66.next();
-                                    String id = (String)attachInfo.get("id");
-                                    attIdSerialMap.put(id, invoiceInfo.getString("serialNo"));
-                                }
-                            }
-
-                            retryArray = FpzsMainService.getAttachDataCache(pageId);
-                            if (retryArray.size() != 0) {
-                                this.getModel().deleteEntryData("attach_grid_entry");
-                                this.getModel().deleteEntryData("attach_card_entry");
-                                Iterator var59 = retryArray.iterator();
-
-                                while(var59.hasNext()) {
-                                    Object attach = var59.next();
-                                    attachJson = (JSONObject)attach;
-                                    String id = attachJson.getString("id");
-                                    this.handleAttachCategory(attachJson);
-                                    Iterator var22 = attIdSerialMap.entrySet().iterator();
-
-                                    while(var22.hasNext()) {
-                                        Map.Entry<String, String> entry = (Map.Entry)var22.next();
-                                        if (id.equals(entry.getKey())) {
-                                            attachJson.put("serial_no", entry.getValue());
-                                        }
-                                    }
-
-                                    int row = this.getModel().createNewEntryRow("attach_grid_entry");
-                                    this.getModel().setValue("attachid", attachJson.get("id"), row);
-                                    this.getModel().setValue("attach_category_grid", attachJson.get("attach_category"), row);
-                                    this.getModel().setValue("attach_name", attachJson.get("attach_name"), row);
-                                    this.getModel().setValue("serial_no3", attachJson.get("serial_no"), row);
-                                    this.getModel().setValue("attach_type", attachJson.get("attach_type"), row);
-                                    this.getModel().setValue("upload_date", attachJson.getDate("create_time"), row);
-                                    this.getModel().setValue("attach_remark", attachJson.get("remark"), row);
-                                    this.getModel().setValue("attach_path", attachJson.get("attach_url"), row);
-                                    this.getModel().setValue("file_extension", attachJson.get("file_extension"), row);
-                                    this.getModel().setValue("attach_no", attachJson.get("attach_no"), row);
-                                    int attachGridIndex = this.getModel().createNewEntryRow("attach_card_entry");
-                                    String simplify_name = attachJson.getString("simplify_name");
-                                    DynamicObject attachObject;
-                                    if (StringUtils.isEmpty(simplify_name)) {
-                                        attachObject = BusinessDataServiceHelper.loadSingle(attachJson.getLong("attach_category"), "bdm_attach_type");
-                                        simplify_name = attachObject.getString("simplify_name");
-                                    }
-
-                                    this.getModel().setValue("attach_category", simplify_name, attachGridIndex);
-                                    this.getModel().setValue("attach_name_grid", attachJson.get("attach_name"), attachGridIndex);
-                                    attachObject = BusinessDataServiceHelper.newDynamicObject("rim_attach");
-                                    attachObject = DynamicObjectUtil.jsonToDynamicObject(attachJson, attachObject);
-                                    String imageUrl = this.getAttachSnapshotUrl(attachObject);
-                                    this.getModel().setValue("attach_image_grid", imageUrl, attachGridIndex);
-                                }
-                            }
-
-                            this.showFlex();
-                            var43 = false;
-                            break label605;
-                        }
-                    } catch (Exception var45) {
-                        logger.info("scannerProcess 跳过..");
-                        var43 = false;
-                    } finally {
-                        if (var43) {
-                            failResultDataStr = CacheHelper.get(this.getView().getPageId().concat("failResult"));
-                            if (StringUtils.isNotBlank(failResultDataStr)) {
-                                failedListForm = new FormShowParameter();
-                                failedListForm.setFormId("rim_inv_import_fail");
-                                failedListForm.setCustomParam("invoiceFailedList", failResultDataStr);
-                                failedListForm.getOpenStyle().setShowType(ShowType.Modal);
-                                this.getView().showForm(failedListForm);
-                                CacheHelper.remove(this.getView().getPageId().concat("failResult"));
-                            }
-
-                            lock.unlock();
-                        }
-                    }
-
-                    failResultDataStr = CacheHelper.get(this.getView().getPageId().concat("failResult"));
-                    if (StringUtils.isNotBlank(failResultDataStr)) {
-                        failedListForm = new FormShowParameter();
-                        failedListForm.setFormId("rim_inv_import_fail");
-                        failedListForm.setCustomParam("invoiceFailedList", failResultDataStr);
-                        failedListForm.getOpenStyle().setShowType(ShowType.Modal);
-                        this.getView().showForm(failedListForm);
-                        CacheHelper.remove(this.getView().getPageId().concat("failResult"));
-                    }
-
-                    lock.unlock();
-                }
-
-                failResultDataStr = CacheHelper.get(this.getView().getPageId().concat("failResult"));
-                if (StringUtils.isNotBlank(failResultDataStr)) {
-                    failedListForm = new FormShowParameter();
-                    failedListForm.setFormId("rim_inv_import_fail");
-                    failedListForm.setCustomParam("invoiceFailedList", failResultDataStr);
-                    failedListForm.getOpenStyle().setShowType(ShowType.Modal);
-                    this.getView().showForm(failedListForm);
-                    CacheHelper.remove(this.getView().getPageId().concat("failResult"));
-                }
-
-                lock.unlock();
-            }
-        } catch (Throwable var47) {
-            var4 = var47;
-            throw var47;
-        } finally {
-            if (lock != null) {
-                if (var4 != null) {
-                    try {
-                        lock.close();
-                    } catch (Throwable var44) {
-                        var4.addSuppressed(var44);
-                    }
-                } else {
-                    lock.close();
-                }
-            }
-
-        }
-    }
-
-    private void saveInvoiceDataCache(String cache) {
-        FpzsMainService.setInvoiceDataCache(this.getView().getPageId(), cache);
-    }
-
-    private void progressBarVisible(boolean visibleFlag, String[] descriptionArray) {
-        CustomControl customcontrol = (CustomControl)this.getControl("progressBar_customcontrol");
-        DialogService service = new DialogService(customcontrol);
-        if (visibleFlag) {
-            if (null != descriptionArray) {
-                service.show("1", descriptionArray, 1000);
-            } else {
-                service.show("1", new String[]{ResManager.loadKDString("进行中...", "FpzsMainPlugin_158", "imc-rim-formplugin", new Object[0])}, 1000);
-            }
-        } else {
-            service.hide();
-        }
-
-    }
-
-    private FormShowParameter newPage(String formId, Map<String, Object> customParams, String callBackId) {
-        FormShowParameter showParameter = new FormShowParameter();
-        showParameter.setShowTitle(true);
-        showParameter.setCustomParams(customParams);
-        showParameter.setFormId(formId);
-        showParameter.getOpenStyle().setShowType(ShowType.Modal);
-        if (StringUtils.isNotEmpty(callBackId)) {
-            CloseCallBack closeCallBack = new CloseCallBack(this, callBackId);
-            showParameter.setCloseCallBack(closeCallBack);
-        }
-
-        return showParameter;
-    }
-
-    private void saveVerifyResult(JSONArray invoices) {
-        if (!CollectionUtils.isEmpty(invoices)) {
-            Map<String, Object> param = FpzsMainService.getCustomParam(this);
-            VerifyStatisticsService.asyncSaveVerifyStatistics(invoices, BigDecimalUtil.transDecimal(param.get("orgId")).longValue(), (String)param.get("userId"));
-        }
-    }
-}

+ 0 - 129
src/main/java/kd/imc/rim/InvoiceCollectPluginEx.java

@@ -1,129 +0,0 @@
-package kd.imc.rim;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import kd.bos.context.RequestContext;
-import kd.bos.dataentity.serialization.SerializationUtils;
-import kd.bos.ext.form.control.CustomControl;
-import kd.bos.form.IPageCache;
-import kd.bos.form.control.events.UploadEvent;
-import kd.bos.logging.Log;
-import kd.bos.logging.LogFactory;
-import kd.bos.orm.util.CollectionUtils;
-import kd.bos.threads.ThreadPools;
-import kd.bos.util.StringUtils;
-import kd.imc.rim.common.constant.CollectTypeEnum;
-import kd.imc.rim.common.invoice.collector.InvoiceCollectTaskNew;
-import kd.imc.rim.common.service.DialogService;
-import kd.imc.rim.common.utils.BigDecimalUtil;
-import kd.imc.rim.common.utils.PermissionUtils;
-import kd.imc.rim.common.utils.RimConfigUtils;
-import kd.imc.rim.formplugin.collector.InvoiceCollectPlugin;
-
-import java.util.*;
-
-public class InvoiceCollectPluginEx extends InvoiceCollectPlugin {
-    private static Log logger = LogFactory.getLog(InvoiceCollectPluginEx.class);
-
-    @Override
-    public void afterUpload(UploadEvent evt) {
-        {
-            String itemKey = evt.getCallbackKey();
-            Object[] urls = evt.getUrls();
-            logger.info("上传文件:{}-{}", itemKey, urls);
-            if (urls.length > 0) {
-                StringJoiner taskUrls = new StringJoiner(",");
-                List<Map<String, String>> fileUrls = new ArrayList(urls.length);
-                String mapSeqStr = this.getPageCache().get("upload_seq");
-                Map<String, Object> nameSeq = new HashMap(urls.length);
-                if (StringUtils.isNotEmpty(mapSeqStr)) {
-                    nameSeq = (Map) SerializationUtils.fromJsonString(mapSeqStr, nameSeq.getClass());
-                }
-
-                int i = 0;
-
-                for(int size = urls.length; i < size; ++i) {
-                    String url = urls[i].toString();
-                    String fileName = url.substring(url.lastIndexOf(47) + 1);
-                    Map<String, String> map = new HashMap(2);
-                    map.put("url", url);
-                    map.put("name", fileName);
-                    if (!CollectionUtils.isEmpty((Map)nameSeq)) {
-                        String seq = String.valueOf(((Map)nameSeq).get(fileName));
-                        if (StringUtils.isNotEmpty(seq)) {
-                            map.put("seq", seq);
-                        }
-                    }
-
-                    fileUrls.add(map);
-                }
-
-                Collections.sort(fileUrls, (o1, o2) -> {
-                    Long uploadSeq1 = BigDecimalUtil.transDecimal(o1.get("seq")).longValue();
-                    Long uploadSeq2 = BigDecimalUtil.transDecimal(o2.get("seq")).longValue();
-                    return uploadSeq1.compareTo(uploadSeq2);
-                });
-                Iterator var14 = fileUrls.iterator();
-
-                while(var14.hasNext()) {
-                    Map<String, String> fileUrl = (Map)var14.next();
-                    taskUrls.add((CharSequence)fileUrl.get("url"));
-                }
-
-                this.getPageCache().put("upload_itemKey", itemKey);
-                this.getPageCache().remove("upload_seq");
-                this.getPageCache().put("taskUrls", taskUrls.toString());
-                this.progressBarVisible(Boolean.TRUE, new String[]{"进行中..."});
-                this.getPageCache().put("startprogress", "true");
-                JSONObject businessParam = this.getBusinessParam(CollectTypeEnum.PC_UPLOAD.getCode());
-                businessParam.put("itemKey", itemKey);
-                InvoiceCollectTaskNew collectTask = new InvoiceCollectTaskNew(RequestContext.get(), this.getView().getPageId(), fileUrls, businessParam);
-                ThreadPools.executeOnce("CollectorProgressPool", collectTask);
-            }
-
-        }
-    }
-    private JSONObject getBusinessParam(String collectType) {
-        JSONObject businessParam = new JSONObject();
-        IPageCache pageCache = this.getView().getPageCache();
-        String businessParamCache = pageCache.get("businessParam");
-        if (businessParamCache != null) {
-            businessParam = JSON.parseObject(businessParamCache);
-        } else {
-            RequestContext request = RequestContext.get();
-            businessParam.put("collect_type", collectType);
-            businessParam.put("resource", "收票管理");
-            businessParam.put("isAdmin", PermissionUtils.checkPermission(request.getUserId(), request.getOrgId(), this.getView(), "1PAFGP5MO1NU"));
-            String state = RimConfigUtils.getConfig("original_state");
-            if ("1".equals(state)) {
-                businessParam.put("originalState", "1");
-            }
-
-            Map<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
-            if (!CollectionUtils.isEmpty(customParams)) {
-                businessParam.putAll(customParams);
-            }
-
-            businessParam.put("billType", "fpqs");
-            pageCache.put("businessParam", businessParam.toJSONString());
-        }
-
-        logger.info("发票签收采集参数:" + businessParam);
-        return businessParam;
-    }
-
-    private void progressBarVisible(Boolean visibleFlag, String[] descriptionArray) {
-        CustomControl customcontrol = (CustomControl)this.getControl("progressBar_customcontrol");
-        DialogService service = new DialogService(customcontrol);
-        if (visibleFlag) {
-            if (null != descriptionArray) {
-                service.show("1", descriptionArray, 500);
-            } else {
-                service.show("1", new String[]{"进行中..."}, 500);
-            }
-        } else {
-            service.hide();
-        }
-
-    }
-}

+ 0 - 1182
src/main/java/kd/imc/rim/RecognitionCheckHelperEx.java

@@ -1,1182 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by FernFlower decompiler)
-//
-
-package kd.imc.rim;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Maps;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-import kd.bos.context.RequestContext;
-import kd.bos.dataentity.entity.DynamicObject;
-import kd.bos.dataentity.entity.DynamicObjectCollection;
-import kd.bos.dataentity.resource.ResManager;
-import kd.bos.dataentity.utils.StringUtils;
-import kd.bos.fileservice.FileServiceFactory;
-import kd.bos.logging.Log;
-import kd.bos.logging.LogFactory;
-import kd.bos.orm.query.QFilter;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
-import kd.bos.servicehelper.QueryServiceHelper;
-import kd.bos.servicehelper.operation.SaveServiceHelper;
-import kd.imc.aws.ofd.util.analysis.OfdReadUtils;
-import kd.imc.aws.ofd.util.model.VatInvoice;
-import kd.imc.rim.common.constant.AttachConstant;
-import kd.imc.rim.common.constant.FpzsConstant;
-import kd.imc.rim.common.constant.InputInvoiceTypeEnum;
-import kd.imc.rim.common.invoice.checknew.model.CheckParam;
-import kd.imc.rim.common.invoice.checknew.model.CheckResult;
-import kd.imc.rim.common.invoice.collector.InvoiceCollectService;
-import kd.imc.rim.common.invoice.model.ConvertFieldUtil;
-import kd.imc.rim.common.invoice.model.type.OtherInvoice;
-import kd.imc.rim.common.invoice.recognitionnew.RecognitionFactory;
-import kd.imc.rim.common.invoice.recognitionnew.model.RecognitionParam;
-import kd.imc.rim.common.invoice.recognitionnew.model.RecognitionResult;
-import kd.imc.rim.common.message.exception.MsgException;
-import kd.imc.rim.common.service.SimplyCheckService;
-import kd.imc.rim.common.utils.BigDecimalUtil;
-import kd.imc.rim.common.utils.CacheHelper;
-import kd.imc.rim.common.utils.DateUtils;
-import kd.imc.rim.common.utils.DynamicObjectUtil;
-import kd.imc.rim.common.utils.FileUtils;
-import kd.imc.rim.common.utils.FormFileEntity;
-import kd.imc.rim.common.utils.ImcConfigUtil;
-import kd.imc.rim.common.utils.InvoiceConvertUtils;
-import kd.imc.rim.common.utils.MD5;
-import kd.imc.rim.common.utils.MetadataUtil;
-import kd.imc.rim.common.utils.RimConfigUtils;
-import kd.imc.rim.common.utils.TenantUtils;
-import kd.imc.rim.common.utils.UUID;
-import kd.imc.rim.common.utils.itextpdf.ItextPdfUtils;
-import kd.imc.rim.common.utils.itextpdf.UrlServiceUtils;
-import kd.imc.rim.file.utils.FileConvertUtils;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.compress.utils.Lists;
-
-public class RecognitionCheckHelperEx {
-    private static Log logger = LogFactory.getLog(RecognitionCheckHelperEx.class);
-    private static final String awsRecognitionImpl = "kd.imc.rim.AwsRecognitionServiceEx";
-    private static final String HANGXINCHECKSERIVCESTR = "kd.imc.rim.common.invoice.checknew.impl.HangxinCheckService";
-    private InvoiceCollectService invoiceCollectService = new InvoiceCollectService();
-
-    public RecognitionCheckHelperEx() {
-    }
-
-    public List<JSONObject> recognitionInvoiceFile(FormFileEntity fileEntity, Map<String, Object> extMap) throws Exception {
-        List<JSONObject> resultList = Lists.newArrayList();
-        List<FormFileEntity> fileEntityList = fileEntity.getSubFileList();
-        if (fileEntityList == null || ((List)fileEntityList).isEmpty()) {
-            fileEntityList = new ArrayList(1);
-            ((List)fileEntityList).add(fileEntity);
-        }
-
-        int pageNo = 0;
-        Map<String, String> configMap = ImcConfigUtil.getValue("rim_recog_check");
-        String recognitionImplStr = (String)configMap.get("rimpl");
-        boolean isAwsRecognition = StringUtils.isEmpty(recognitionImplStr) || "kd.imc.rim.AwsRecognitionServiceEx".equals(recognitionImplStr);
-        String cachhour = (String)configMap.get("cache_hour");
-        int cacheHour = 24;
-        if (!StringUtils.isEmpty(cachhour)) {
-            cacheHour = BigDecimalUtil.transDecimal(configMap.get("cache_hour")).intValue();
-            if (cacheHour < 0) {
-                cacheHour = 0;
-            }
-        }
-
-        String overseaAppCode = this.getOverseaAppCode(configMap);
-        Iterator var12 = ((List)fileEntityList).iterator();
-
-        while(var12.hasNext()) {
-            FormFileEntity entity = (FormFileEntity)var12.next();
-            ++pageNo;
-            String fileName = entity.getFileName();
-            InputStream fileInputStream = UrlServiceUtils.getAttachmentDecodedStream(FileServiceFactory.getAttachmentFileService().getInputStream(entity.getFileUrl()));
-            Throwable var16 = null;
-
-            try {
-                if (((List)fileEntityList).isEmpty()) {
-                    fileEntity.setFileSize(fileInputStream.available());
-                }
-
-                byte[] streamByte = FileUtils.getByte(fileInputStream);
-                String fileHash = FileConvertUtils.getSHA256(streamByte);
-                long threadCount = 0L;
-                boolean exceptionDecr = false;
-                int countTimeOut = 60;
-
-                try {
-                    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(streamByte);
-                    Throwable var24 = null;
-
-                    try {
-                        RecognitionParam recognitionParam = new RecognitionParam(byteArrayInputStream, extMap);
-                        recognitionParam.setFileName(fileName);
-                        recognitionParam.setLocalUrl(fileEntity.getFileUrl());
-                        recognitionParam.setLocalHash(fileEntity.getFileHash());
-                        recognitionParam.setRecogConfigMap(configMap);
-                        if (StringUtils.isEmpty(recognitionParam.getLocalHash())) {
-                            recognitionParam.setLocalHash(fileHash);
-                        }
-
-                        recognitionParam.setFileUrl(entity.getFileUrl());
-                        recognitionParam.setPageNo(pageNo);
-                        recognitionParam.setCacheHour(cacheHour);
-                        if (extMap.get("recogType") != null) {
-                            recognitionParam.setRecogType(extMap.get("recogType").toString());
-                            recognitionParam.setAppCode(overseaAppCode);
-                        }
-
-                        RecognitionResult recognitionResult = new RecognitionResult();
-                        JSONObject analysisInvoiceInfo = entity.getInvoiceInfo();
-                        boolean resultFlag = false;
-                        boolean isMore = false;
-                        if (analysisInvoiceInfo != null) {
-                            Object invoice = analysisInvoiceInfo.get("invoice");
-                            if (invoice == null) {
-                                invoice = analysisInvoiceInfo;
-                            } else {
-                                isMore = true;
-                            }
-
-                            resultFlag = this.getValidateFlag(invoice);
-                        }
-
-                        if (resultFlag) {
-                            List entityList = Lists.newArrayList();
-                            JSONArray invoiceArray = new JSONArray();
-                            if (isMore) {
-                                invoiceArray.addAll(analysisInvoiceInfo.getJSONArray("invoice"));
-                            } else {
-                                invoiceArray.add(analysisInvoiceInfo);
-                            }
-
-                            String itemsKey = "items";
-                            ConvertFieldUtil.convertRecognitionEntity(entityList, invoiceArray, new String[]{itemsKey, "item"});
-                            recognitionResult.setErrcode("0000");
-                            recognitionResult.setData(entityList);
-                            logger.info("识别结果取pdf解析..");
-                        } else {
-                            exceptionDecr = true;
-                            threadCount = CacheHelper.inc("recogThread", countTimeOut);
-                            logger.info("识别线程数量{}", threadCount);
-                            recognitionResult = RecognitionFactory.getRecognitionService("kd.imc.rim.AwsRecognitionServiceEx").recognitionInvoice(recognitionParam);
-                            threadCount = CacheHelper.decr("recogThread", countTimeOut);
-                            exceptionDecr = false;
-                        }
-
-                        if (recognitionResult != null) {
-                            if (!"0000".equals(recognitionResult.getErrcode())) {
-                                StringBuilder sb = this.getMsgExceptionInfo(recognitionResult);
-                                throw new MsgException(sb.toString());
-                            }
-
-                            List<Object> recognitionDataList = recognitionResult.getData();
-                            String salelistposturl = (String)configMap.get("salelistposturl");
-                            if (!StringUtils.isEmpty(salelistposturl)) {
-                                ByteArrayInputStream saleListByteArrayStream = new ByteArrayInputStream(streamByte);
-                                Throwable var33 = null;
-
-                                try {
-                                    RecognitionParam saleListParam = new RecognitionParam(saleListByteArrayStream, extMap);
-                                    saleListParam.setFileName(fileName);
-                                    saleListParam.setRecogConfigMap(configMap);
-                                    this.saleListRecognition(recognitionDataList, saleListParam);
-                                } catch (Throwable var80) {
-                                    var33 = var80;
-                                    throw var80;
-                                } finally {
-                                    if (saleListByteArrayStream != null) {
-                                        if (var33 != null) {
-                                            try {
-                                                saleListByteArrayStream.close();
-                                            } catch (Throwable var79) {
-                                                var33.addSuppressed(var79);
-                                            }
-                                        } else {
-                                            saleListByteArrayStream.close();
-                                        }
-                                    }
-
-                                }
-                            }
-
-                            this.supRecognitionInfo(recognitionDataList, isAwsRecognition, fileHash, fileName, pageNo, resultList, configMap);
-                        }
-                    } catch (Throwable var82) {
-                        var24 = var82;
-                        throw var82;
-                    } finally {
-                        if (byteArrayInputStream != null) {
-                            if (var24 != null) {
-                                try {
-                                    byteArrayInputStream.close();
-                                } catch (Throwable var78) {
-                                    var24.addSuppressed(var78);
-                                }
-                            } else {
-                                byteArrayInputStream.close();
-                            }
-                        }
-
-                    }
-                } catch (Throwable var84) {
-                    if (exceptionDecr && threadCount > 0L) {
-                        threadCount = CacheHelper.decr("recogThread", countTimeOut);
-                    }
-
-                    logger.error("ByteArrayInputStream error:", var84);
-                    throw var84;
-                }
-            } catch (Throwable var85) {
-                var16 = var85;
-                throw var85;
-            } finally {
-                if (fileInputStream != null) {
-                    if (var16 != null) {
-                        try {
-                            fileInputStream.close();
-                        } catch (Throwable var77) {
-                            var16.addSuppressed(var77);
-                        }
-                    } else {
-                        fileInputStream.close();
-                    }
-                }
-
-            }
-        }
-
-        return resultList;
-    }
-
-    private boolean getValidateFlag(Object analysisInvoiceInfo) {
-        if (analysisInvoiceInfo == null) {
-            return false;
-        } else {
-            boolean resultFlag = false;
-            if (analysisInvoiceInfo instanceof JSONObject) {
-                resultFlag = InputInvoiceTypeEnum.ELECTRIC_ORDINARY.getCode().equals(((JSONObject)analysisInvoiceInfo).getLong("invoiceType")) || InputInvoiceTypeEnum.ELECTRIC_SPECIAL.getCode().equals(((JSONObject)analysisInvoiceInfo).getLong("invoiceType"));
-                if (!resultFlag) {
-                    resultFlag = this.checkParamValidate((JSONObject)analysisInvoiceInfo);
-                }
-            } else if (analysisInvoiceInfo instanceof JSONArray) {
-                JSONArray array = (JSONArray)analysisInvoiceInfo;
-
-                for(int i = 0; i < array.size(); ++i) {
-                    resultFlag = InputInvoiceTypeEnum.ELECTRIC_ORDINARY.getCode().equals(array.getJSONObject(i).getLong("invoiceType")) || InputInvoiceTypeEnum.ELECTRIC_SPECIAL.getCode().equals(array.getJSONObject(i).getLong("invoiceType"));
-                    if (!resultFlag) {
-                        resultFlag = this.checkParamValidate(array.getJSONObject(i));
-                        if (!resultFlag) {
-                            return false;
-                        }
-                    }
-                }
-            } else if (analysisInvoiceInfo instanceof ArrayList) {
-                List<Map<String, Object>> list = (List)analysisInvoiceInfo;
-                Iterator var7 = list.iterator();
-
-                while(var7.hasNext()) {
-                    Map<String, Object> map = (Map)var7.next();
-                    resultFlag = InputInvoiceTypeEnum.ELECTRIC_ORDINARY.getCode().equals(Long.parseLong(map.get("invoiceType") + "")) || InputInvoiceTypeEnum.ELECTRIC_SPECIAL.getCode().equals(Long.parseLong(map.get("invoiceType") + ""));
-                    if (!resultFlag) {
-                        resultFlag = this.checkParamValidate(new JSONObject(map));
-                        if (!resultFlag) {
-                            return false;
-                        }
-                    }
-                }
-            }
-
-            return resultFlag;
-        }
-    }
-
-    public boolean checkParamValidate(JSONObject invoice) {
-        String invoiceCode = invoice.getString("invoiceCode");
-        String invoiceNo = invoice.getString("invoiceNo");
-        String invoiceAmount = invoice.getString("invoiceAmount");
-        String invoiceDate = invoice.getString("invoiceDate");
-        boolean validate = StringUtils.isNotEmpty(invoiceCode) && StringUtils.isNotEmpty(invoiceNo) && StringUtils.isNotEmpty(invoiceAmount) && StringUtils.isNotEmpty(invoiceDate);
-        Long invoiceType = invoice.getLong("invoiceType");
-        if (!InputInvoiceTypeEnum.ORDINARY_ELECTRON.getCode().equals(invoiceType) && !InputInvoiceTypeEnum.ORDINARY_PAPER.getCode().equals(invoiceType) && !InputInvoiceTypeEnum.ORDINARY_ROLL.getCode().equals(invoiceType) && !InputInvoiceTypeEnum.TOLL_ELECTRON.getCode().equals(invoiceType)) {
-            return validate;
-        } else {
-            String checkCode = invoice.getString("checkCode");
-            return validate && StringUtils.isNotEmpty(checkCode);
-        }
-    }
-
-    private String getOverseaAppCode(Map<String, String> configMap) {
-        if (configMap == null) {
-            return null;
-        } else {
-            String appCode = (String)configMap.get("overappkey");
-            String appSect = (String)configMap.get("overappsecret");
-            if (!StringUtils.isEmpty(appCode) && !StringUtils.isEmpty(appSect)) {
-                String code = appCode + "@@@" + appSect;
-                String retStr = Base64.encodeBase64String(code.getBytes());
-                return retStr;
-            } else {
-                return null;
-            }
-        }
-    }
-
-    private void saleListRecognition(List<Object> recognitionDataList, RecognitionParam recognitionParam) {
-        List<Object> resultList = Lists.newArrayList();
-        recognitionDataList.stream().forEach((f) -> {
-            if (f instanceof OtherInvoice) {
-                OtherInvoice otherInvoice = (OtherInvoice)f;
-                String invoiceCode = otherInvoice.getInvoiceCode();
-                String invoiceNo = otherInvoice.getInvoiceNo();
-                boolean emptyCheck = StringUtils.isNotEmpty(invoiceCode) && StringUtils.isNotEmpty(invoiceNo);
-                boolean titleCheck = StringUtils.isNotEmpty(otherInvoice.getTitle()) && otherInvoice.getTitle().contains("清单");
-                if (emptyCheck && titleCheck) {
-                    try {
-                        List<JSONObject> saleListRecognitionList = this.saleListPost(recognitionParam);
-                        Iterator var10 = saleListRecognitionList.iterator();
-
-                        while(var10.hasNext()) {
-                            JSONObject saleList = (JSONObject)var10.next();
-                            String saleListCode = saleList.getString("invoiceCode");
-                            String saleListNo = saleList.getString("invoiceNo");
-                            String saleListPageNum = saleList.getString("pageNum");
-                            if (invoiceCode.equals(saleListCode) && invoiceNo.equals(saleListNo)) {
-                                otherInvoice.setPageNum(saleListPageNum);
-                            }
-                        }
-                    } catch (Exception var15) {
-                        logger.info("销货清单识别出错:", var15);
-                    }
-                }
-            }
-
-            resultList.add(f);
-        });
-    }
-
-    private List<JSONObject> saleListPost(RecognitionParam recognitionParam) throws Exception {
-        RecognitionResult recognitionResult = RecognitionFactory.getSaleListRecognitionService().recognitionInvoice(recognitionParam);
-        if (recognitionResult != null && "0000".equals(recognitionResult.getErrcode())) {
-            List<JSONObject> data = recognitionResult.getData();
-            return (List)data.stream().filter((f) -> {
-                String invoiceCode = f.getString("invoiceCode");
-                String invoiceNo = f.getString("invoiceNo");
-                String pageNum = f.getString("pageNum");
-                return StringUtils.isNotEmpty(invoiceCode) && StringUtils.isNotEmpty(invoiceNo) && StringUtils.isNotEmpty(pageNum);
-            }).collect(Collectors.toList());
-        } else {
-            return Lists.newArrayList();
-        }
-    }
-
-    private StringBuilder getMsgExceptionInfo(RecognitionResult recognitionResult) {
-        StringBuilder sb = new StringBuilder();
-        String str = String.format(ResManager.loadKDString("识别失败,识别接口返回:【%1$s】%2$s", "RecognitionCheckHelper_1", "imc-rim-common", new Object[0]), recognitionResult.getErrcode(), recognitionResult.getDescription());
-        sb.append(str);
-        return sb;
-    }
-
-    private void supRecognitionInfo(List<Object> recognitionDataList, boolean isAwsRecognition, String fileHash, String fileName, int pageNo, List<JSONObject> resultList, Map<String, String> configMap) throws ParseException {
-        if (recognitionDataList != null && recognitionDataList.size() != 0) {
-            String otherMust = ImcConfigUtil.getValue(configMap, "other_must", "0");
-            Iterator var9 = recognitionDataList.iterator();
-
-            while(true) {
-                Object object;
-                JSONObject recognitionInfo;
-                do {
-                    do {
-                        if (!var9.hasNext()) {
-                            return;
-                        }
-
-                        object = var9.next();
-                    } while(object == null);
-
-                    String invoiceStr = JSONObject.toJSONString(object);
-                    recognitionInfo = JSON.parseObject(invoiceStr);
-                } while(recognitionInfo == null);
-
-                this.setMaxAmount(recognitionInfo);
-                this.dealElectric(recognitionInfo);
-                this.dealBlockChain(recognitionInfo);
-                boolean isPass = false;
-                Long invoiceType;
-                String invoiceCode;
-                if (object.getClass() != null) {
-                    invoiceType = recognitionInfo.getLong("invoiceType");
-                    String exit;
-                    if (InputInvoiceTypeEnum.AIR_INVOICE.getCode().equals(invoiceType)) {
-                        invoiceCode = recognitionInfo.getString("invoiceDate");
-                        exit = recognitionInfo.getString("issueDate");
-                        if (StringUtils.isNotBlank(exit)) {
-                            Date date = recognitionInfo.getDate("issueDate");
-                            if (StringUtils.isEmpty(invoiceCode) || "OPEN".equalsIgnoreCase(invoiceCode)) {
-                                recognitionInfo.put("invoiceDate", DateUtils.format(date, "yyyy-MM-dd"));
-                            }
-                        }
-                    }
-
-                    isPass = ConvertFieldUtil.checkNullValidate(recognitionInfo, object.getClass());
-                    if (isPass && InputInvoiceTypeEnum.ROAD_BRIDGE.getCode().equals(invoiceType)) {
-                        invoiceCode = recognitionInfo.getString("invoiceCode");
-                        exit = recognitionInfo.getString("exit");
-                        if (StringUtils.isEmpty(invoiceCode) && StringUtils.isEmpty(exit)) {
-                            isPass = false;
-                        }
-                    }
-
-                    if (isPass && InputInvoiceTypeEnum.OTHER_INVOICE.getCode().equals(invoiceType)) {
-                        if ("1".equals(otherMust) && StringUtils.isEmpty(recognitionInfo.getString("invoiceNo"))) {
-                            isPass = false;
-                        }
-
-                        if ("2".equals(otherMust) && (StringUtils.isEmpty(recognitionInfo.getString("invoiceNo")) || StringUtils.isEmpty(recognitionInfo.getString("invoiceCode")))) {
-                            isPass = false;
-                        }
-                    }
-                }
-
-                if (!isPass) {
-                    recognitionInfo.remove("serialNo");
-                }
-
-                if (isPass && StringUtils.isEmpty(recognitionInfo.getString("serialNo"))) {
-                    recognitionInfo.put("serialNo", UUID.randomUUID());
-                }
-
-                invoiceType = recognitionInfo.getLong("invoiceType");
-                invoiceCode = recognitionInfo.getString("currency_code");
-                recognitionInfo.put("currency", InvoiceConvertUtils.changeCurrency(invoiceCode));
-                if (!isAwsRecognition) {
-                    this.setOtherInfoByType(invoiceType, recognitionInfo);
-                }
-
-                if (!InvoiceConvertUtils.isVatInvoiceType(invoiceType)) {
-                    recognitionInfo.put("checkStatus", "1");
-                    this.recognitionInvoiceMix(recognitionInfo, invoiceType);
-                }
-
-                if (InvoiceConvertUtils.isSaleListInvoiceType(invoiceType)) {
-                    markSaleListInvoice(recognitionInfo);
-                }
-
-                recognitionInfo.put("fileHash", fileHash);
-                recognitionInfo.put("pageNo", pageNo);
-                recognitionInfo.put("fileName", fileName);
-                resultList.add(recognitionInfo);
-            }
-        }
-    }
-
-    private void setMaxAmount(JSONObject recognitionInfo) {
-        Set<Map.Entry<String, Object>> entries = recognitionInfo.entrySet();
-        Iterator var3 = entries.iterator();
-
-        while(var3.hasNext()) {
-            Map.Entry<String, Object> object = (Map.Entry)var3.next();
-            Object valueObj = object.getValue();
-            if (valueObj instanceof BigDecimal) {
-                String valueObjStr = valueObj.toString().replace("-", "");
-                if (BigDecimalUtil.transDecimal(valueObjStr).compareTo(FpzsConstant.sysMaxAmount) > 0) {
-                     valueObj = BigDecimal.ZERO;
-                    logger.info("发票{} 超过系统金额最大值:{} 置为0", object.getKey(), FpzsConstant.sysMaxAmount);
-                    recognitionInfo.put((String)object.getKey(), valueObj);
-                }
-            }
-        }
-
-    }
-
-    private void dealBlockChain(JSONObject recognitionInfo) {
-        String checkImplStr = RimConfigUtils.getConfig("rim_recog_check", "cimpl");
-        boolean isHangxinCheck = "kd.imc.rim.common.invoice.checknew.impl.HangxinCheckService".equals(checkImplStr);
-        boolean isBlockChainType = InvoiceConvertUtils.isBlockChainType(recognitionInfo.getString("invoiceCode"), recognitionInfo.getString("invoiceNo"));
-        boolean isYunnanChainType = InvoiceConvertUtils.isYunNanBlockchain(recognitionInfo.getString("invoiceCode"), recognitionInfo.getString("invoiceNo"));
-        if (isHangxinCheck && (isBlockChainType || isYunnanChainType)) {
-            recognitionInfo.put("invoiceType", InputInvoiceTypeEnum.GENERAL_ELECTRON.getCode());
-        }
-
-    }
-
-    public static void markSaleListInvoice(JSONObject recognitionInfo) {
-        JSONArray items = recognitionInfo.getJSONArray("items");
-        recognitionInfo.put("isSaleListInvoice", "0");
-        if (items != null && items.size() == 1) {
-            String goodsName = items.getJSONObject(0).getString("goodsName");
-            if (StringUtils.isNotEmpty(goodsName) && goodsName.contains("详见") && goodsName.contains("清单")) {
-                recognitionInfo.put("isSaleListInvoice", "1");
-            }
-        }
-
-    }
-
-    private void dealElectric(JSONObject recognitionInfo) {
-        String invoiceNo = recognitionInfo.getString("invoiceNo");
-        String invoiceCode = recognitionInfo.getString("invoiceCode");
-        Long invoiceType = recognitionInfo.getLong("invoiceType");
-        if (StringUtils.isNotEmpty(invoiceNo) && invoiceNo.length() == 20 && InputInvoiceTypeEnum.ORDINARY_ROLL.getCode().equals(invoiceType) && StringUtils.isEmpty(invoiceCode)) {
-            recognitionInfo.put("invoiceType", InputInvoiceTypeEnum.ELECTRIC_SPECIAL.getCode());
-            String serialNo = recognitionInfo.getString("serialNo");
-            if (StringUtils.isEmpty(serialNo)) {
-                recognitionInfo.put("serialNo", UUID.randomUUID());
-            }
-        }
-
-    }
-
-    public FormFileEntity getFormFileEntity(String url, String fileName) throws IOException {
-        FormFileEntity fileEntity = new FormFileEntity(url, fileName);
-        if (FileUtils.checkFileType(fileName, new String[]{"pdf"})) {
-            return ItextPdfUtils.extractpdf(url, fileName);
-        } else {
-            if (FileUtils.checkFileType(fileName, new String[]{"ofd"})) {
-                JSONObject result = (JSONObject) this.ofdAnalysis(url);
-                if (result != null) {
-                    fileEntity.setFileSize(BigDecimalUtil.transDecimal(result.getString("fileSize")).intValue());
-                }
-
-                fileEntity.setInvoiceInfo(result);
-                fileEntity.setFileType("ofd");
-                fileEntity.setSignatureFlag(Boolean.TRUE);
-            } else {
-                fileEntity.setFileType(FileUtils.getFileType(fileName));
-            }
-
-            return fileEntity;
-        }
-    }
-
-    private Serializable ofdAnalysis(String fileUrl) {
-        try {
-            InputStream fileInputStream = UrlServiceUtils.getAttachmentDecodedStream(FileServiceFactory.getAttachmentFileService().getInputStream(fileUrl));
-            Throwable var3 = null;
-
-            Long invoiceType;
-            try {
-                byte[] streamByte = FileUtils.getByte(fileInputStream);
-                JSONObject result;
-                if (streamByte == null) {
-                    result = null;
-                    return null;
-                }
-
-                result = OfdReadUtils.readData(streamByte);
-                Object invoice = result.get("invoice");
-                VatInvoice vatInvoice = (VatInvoice)invoice;
-                result = JSON.parseObject(JSON.toJSONString(vatInvoice));
-                if (vatInvoice != null) {
-                    invoiceType = InputInvoiceTypeEnum.getInvoiceTypeByAwsType(vatInvoice.getInvoiceType());
-                    result.put("invoiceType", invoiceType);
-                    result.put("fileSize", streamByte.length);
-                    JSONObject var9 = result;
-                    return var9;
-                }
-
-                invoiceType = null;
-            } catch (Throwable var21) {
-                var3 = var21;
-                throw var21;
-            } finally {
-                if (fileInputStream != null) {
-                    if (var3 != null) {
-                        try {
-                            fileInputStream.close();
-                        } catch (Throwable var20) {
-                            var3.addSuppressed(var20);
-                        }
-                    } else {
-                        fileInputStream.close();
-                    }
-                }
-
-            }
-
-            return invoiceType;
-        } catch (Exception var23) {
-            logger.info("ofdAnalysis exception :{}", var23);
-            return null;
-        }
-    }
-
-    public Map<String, Object> getRecognitionCheckExtMap(JSONObject businessParam) {
-        Map<String, Object> extMap = Maps.newHashMap();
-        Long orgId = RequestContext.get().getOrgId();
-        if (businessParam != null) {
-            if (businessParam.getLong("org_id") != null) {
-                orgId = businessParam.getLong("org_id");
-            }
-
-            extMap.put("recogType", businessParam.getString("recogType"));
-        }
-
-        String taxNo = TenantUtils.getTaxNoByOrgId(orgId);
-        extMap.put("eid", RequestContext.get().getUserId());
-        extMap.put("orgId", orgId);
-        extMap.put("taxNo", taxNo);
-        return extMap;
-    }
-
-    public List<JSONObject> checkInvoiceByRecognitionInfo(List<JSONObject> recognitionResultList, Map<String, Object> extMap) {
-        if (recognitionResultList != null && recognitionResultList.size() != 0) {
-            List<JSONObject> checkResultList = Lists.newArrayList();
-            Iterator var5 = recognitionResultList.iterator();
-
-            while(true) {
-                while(var5.hasNext()) {
-                    JSONObject invoiceInfo = (JSONObject)var5.next();
-                    JSONObject result = invoiceInfo;
-                    Long invoiceType = invoiceInfo.getLong("invoiceType");
-                    if (!InputInvoiceTypeEnum.needCheck(invoiceType)) {
-                        checkResultList.add(invoiceInfo);
-                    } else {
-                        CheckParam checkParam = ConvertFieldUtil.getInvoiceCheckPart(invoiceInfo);
-                        if (checkParam != null) {
-                            try {
-                                Long orgId = (Long)extMap.get("orgId");
-                                String taxNo = (String)extMap.get("taxNo");
-                                CheckResult checkResult = SimplyCheckService.checkInvoice(checkParam, orgId, taxNo);
-                                if ("0000".equals(checkResult.getErrcode()) && checkResult.getData() != null) {
-                                    Object invoiceEntity = checkResult.getData();
-                                    String invoiceCheckStr = JSONObject.toJSONString(invoiceEntity);
-                                    JSONObject invoiceCheckInfo = JSON.parseObject(invoiceCheckStr);
-                                    this.putRecognitionInfo(invoiceCheckInfo, invoiceInfo);
-                                    if (InputInvoiceTypeEnum.AIR_ELE_INVOICE.getCode().equals(invoiceType)) {
-                                        invoiceInfo.putAll(invoiceCheckInfo);
-                                        invoiceCheckInfo = this.mixAirEleData(invoiceInfo);
-                                    }
-
-                                    result = invoiceCheckInfo;
-                                    String originalStateDefault = (String)extMap.get("originalStateDefault");
-                                    boolean typeFlag = InputInvoiceTypeEnum.ORDINARY_ELECTRON.getCode().equals(invoiceType) || InputInvoiceTypeEnum.TOLL_ELECTRON.getCode().equals(invoiceType) || InputInvoiceTypeEnum.SPECIAL_ELECTRON.getCode().equals(invoiceType);
-                                    if ("1".equals(originalStateDefault) && typeFlag) {
-                                        invoiceCheckInfo.put("originalState", "1");
-                                    }
-                                } else {
-                                    result = invoiceInfo;
-                                    invoiceInfo.put("checkStatus", "2");
-                                    invoiceInfo.put("errcode", checkResult.getErrcode());
-                                    invoiceInfo.put("description", checkResult.getDescription());
-                                }
-                            } catch (Exception var17) {
-                                logger.info("查验步骤报错:", var17);
-                                invoiceInfo.put("checkStatus", "2");
-                            }
-
-                            checkResultList.add(result);
-                        }
-                    }
-                }
-
-                return checkResultList;
-            }
-        } else {
-            return null;
-        }
-    }
-
-    private JSONObject mixAirEleData(JSONObject invoiceInfo) {
-        if (invoiceInfo == null) {
-            return new JSONObject();
-        } else {
-            Object issueDate = invoiceInfo.get("issueDate");
-            if (issueDate instanceof Integer) {
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-
-                try {
-                    Date date = sdf.parse(String.valueOf(issueDate));
-                    invoiceInfo.put("invoiceDate", date);
-                    invoiceInfo.put("issueDate", date);
-                } catch (ParseException var5) {
-                }
-            }
-
-            return invoiceInfo;
-        }
-    }
-
-    public static void markSaleListByCheckResult(JSONObject invoiceCheckInfo) {
-        invoiceCheckInfo.put("isSaleListInvoice", "0");
-        JSONArray items = invoiceCheckInfo.getJSONArray("items");
-        if (items != null && items.size() > 8) {
-            invoiceCheckInfo.put("isSaleListInvoice", "1");
-            putSaleListSum(invoiceCheckInfo);
-        }
-
-    }
-
-    private JSONObject putRecognitionInfo(JSONObject invoiceCheckInfo, JSONObject recognitionInfo) {
-        invoiceCheckInfo.put("continuousNo", recognitionInfo.get("continuousNo"));
-        invoiceCheckInfo.put("currency", recognitionInfo.get("currency"));
-        invoiceCheckInfo.put("barcode", recognitionInfo.get("barcode"));
-        invoiceCheckInfo.put("qrcode", recognitionInfo.get("qrcode"));
-        invoiceCheckInfo.put("companySeal", recognitionInfo.get("companySeal"));
-        invoiceCheckInfo.put("region", recognitionInfo.get("region"));
-        invoiceCheckInfo.put("rotationAngle", recognitionInfo.get("rotationAngle"));
-        invoiceCheckInfo.put("pixel", recognitionInfo.get("pixel"));
-        invoiceCheckInfo.put("pageNo", recognitionInfo.get("pageNo"));
-        invoiceCheckInfo.put("fileName", recognitionInfo.get("fileName"));
-        String checkStatus = invoiceCheckInfo.getString("checkStatus");
-        String recognitionSaleList = recognitionInfo.getString("isSaleListInvoice");
-        String checkSaleList = invoiceCheckInfo.getString("isSaleListInvoice");
-        if ("1".equals(recognitionSaleList) || "1".equals(checkSaleList)) {
-            invoiceCheckInfo.put("isSaleListInvoice", "1");
-            if (!"1".equals(checkSaleList)) {
-                putSaleListSum(invoiceCheckInfo);
-            }
-        }
-
-        if (StringUtils.isEmpty(checkStatus)) {
-            invoiceCheckInfo.put("checkStatus", "1");
-            checkStatus = "1";
-        }
-
-        Long invoiceType = recognitionInfo.getLong("invoiceType");
-        if ((InputInvoiceTypeEnum.ORDINARY_PAPER.getCode().equals(invoiceType) || InputInvoiceTypeEnum.SPECIAL_PAPER.getCode().equals(invoiceType)) && "1".equals(checkStatus) && "1".equals(invoiceCheckInfo.getString("proxyMark"))) {
-            invoiceCheckInfo.put("companySeal", "1");
-        }
-
-        return invoiceCheckInfo;
-    }
-
-    private static void putSaleListSum(JSONObject invoiceInfo) {
-        int pageSum = 0;
-        String attachNo = invoiceInfo.getString("invoiceCode") + "_" + invoiceInfo.getString("invoiceNo");
-        QFilter qFilter = new QFilter("attach_no", "=", attachNo);
-        String attachFields = MetadataUtil.getFields("rim_attach");
-        DynamicObject[] attachCollect = BusinessDataServiceHelper.load("rim_attach", attachFields, new QFilter[]{qFilter});
-        if (attachCollect != null && attachCollect.length > 0) {
-            DynamicObject[] var6 = attachCollect;
-            int var7 = attachCollect.length;
-
-            for(int var8 = 0; var8 < var7; ++var8) {
-                DynamicObject attachInfo = var6[var8];
-                if (attachInfo.getInt("page_sum") != 0) {
-                    pageSum = attachInfo.getInt("page_sum");
-                    break;
-                }
-            }
-        }
-
-        JSONArray items = invoiceInfo.getJSONArray("items");
-        if (pageSum == 0) {
-            double itemsNum = (double)items.size();
-            double sum = Math.ceil(itemsNum / 25.0);
-            invoiceInfo.put("salelistSum", (int)sum == 0 ? 1 : (int)sum);
-        } else {
-            invoiceInfo.put("salelistSum", pageSum);
-        }
-
-    }
-
-    private void setOtherInfoByType(Long invoiceType, JSONObject recognitionInfo) {
-        String continuousNo = recognitionInfo.getString("continuousNo");
-        String numberConfirm = recognitionInfo.getString("numberConfirm");
-        String codeConfirm = recognitionInfo.getString("codeConfirm");
-        boolean isEquals;
-        if (StringUtils.isEmpty(continuousNo) && StringUtils.isNotEmpty(numberConfirm) && StringUtils.isNotEmpty(codeConfirm)) {
-            String invoiceCode = recognitionInfo.getString("invoiceCode");
-            String invoiceNo = recognitionInfo.getString("invoiceNo");
-            boolean isCodeEquals = invoiceCode.equals(codeConfirm);
-            isEquals = invoiceNo.equals(numberConfirm);
-            recognitionInfo.put("continuousNo", "0");
-            if (!isCodeEquals || !isEquals) {
-                recognitionInfo.put("continuousNo", "1");
-            }
-        }
-
-        if (InputInvoiceTypeEnum.TAXI_INVOICE.getCode().equals(invoiceType)) {
-            BigDecimal surcharge = recognitionInfo.getBigDecimal("surcharge");
-            BigDecimal totalAmount = recognitionInfo.getBigDecimal("totalAmount") == null ? BigDecimal.ZERO : recognitionInfo.getBigDecimal("totalAmount");
-            BigDecimal fare = recognitionInfo.getBigDecimal("fare") == null ? BigDecimal.ZERO : recognitionInfo.getBigDecimal("fare");
-            isEquals = totalAmount.compareTo(fare) == 0;
-            if (isEquals && surcharge != null) {
-                recognitionInfo.put("totalAmount", totalAmount.add(surcharge));
-            }
-        }
-
-    }
-
-    private void recognitionInvoiceMix(JSONObject recognitionInfo, Long invoiceType) {
-        String serialNo = recognitionInfo.getString("serialNo");
-        if (StringUtils.isNotEmpty(serialNo)) {
-            this.invoiceCollectService.convertUnVatInvoice(recognitionInfo, false);
-        } else {
-            this.convertFalseField(invoiceType, recognitionInfo);
-        }
-
-    }
-
-    private void convertFalseField(Long invoiceType, JSONObject recognitionInfo) {
-        if (InputInvoiceTypeEnum.TRAIN_INVOICE.getCode().equals(invoiceType)) {
-            recognitionInfo.put("printingSequenceNo", recognitionInfo.getString("sequenceNo"));
-            recognitionInfo.put("seat", recognitionInfo.getString("seatGrade"));
-            recognitionInfo.put("customerIdentityNum", recognitionInfo.getString("customerIdNo"));
-        } else if (InputInvoiceTypeEnum.AIR_INVOICE.getCode().equals(invoiceType)) {
-            recognitionInfo.put("electronicTicketNum", recognitionInfo.getString("eticketNo"));
-            recognitionInfo.put("customerIdentityNum", recognitionInfo.getString("customerIdNo"));
-            recognitionInfo.put("otherTotalTaxAmount", recognitionInfo.getString("otherAmount"));
-        }
-
-    }
-
-    public JSONArray bindAttachInvoice(JSONArray targetArray, JSONObject businessParam) {
-        return this.bindAttachInvoice(targetArray, businessParam, new HashMap(0));
-    }
-
-    public JSONArray bindAttachInvoice(JSONArray targetArray, JSONObject businessParam, Map<String, Long> invoiceTypeMap) {
-        JSONArray attachArray = new JSONArray();
-        if (targetArray.size() == 0) {
-            return attachArray;
-        } else {
-            targetArray.stream().forEach((i) -> {
-                JSONObject invoiceInfo = (JSONObject)i;
-                int pageNo = invoiceInfo.getInteger("pageNo");
-                boolean originalCheck = "1".equals(invoiceInfo.getString("originalState"));
-                String invoiceCode = invoiceInfo.getString("invoiceCode");
-                String invoiceNo = invoiceInfo.getString("invoiceNo");
-                Long invoiceType = (Long)invoiceTypeMap.get(StringUtils.trimToEmpty(invoiceCode) + StringUtils.trimToEmpty(invoiceNo));
-                boolean salerInvoiceType = invoiceType == null || InvoiceConvertUtils.isSaleListInvoiceType(invoiceType);
-                if (!originalCheck && salerInvoiceType) {
-                    DynamicObject attachObject = this.getAttachDynamicObject(invoiceInfo, businessParam);
-                    DynamicObject attachSaveObject = (DynamicObject)SaveServiceHelper.save(new DynamicObject[]{attachObject})[0];
-                    JSONObject attachInfo = new JSONObject(DynamicObjectUtil.dynamicObject2Map(attachSaveObject));
-                    attachInfo.put("invoiceCode", invoiceCode);
-                    attachInfo.put("invoiceNo", invoiceNo);
-                    DynamicObject attachTypeObj = BusinessDataServiceHelper.loadSingle(1503642129396971520L, "bdm_attach_type");
-                    attachInfo.put("simplify_name", attachTypeObj.getString("simplify_name"));
-                    attachInfo.put("attach_category_grid", attachTypeObj.getString("name"));
-                    attachInfo.put("serialNo", MD5.md5Hex(attachObject.get("id").toString()));
-                    attachInfo.put("pageNo", pageNo);
-                    long attachId = (Long)attachSaveObject.getPkValue();
-                    QFilter codeFilter = new QFilter("invoice_code", "=", invoiceCode);
-                    QFilter noFilter = new QFilter("invoice_no", "=", invoiceNo);
-                    Long[] vatTypes = InputInvoiceTypeEnum.getVatTypes();
-                    QFilter typeFilter = new QFilter("invoice_type", "in", vatTypes);
-                    String mainFields = MetadataUtil.getFields("rim_invoice");
-                    DynamicObject invoiceObject = BusinessDataServiceHelper.loadSingle("rim_invoice", mainFields, new QFilter[]{codeFilter, noFilter, typeFilter});
-                    if (invoiceObject != null) {
-                        attachInfo.put("isVat", "1");
-                        DynamicObject attachRelationObject = this.getAttachRelationDynamicObject(attachId, invoiceObject.getString("serial_no"));
-                        if (attachRelationObject != null) {
-                            SaveServiceHelper.save(new DynamicObject[]{attachRelationObject});
-                        }
-
-                        int page_sum = attachInfo.getInteger("page_sum");
-                        if (page_sum != 0) {
-                            invoiceObject.set("salelist_sum", page_sum);
-                            SaveServiceHelper.save(new DynamicObject[]{invoiceObject});
-                        }
-                    }
-
-                    attachArray.add(attachInfo);
-                }
-
-            });
-            return attachArray;
-        }
-    }
-
-    private DynamicObject getAttachRelationDynamicObject(long attachId, String serialNo) {
-        DynamicObjectCollection collect = QueryServiceHelper.query("rim_attach_relation", "id", new QFilter[]{new QFilter("attach_id", "=", String.valueOf(attachId))});
-        if (collect.size() > 0) {
-            return null;
-        } else {
-            DynamicObject relationObject = BusinessDataServiceHelper.newDynamicObject("rim_attach_relation");
-            relationObject.set("attach_id", attachId);
-            relationObject.set("relation_type", 3);
-            relationObject.set("relation_id", serialNo);
-            DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("rim_attach_relation", "expense_id", new QFilter[]{new QFilter("relation_id", "=", serialNo)});
-            if (dynamicObject != null) {
-                relationObject.set("expense_id", dynamicObject.getString("expense_id"));
-            }
-
-            return relationObject;
-        }
-    }
-
-    private DynamicObject getAttachDynamicObject(JSONObject invoiceInfo, JSONObject businessParam) {
-        Long userId = Long.valueOf(RequestContext.get().getUserId());
-        StringBuilder attachNoSb = new StringBuilder();
-        attachNoSb.append(invoiceInfo.getString("invoiceCode")).append('_');
-        attachNoSb.append(invoiceInfo.getString("invoiceNo"));
-        String attachNo = attachNoSb.toString();
-        QFilter filter1 = new QFilter("attach_no", "=", attachNo);
-        QFilter filter2 = new QFilter("attach_category", "=", AttachConstant.ATTACH_LIST_CATEGORY_ID);
-        QFilter filter3 = new QFilter("attach_hash_value", "=", invoiceInfo.getString("fileHash"));
-        DynamicObject idObject = QueryServiceHelper.queryOne("rim_attach", "id", new QFilter[]{filter1, filter2, filter3});
-        DynamicObject attachObject = null;
-        boolean pdfFlag = "1".equals(invoiceInfo.getString("fileType"));
-        if (idObject != null && !pdfFlag) {
-            attachObject = BusinessDataServiceHelper.loadSingle(idObject.get("id"), "rim_attach");
-        } else {
-            attachObject = BusinessDataServiceHelper.newDynamicObject("rim_attach");
-            attachObject.set("create_time", new Date());
-        }
-
-        attachObject.set("update_time", new Date());
-        attachObject.set("user", userId);
-        if (businessParam != null) {
-            attachObject.set("rim_user", businessParam.get("rim_user"));
-        }
-
-        attachObject.set("attach_no", attachNo);
-        attachObject.set("attach_url", invoiceInfo.getString("snapshotUrl"));
-        String subFileName = invoiceInfo.getString("subFileName");
-        String pageNum;
-        if (StringUtils.isNotEmpty(subFileName)) {
-            attachObject.set("attach_type", "2");
-            attachObject.set("attach_name", subFileName);
-            pageNum = subFileName.substring(subFileName.lastIndexOf(46) + 1);
-            attachObject.set("file_extension", pageNum);
-        } else {
-            attachObject.set("attach_type", invoiceInfo.getString("fileType"));
-            attachObject.set("attach_name", invoiceInfo.getString("fileName"));
-            pageNum = invoiceInfo.getString("fileName").substring(invoiceInfo.getString("fileName").lastIndexOf(46) + 1);
-            attachObject.set("file_extension", pageNum);
-        }
-
-        attachObject.set("attach_category", AttachConstant.ATTACH_LIST_CATEGORY_ID);
-        attachObject.set("original_name", invoiceInfo.getString("fileName"));
-        attachObject.set("snapshot_url", invoiceInfo.getString("snapshotUrl"));
-        attachObject.set("icon_url", invoiceInfo.getString("snapshotUrl"));
-        attachObject.set("attach_hash_value", invoiceInfo.getString("fileHash"));
-        pageNum = invoiceInfo.getString("pageNum");
-        if (StringUtils.isNotEmpty(pageNum)) {
-            try {
-                String target = pageNum.replaceAll(" ", "");
-                String subStr = target.substring(0, target.length() - 1);
-                int index = subStr.indexOf(20849);
-                int index2 = subStr.indexOf(39029);
-                int index3 = subStr.indexOf(31532);
-                String pageSum = target.substring(index, index2).substring(1);
-                String pageNo = target.substring(index3, subStr.length()).substring(1);
-                attachObject.set("page_sum", Integer.valueOf(pageSum));
-                attachObject.set("page_no", Integer.valueOf(pageNo));
-            } catch (Exception var21) {
-                logger.info("截取总页码失败:", var21);
-            }
-        }
-
-        return attachObject;
-    }
-
-    public JSONArray getTargetArray(JSONArray finalResult) {
-        return (JSONArray)finalResult.stream().filter((f) -> {
-            JSONObject invoiceInfo = (JSONObject)f;
-            return isSalePage(invoiceInfo);
-        }).collect(Collectors.toCollection(JSONArray::new));
-    }
-
-    public static boolean isSalePage(JSONObject invoiceInfo) {
-        String invoiceCode = invoiceInfo.getString("invoiceCode");
-        String invoiceNo = invoiceInfo.getString("invoiceNo");
-        boolean typeCheck = InputInvoiceTypeEnum.OTHER_INVOICE.getCode().equals(invoiceInfo.getLong("invoiceType"));
-        boolean emptyCheck = StringUtils.isNotEmpty(invoiceCode) && StringUtils.isNotEmpty(invoiceNo);
-        String title = invoiceInfo.getString("title");
-        boolean titleCheck = StringUtils.isNotEmpty(title) && (title.contains("清单") || title.contains("明细"));
-        return typeCheck && emptyCheck && titleCheck;
-    }
-
-    public void dealInvoiceAttachRelation(JSONObject invoiceInfo) {
-        if (invoiceInfo != null) {
-            logger.info("处理发票绑定附件关系....");
-            String invoiceCode = invoiceInfo.getString("invoiceCode");
-            String invoiceNo = invoiceInfo.getString("invoiceNo");
-            invoiceCode = StringUtils.isNotEmpty(invoiceCode) ? invoiceCode : invoiceInfo.getString("invoice_code");
-            invoiceNo = StringUtils.isNotEmpty(invoiceNo) ? invoiceNo : invoiceInfo.getString("invoice_no");
-            StringBuilder attachNo = new StringBuilder();
-            attachNo.append(invoiceCode).append('_').append(invoiceNo);
-            DynamicObjectCollection attachCollect = this.getAttachDynamicByAttachNo(attachNo.toString());
-            Iterator var6 = attachCollect.iterator();
-
-            while(var6.hasNext()) {
-                DynamicObject attachInfo = (DynamicObject)var6.next();
-                String targetCode = attachInfo.getString("attach_no");
-                if (StringUtils.isNotEmpty(targetCode)) {
-                    String[] codeNo = targetCode.split("_");
-                    if (codeNo.length == 2 && invoiceCode.equals(codeNo[0]) && invoiceNo.equals(codeNo[1])) {
-                        DynamicObject attachRelationObject = this.getAttachRelationDynamicObject(attachInfo.getLong("id"), invoiceInfo.getString("serialNo"));
-                        if (attachRelationObject != null) {
-                            SaveServiceHelper.save(new DynamicObject[]{attachRelationObject});
-                        }
-
-                        logger.info("发票绑定附件关系保存成功....");
-                    }
-                }
-            }
-
-            JSONObject numObject = this.calcSaleListComplete(invoiceCode, invoiceNo, attachNo.toString());
-            invoiceInfo.put("salelistSum", numObject.getString("salelistSum"));
-            invoiceInfo.put("bindNum", numObject.getString("bindNum"));
-        }
-    }
-
-    public JSONObject calcSaleListComplete(String invoiceCode, String invoiceNo, String attachNo) {
-        logger.info("计算清单完整性,{},{}", invoiceCode, invoiceNo);
-        JSONObject numObject = new JSONObject();
-        int saleListSum = 0;
-        QFilter attachNoFilter = new QFilter("attach_no", "=", attachNo);
-        String attachFields = MetadataUtil.getFields("rim_attach");
-        DynamicObject[] attachCollect = BusinessDataServiceHelper.load("rim_attach", attachFields, new QFilter[]{attachNoFilter});
-        int bindNum = 0;
-        DynamicObject attachOne;
-        if (attachCollect != null && attachCollect.length > 0) {
-            String url = RimConfigUtils.getConfig("rim_recog_check", "salelistposturl");
-            if (StringUtils.isNotEmpty(url)) {
-                Set<Integer> numSet = (Set)Arrays.stream(attachCollect).filter((f) -> {
-                    if (f.getInt("page_no") == 0) {
-                        return false;
-                    } else {
-                        Long attachId = f.getLong("id");
-                        boolean isBind = this.checkBind(attachId);
-                        return isBind;
-                    }
-                }).map((m) -> {
-                    return m.getInt("page_no");
-                }).collect(Collectors.toSet());
-                bindNum = numSet.size();
-            } else {
-                DynamicObject[] var18 = attachCollect;
-                int var12 = attachCollect.length;
-
-                for(int var13 = 0; var13 < var12; ++var13) {
-                    attachOne = var18[var13];
-                    Long attachId = attachOne.getLong("id");
-                    boolean isBind = this.checkBind(attachId);
-                    if (isBind) {
-                        ++bindNum;
-                    }
-                }
-            }
-        }
-
-        QFilter invoiceNoFilter = new QFilter("invoice_no", "=", invoiceNo);
-        QFilter invoiceCodeFilter = new QFilter("invoice_code", "=", invoiceCode);
-        if (StringUtils.isNotEmpty(invoiceNo) && invoiceNo.length() == 20) {
-            invoiceCodeFilter = null;
-        }
-
-        String mainFields = MetadataUtil.getFields("rim_invoice");
-        DynamicObject mainObject = BusinessDataServiceHelper.loadSingle("rim_invoice", mainFields, new QFilter[]{invoiceNoFilter, invoiceCodeFilter});
-        if (mainObject != null) {
-            saleListSum = mainObject.getInt("salelist_sum");
-            if (attachCollect != null && attachCollect.length > 0) {
-                attachOne = attachCollect[0];
-                int pageSum = attachOne.getInt("page_sum");
-                if (pageSum != 0 && pageSum != saleListSum) {
-                    mainObject.set("salelist_sum", pageSum);
-                    saleListSum = pageSum;
-                }
-            }
-
-            if (bindNum == 0) {
-                mainObject.set("salelist_complete", "3");
-            } else if (bindNum < saleListSum) {
-                mainObject.set("salelist_complete", "2");
-            } else {
-                mainObject.set("salelist_complete", "0");
-            }
-
-            SaveServiceHelper.save(new DynamicObject[]{mainObject});
-            logger.info("计算清单完整性完毕,{},{}", invoiceCode, invoiceNo);
-        }
-
-        numObject.put("salelistSum", saleListSum);
-        numObject.put("bindNum", bindNum);
-        return numObject;
-    }
-
-    private DynamicObjectCollection getAttachDynamicByAttachNo(String attachNo) {
-        DynamicObjectCollection result = new DynamicObjectCollection();
-        QFilter attachNoFilter = new QFilter("attach_no", "=", attachNo);
-        String attachFields = MetadataUtil.getFields("rim_attach");
-        DynamicObject[] attachCollect = BusinessDataServiceHelper.load("rim_attach", attachFields, new QFilter[]{attachNoFilter});
-        if (attachCollect != null && attachCollect.length > 0) {
-            DynamicObject[] var6 = attachCollect;
-            int var7 = attachCollect.length;
-
-            for(int var8 = 0; var8 < var7; ++var8) {
-                DynamicObject attachObject = var6[var8];
-                Long attachId = attachObject.getLong("id");
-                boolean isBind = this.checkBind(attachId);
-                if (!isBind) {
-                    result.add(attachObject);
-                }
-            }
-        }
-
-        return result;
-    }
-
-    public boolean checkBind(Long attachId) {
-        QFilter attachIdFilter = new QFilter("attach_id", "=", attachId.toString());
-        QFilter relationIdFilter = new QFilter("relation_id", "!=", " ");
-        String attachFields = MetadataUtil.getFields("rim_attach_relation");
-        DynamicObject[] attachCollect = BusinessDataServiceHelper.load("rim_attach_relation", attachFields, new QFilter[]{attachIdFilter, relationIdFilter});
-        return attachCollect != null && attachCollect.length > 0;
-    }
-
-    public Map<String, Integer> filterBindAttach(List<String> attachIds) {
-        QFilter attachIdFilter = new QFilter("attach_id", "in", attachIds);
-        QFilter relationIdFilter = new QFilter("relation_id", "!=", " ");
-        String attachFields = MetadataUtil.getFields("rim_attach_relation");
-        DynamicObject[] attachCollect = BusinessDataServiceHelper.load("rim_attach_relation", attachFields, new QFilter[]{attachIdFilter, relationIdFilter});
-        if (attachCollect.length == 0) {
-            return Maps.newHashMap();
-        } else {
-            Map<String, List<DynamicObject>> relationGroup = (Map)Arrays.stream(attachCollect).collect(Collectors.groupingBy((attach) -> {
-                return attach.getString("relation_id");
-            }));
-            Map<String, Integer> map = Maps.newHashMapWithExpectedSize(relationGroup.size());
-            List<String> serialList = Lists.newArrayList();
-            Iterator var9 = relationGroup.entrySet().iterator();
-
-            while(var9.hasNext()) {
-                Map.Entry<String, List<DynamicObject>> entry = (Map.Entry)var9.next();
-                map.put(entry.getKey(), ((List)entry.getValue()).size());
-                serialList.add(entry.getKey());
-            }
-
-            QFilter serialFilter = new QFilter("serial_no", "in", serialList);
-            DynamicObject[] invoiceCollect = BusinessDataServiceHelper.load("rim_invoice", "serial_no, invoice_code, invoice_no", new QFilter[]{serialFilter});
-            Map<String, String> invoiceMap = Maps.newHashMapWithExpectedSize(invoiceCollect.length);
-            DynamicObject[] var12 = invoiceCollect;
-            int var13 = invoiceCollect.length;
-
-            for(int var14 = 0; var14 < var13; ++var14) {
-                DynamicObject invoice = var12[var14];
-                invoiceMap.put(invoice.getString("serial_no"), invoice.getString("invoice_code") + "_" + invoice.getString("invoice_no"));
-            }
-
-            Map<String, Integer> result = Maps.newHashMapWithExpectedSize(map.size());
-            Iterator var19 = map.entrySet().iterator();
-
-            while(var19.hasNext()) {
-                Map.Entry<String, Integer> entry = (Map.Entry)var19.next();
-                result.put(invoiceMap.get(entry.getKey()), entry.getValue());
-            }
-
-            return result;
-        }
-    }
-}

+ 0 - 727
src/main/java/kd/imc/rim/RecognitionCheckServiceEx.java

@@ -1,727 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by FernFlower decompiler)
-//
-
-package kd.imc.rim;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Maps;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.stream.Collectors;
-import kd.bos.context.RequestContext;
-import kd.bos.dataentity.resource.ResManager;
-import kd.bos.dataentity.utils.ObjectUtils;
-import kd.bos.dataentity.utils.StringUtils;
-import kd.bos.fileservice.FileServiceFactory;
-import kd.bos.logging.Log;
-import kd.bos.logging.LogFactory;
-import kd.bos.threads.ThreadPool;
-import kd.bos.threads.ThreadPools;
-import kd.imc.rim.common.constant.CheckContant;
-import kd.imc.rim.common.constant.InputInvoiceTypeEnum;
-import kd.imc.rim.common.constant.InvoiceUploadErrorType;
-import kd.imc.rim.common.invoice.collector.InvoiceCollectService;
-import kd.imc.rim.common.invoice.model.ConvertFieldUtil;
-import kd.imc.rim.common.invoice.recognition.listener.IRecognitionListener;
-import kd.imc.rim.common.invoice.recognition.listener.RecognitionListenerResult;
-import kd.imc.rim.common.invoice.recognitionnew.task.FileUploadAndSignTask;
-import kd.imc.rim.common.invoice.save.InvoiceSaveService;
-import kd.imc.rim.common.message.exception.MsgException;
-import kd.imc.rim.common.utils.FileUploadUtils;
-import kd.imc.rim.common.utils.FileUtils;
-import kd.imc.rim.common.utils.FormFileEntity;
-import kd.imc.rim.common.utils.ImcConfigUtil;
-import kd.imc.rim.common.utils.InvoiceConvertUtils;
-import kd.imc.rim.common.utils.RimConfigUtils;
-import kd.imc.rim.common.utils.itextpdf.UrlServiceUtils;
-import kd.imc.rim.file.utils.FileConvertUtils;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.compress.utils.Lists;
-
-public class RecognitionCheckServiceEx {
-    private static RecognitionCheckServiceEx instance = null;
-    private static Log logger = LogFactory.getLog(RecognitionCheckServiceEx.class);
-    private RecognitionCheckHelperEx RecognitionCheckHelperEx = new RecognitionCheckHelperEx();
-    private InvoiceCollectService invoiceCollectService = new InvoiceCollectService();
-    private static Integer recheckorginPage = 999123413;
-    private static ThreadPool uploadThreadPool = ThreadPools.newFixedThreadPool("recognitionUploadThread_2", Runtime.getRuntime().availableProcessors() + 1);
-
-    private RecognitionCheckServiceEx() {
-    }
-
-    public static RecognitionCheckServiceEx getInstance() {
-        Class var0 = RecognitionCheckServiceEx.class;
-        synchronized(RecognitionCheckServiceEx.class) {
-            if (instance == null) {
-                instance = new RecognitionCheckServiceEx();
-            }
-        }
-
-        return instance;
-    }
-
-    public JSONObject recognitionCheckInvoice(String fileUrl, String fileName, IRecognitionListener recognitionListener, JSONObject businessParam) {
-        logger.info("识别查验fileName:{},businessParam:{}", fileName, businessParam);
-        fileName = FileUtils.truncateFileName(fileName, 50);
-        this.markDeleteByVerifySave(businessParam);
-        boolean isCheck = this.getCheckFlag(businessParam);
-        return this.extracted_new(fileUrl, fileName, recognitionListener, businessParam, isCheck);
-    }
-
-    private void markDeleteByVerifySave(JSONObject businessParam) {
-        if (businessParam != null) {
-            String verifySaveFlag = RimConfigUtils.getConfig("verify_save");
-            if ("0".equals(verifySaveFlag)) {
-                businessParam.put("delete", "2");
-            }
-        }
-
-    }
-
-    private JSONObject extracted_new(String fileUrl, String fileName, IRecognitionListener recognitionListener, JSONObject businessParam, boolean isCheck) {
-        long startTime = System.currentTimeMillis();
-        JSONObject result = null;
-        RecognitionListenerResult listener = new RecognitionListenerResult(fileUrl, fileName, 0, 0, new JSONArray());
-
-        JSONArray finalResult;
-        JSONArray attachResult;
-        try {
-            long fileStartTime = System.currentTimeMillis();
-            FormFileEntity fileEntity = this.RecognitionCheckHelperEx.getFormFileEntity(fileUrl, fileName);
-            if (!fileEntity.getSuccess()) {
-                this.handle(recognitionListener, listener);
-                return InvoiceUploadErrorType.getSplitErrorResult();
-            }
-
-            int totalPage = CollectionUtils.isEmpty(fileEntity.getSubFileList()) ? 1 : fileEntity.getSubFileList().size();
-            Map<String, Object> extMap = this.RecognitionCheckHelperEx.getRecognitionCheckExtMap(businessParam);
-            String originalStateDefault = fileEntity.getOriginalStateDefault();
-            if ("1".equals(originalStateDefault)) {
-                extMap.put("originalStateDefault", originalStateDefault);
-            }
-
-            String fileType = fileEntity.getFileType();
-            Map<Integer, Object> subFileFutureMap = this.syncUploadSubFile(fileEntity);
-            logger.info("RecognitionCheckServiceEx 文件解析耗时:{}", System.currentTimeMillis() - fileStartTime);
-
-            List recognitionResultList;
-            try {
-                long recognitionStartTime = System.currentTimeMillis();
-                recognitionResultList = this.RecognitionCheckHelperEx.recognitionInvoiceFile(fileEntity, extMap);
-                logger.info("RecognitionCheckServiceEx 识别总耗时:{}", System.currentTimeMillis() - recognitionStartTime);
-                this.checkOriginal(fileEntity, subFileFutureMap, recognitionResultList);
-                finalResult = JSONObject.parseArray(JSONObject.toJSONString(recognitionResultList));
-            } catch (Throwable var26) {
-                this.handle(recognitionListener, listener);
-                if (var26 instanceof MsgException) {
-                    return JSON.parseObject(var26.toString());
-                }
-
-                logger.info("识别程序错误:", var26);
-                return InvoiceUploadErrorType.getRecognitionErrorResult();
-            }
-
-            if (isCheck && recognitionResultList.size() > 0) {
-                try {
-                    long checkStartTime = System.currentTimeMillis();
-                    List<JSONObject> checkResultList = this.RecognitionCheckHelperEx.checkInvoiceByRecognitionInfo(recognitionResultList, extMap);
-                    logger.info("RecognitionCheckServiceEx 查验总耗时:{}", System.currentTimeMillis() - checkStartTime);
-                    finalResult = JSONObject.parseArray(JSONObject.toJSONString(checkResultList));
-                } catch (Throwable var25) {
-                    this.handle(recognitionListener, listener);
-                    logger.info("查验程序错误:", var25);
-                    return InvoiceUploadErrorType.getCheckErrorResult();
-                }
-            }
-
-            Map<String, Object> fileBaseInfo = Maps.newHashMap();
-            fileBaseInfo.put("fileType", fileType);
-            fileBaseInfo.put("fileUrl", fileUrl);
-            fileBaseInfo.put("fileName", fileName);
-            fileBaseInfo.put("size", fileEntity.getFileSize());
-            fileBaseInfo.put("fileHash", fileEntity.getFileHash());
-            finalResult = this.putFileInfo(fileBaseInfo, finalResult, subFileFutureMap, originalStateDefault);
-            attachResult = this.dealSaleList(finalResult, businessParam);
-            boolean isHandleAttach = attachResult.size() > 0 && finalResult.size() == 0;
-            logger.info("isHandleAttach:{}", isHandleAttach);
-            if (isHandleAttach) {
-                this.handleAttach(attachResult, recognitionListener, fileUrl, fileName, totalPage);
-            }
-
-            try {
-                if (fileBaseInfo.get("totalPage") == null) {
-                    totalPage = this.getTotalPage(finalResult, attachResult);
-                    fileBaseInfo.put("totalPage", totalPage);
-                }
-
-                this.saveInvoice(finalResult, attachResult, isHandleAttach, fileBaseInfo, businessParam, recognitionListener);
-                FileUploadUtils.saveBasAttachment(fileUrl, fileName, "rim_invoice", "", fileEntity.getFileSize());
-            } catch (Throwable var24) {
-                this.handle(recognitionListener, listener);
-                logger.info("发票保存错误:", var24);
-            }
-        } catch (IOException var27) {
-            logger.info("RecognitionCheckServiceEx IOException :{}", var27);
-            this.handle(recognitionListener, listener);
-            return InvoiceUploadErrorType.getSplitErrorResult();
-        } catch (MsgException var28) {
-            logger.info("RecognitionCheckServiceEx MsgException :{}", var28);
-            this.handle(recognitionListener, listener);
-            JSONObject errorInfo = new JSONObject();
-            errorInfo.put("errcode", var28.getErrorCode());
-            errorInfo.put("description", var28.getMessage());
-            return errorInfo;
-        } catch (Throwable var29) {
-            logger.info("RecognitionCheckServiceEx BaseErrorResult Throwable:{}", var29);
-            this.handle(recognitionListener, listener);
-            return InvoiceUploadErrorType.getBaseErrorResult();
-        }
-
-        boolean resultFlag = finalResult.size() != 0 || attachResult.size() != 0;
-        logger.info("RecognitionCheckServiceEx 识别查验入库总耗时:{}", System.currentTimeMillis() - startTime);
-        if (resultFlag) {
-            return InvoiceUploadErrorType.getSuccessResult(finalResult, attachResult);
-        } else {
-            this.handle(recognitionListener, listener);
-            return InvoiceUploadErrorType.getFailResult();
-        }
-    }
-
-    private void checkOriginal(FormFileEntity fileEntity, Map<Integer, Object> subFileFutureMap, List<JSONObject> recognitionResultList) {
-        if (!StringUtils.isBlank(fileEntity.getSecondPageText()) && !CollectionUtils.isEmpty(recognitionResultList)) {
-            JSONObject firstInvoice = (JSONObject)recognitionResultList.get(0);
-            Long invoiceType = firstInvoice.getLong("invoiceType");
-            String invoiceNo = firstInvoice.getString("invoiceNo");
-            String invoiceCode = firstInvoice.getString("invoiceCode");
-            int i;
-            if (InputInvoiceTypeEnum.isCheckOriginalFile(invoiceType) && StringUtils.isNotEmpty(invoiceCode) && StringUtils.isNotEmpty(invoiceNo)) {
-                i = fileEntity.getSecondPageText().indexOf(invoiceCode);
-                int noidx = fileEntity.getSecondPageText().indexOf(invoiceNo);
-                if (i < 0 || noidx < 0) {
-                    return;
-                }
-            }
-
-            for(i = 1; i < recognitionResultList.size(); ++i) {
-                JSONObject invoice = (JSONObject)recognitionResultList.get(i);
-                if (!kd.imc.rim.RecognitionCheckHelperEx.isSalePage(invoice)) {
-                    return;
-                }
-            }
-
-            FileUploadAndSignTask task = new FileUploadAndSignTask(fileEntity.getFileUrl(), (byte[])null, fileEntity.getFileName(), "pdf", fileEntity.getFileHash(), true, RequestContext.get());
-            task.setSignOnly(true);
-            Future<JSONObject> subUploadFuture = uploadThreadPool.submit(task);
-            subFileFutureMap.put(recheckorginPage, subUploadFuture);
-        }
-
-    }
-
-    private int getTotalPage(JSONArray finalResult, JSONArray attachArray) {
-        Set<Integer> pageNumSet = new HashSet(8);
-        int i;
-        if (finalResult != null && !finalResult.isEmpty()) {
-            for(i = 0; i < finalResult.size(); ++i) {
-                pageNumSet.add(finalResult.getJSONObject(i).getInteger("pageNo"));
-            }
-        }
-
-        if (attachArray != null && !attachArray.isEmpty()) {
-            for(i = 0; i < attachArray.size(); ++i) {
-                pageNumSet.add(attachArray.getJSONObject(i).getInteger("pageNo"));
-            }
-        }
-
-        return pageNumSet.size();
-    }
-
-    private void handleAttach(JSONArray attachResult, IRecognitionListener recognitionListener, String fileUrl, String fileName, int totalPage) {
-        if (attachResult != null && attachResult.size() != 0) {
-            if (recognitionListener != null) {
-                Map<Integer, List<Object>> handleMap = (Map)attachResult.stream().collect(Collectors.groupingBy((v) -> {
-                    return ((JSONObject)v).getInteger("pageNo");
-                }));
-                logger.info("handleAttach handleMap:{}", handleMap);
-                Iterator var7 = handleMap.entrySet().iterator();
-
-                while(var7.hasNext()) {
-                    Map.Entry<Integer, List<Object>> entry = (Map.Entry)var7.next();
-                    int pageNo = (Integer)entry.getKey();
-                    logger.info("附件通知前端pageNo:{}", pageNo);
-                    JSONArray invoiceArray = JSONArray.parseArray(JSON.toJSONString(entry.getValue()));
-                    RecognitionListenerResult listener = new RecognitionListenerResult(fileUrl, fileName, pageNo, totalPage, invoiceArray);
-                    recognitionListener.handle(listener);
-                }
-            }
-
-        }
-    }
-
-    private JSONArray dealSaleList(JSONArray finalResult, JSONObject businessParam) {
-        if (finalResult.size() == 0) {
-            return new JSONArray();
-        } else {
-            Map<String, String> configMap = ImcConfigUtil.getValue("rim_recog_check");
-            String isDealSaleList = (String)configMap.get("is_dealsalelist");
-            if ("0".equals(isDealSaleList)) {
-                return new JSONArray();
-            } else {
-                JSONArray targetArray = this.RecognitionCheckHelperEx.getTargetArray(finalResult);
-                finalResult.removeAll(targetArray);
-                Map<String, Long> invoiceTypeMap = this.getInvoiceTypeMapAndRemoveFinancialDetail(finalResult);
-                JSONArray attachArray = this.RecognitionCheckHelperEx.bindAttachInvoice(targetArray, businessParam, invoiceTypeMap);
-                List<String> finishList = Lists.newArrayList();
-                if (attachArray.size() > 0) {
-                    for(int i = 0; i < attachArray.size(); ++i) {
-                        JSONObject attachInfo = attachArray.getJSONObject(i);
-                        String invoiceCode = attachInfo.getString("invoiceCode");
-                        String invoiceNo = attachInfo.getString("invoiceNo");
-                        String isVat = attachInfo.getString("isVat");
-                        if ("1".equals(isVat)) {
-                            StringBuilder attachNo = new StringBuilder();
-                            attachNo.append(invoiceCode).append('_').append(invoiceNo);
-                            if (!finishList.contains(attachNo.toString())) {
-                                JSONObject numObject = this.RecognitionCheckHelperEx.calcSaleListComplete(invoiceCode, invoiceNo, attachNo.toString());
-                                int salelistSum = numObject.getInteger("salelistSum");
-                                if (salelistSum == 0) {
-                                    salelistSum = attachInfo.getInteger("page_sum");
-                                }
-
-                                attachInfo.put("salelistSum", salelistSum);
-                                attachInfo.put("bindNum", numObject.getInteger("bindNum"));
-                                finishList.add(attachNo.toString());
-                            }
-                        }
-                    }
-                }
-
-                return attachArray;
-            }
-        }
-    }
-
-    private Map<String, Long> getInvoiceTypeMapAndRemoveFinancialDetail(JSONArray finalResult) {
-        Map<String, Long> invoiceTypeMap = new HashMap(8);
-        boolean notFINANCIAL = false;
-
-        for(int i = 0; i < finalResult.size(); ++i) {
-            JSONObject invoiceInfo = finalResult.getJSONObject(i);
-            Long invoiceType = invoiceInfo.getLong("invoiceType");
-            if (!InputInvoiceTypeEnum.OTHER_INVOICE.getCode().equals(invoiceType)) {
-                invoiceTypeMap.put(StringUtils.trimToEmpty(invoiceInfo.getString("invoiceCode")) + StringUtils.trimToEmpty(invoiceInfo.getString("invoiceNo")), invoiceType);
-            } else if (!InputInvoiceTypeEnum.FINANCIAL_INVOICE.getCode().equals(invoiceType) && !InputInvoiceTypeEnum.OTHER_INVOICE.getCode().equals(invoiceType)) {
-                notFINANCIAL = true;
-            }
-        }
-
-        if (invoiceTypeMap.size() > 0 && !notFINANCIAL) {
-            List<JSONObject> list = new ArrayList(8);
-
-            for(int i = 0; i < finalResult.size(); ++i) {
-                JSONObject invoiceInfo = finalResult.getJSONObject(i);
-                Long invoiceType = invoiceInfo.getLong("invoiceType");
-                String title = invoiceInfo.getString("title");
-                if (!kd.imc.rim.RecognitionCheckHelperEx.isSalePage(invoiceInfo) && InputInvoiceTypeEnum.OTHER_INVOICE.getCode().equals(invoiceType) && StringUtils.isNotEmpty(title) && title.indexOf("明细") > 0) {
-                    list.add(invoiceInfo);
-                }
-            }
-
-            if (!list.isEmpty()) {
-                finalResult.removeAll(list);
-            }
-        }
-
-        return invoiceTypeMap;
-    }
-
-    public void handle(IRecognitionListener recognitionListener, RecognitionListenerResult listener) {
-        if (recognitionListener != null) {
-            recognitionListener.handle(listener);
-        }
-
-    }
-
-    public static void setInvoiceSeq(JSONObject invoiceInfo, JSONObject businessParam, int pageNo, int invoiceIndex) {
-        if (invoiceInfo != null) {
-            String uploadIndex;
-            if (businessParam == null) {
-                uploadIndex = String.valueOf(System.currentTimeMillis());
-            } else {
-                uploadIndex = businessParam.getString("uploadIndex");
-                if (StringUtils.isEmpty(uploadIndex)) {
-                    uploadIndex = String.valueOf(System.currentTimeMillis());
-                    businessParam.put("uploadIndex", uploadIndex);
-                }
-            }
-
-            invoiceInfo.put("uploadSeq", getInvoiceSeq(uploadIndex, pageNo, invoiceIndex));
-        }
-    }
-
-    public static Long getInvoiceSeq(String uploadIndex, int pageNo, int invoiceIndex) {
-        DecimalFormat decimalFormat = new DecimalFormat("000");
-        return Long.valueOf(uploadIndex + decimalFormat.format((long)pageNo) + decimalFormat.format((long)invoiceIndex));
-    }
-
-    private JSONArray putFileInfo(Map<String, Object> fileBaseInfo, JSONArray finalResult, Map<Integer, Object> subFileFutureMap, String originalStateDefault) throws ExecutionException, InterruptedException {
-        String updateFileType = String.valueOf(fileBaseInfo.get("fileType"));
-        String updateFileUrl = String.valueOf(fileBaseInfo.get("fileUrl"));
-        int size = finalResult.size();
-        boolean pdfSplit = false;
-        if (size > 1 && "pdf".equals(updateFileType)) {
-            pdfSplit = true;
-        }
-
-        Object refeature = subFileFutureMap.get(recheckorginPage);
-        boolean returnFirst = false;
-
-        for(int i = 0; i < finalResult.size(); ++i) {
-            JSONObject invoiceInfo = (JSONObject)finalResult.get(i);
-            Long invoiceType = invoiceInfo.getLong("invoiceType");
-            invoiceInfo.put("fileName", fileBaseInfo.get("fileName"));
-            invoiceInfo.put("fileHash", fileBaseInfo.get("fileHash"));
-            int pageNo = (Integer)invoiceInfo.get("pageNo");
-            Object feature = subFileFutureMap.get(pageNo);
-            if (feature != null) {
-                long start = System.currentTimeMillis();
-                JSONObject fileReuslt = this.getUploadResult(feature);
-                if (refeature != null && i == 0) {
-                    JSONObject fileReuslt2 = this.getUploadResult(refeature);
-                    if (fileReuslt2 != null) {
-                        returnFirst = "true".equals(fileReuslt2.getString("isOriginal"));
-                    }
-                }
-
-                if (fileReuslt != null) {
-                    String isOriginal = fileReuslt.getString("isOriginal");
-                    if (!"1".equals(invoiceInfo.getString("originalState"))) {
-                        if ("true".equals(isOriginal)) {
-                            invoiceInfo.put("originalState", "1");
-                        } else {
-                            invoiceInfo.put("originalState", "0");
-                        }
-                    }
-
-                    invoiceInfo.put("subFileName", fileReuslt.getString("subFileName"));
-                    invoiceInfo.put("snapshotUrl", fileReuslt.getString("snapshotUrl"));
-                    invoiceInfo.put("imageUrl", fileReuslt.getString("imageUrl"));
-                    invoiceInfo.put("ofdUrl", fileReuslt.getString("ofdUrl"));
-                    invoiceInfo.put("pdfUrl", fileReuslt.getString("pdfUrl"));
-                    if (pdfSplit) {
-                        invoiceInfo.put("pdfUrl", updateFileUrl);
-                    }
-
-                    invoiceInfo.put("localUrl", "");
-                    invoiceInfo.put("kdcloudUrl", "");
-                    if ("pdf".equals(FileUtils.getFileType((String)fileBaseInfo.get("fileName")))) {
-                        invoiceInfo.put("fileType", "1");
-                    } else if ("ofd".equals(FileUtils.getFileType((String)fileBaseInfo.get("fileName")))) {
-                        invoiceInfo.put("fileType", "4");
-                    } else {
-                        invoiceInfo.put("fileType", "2");
-                    }
-
-                    invoiceInfo.put("synConvert", fileReuslt.getString("synConvert"));
-                } else {
-                    invoiceInfo.put("synConvert", true);
-                }
-
-                logger.info("获取文件处理结果等待时长{},{}", System.currentTimeMillis() - start, fileReuslt);
-                if (returnFirst && !InputInvoiceTypeEnum.HGJKS.getCode().equals(invoiceType)) {
-                    JSONArray finalResult2 = new JSONArray();
-                    invoiceInfo.put("originalState", "1");
-                    finalResult2.add(invoiceInfo);
-                    fileBaseInfo.put("totalPage", 1);
-                    return finalResult2;
-                }
-            } else {
-                logger.info("获取文件处理结果第{}页结果为空", pageNo);
-            }
-        }
-
-        return finalResult;
-    }
-
-    private JSONObject getUploadResult(Object feature) {
-        long timeOut = 10L;
-        if (feature instanceof Future) {
-            try {
-                return (JSONObject)((Future)feature).get(timeOut, TimeUnit.SECONDS);
-            } catch (InterruptedException var5) {
-                logger.info("获取文件处理结果等待超时-{} InterruptedException", timeOut);
-            } catch (ExecutionException var6) {
-                logger.info("获取文件处理结果等待超时-{} ExecutionException", timeOut);
-            } catch (TimeoutException var7) {
-                logger.info("获取文件处理结果等待超时-{} TimeoutException", timeOut);
-            }
-        } else if (feature instanceof JSONObject) {
-            return (JSONObject)feature;
-        }
-
-        return null;
-    }
-
-    private Map<Integer, Object> syncUploadSubFile(FormFileEntity fileFile) {
-        if (fileFile != null && fileFile.getSuccess()) {
-            Map<Integer, Object> result = Maps.newHashMap();
-            int pageNo = 0;
-            if (CollectionUtils.isEmpty(fileFile.getSubFileList())) {
-                result.put(1, this.syncUploadOneFile(fileFile, 1));
-            } else {
-                int totalPage = fileFile.getSubFileList().size();
-                Iterator var5 = fileFile.getSubFileList().iterator();
-
-                while(var5.hasNext()) {
-                    FormFileEntity subFile = (FormFileEntity)var5.next();
-                    ++pageNo;
-                    result.put(pageNo, this.syncUploadOneFile(subFile, totalPage));
-                }
-            }
-
-            return result;
-        } else {
-            return null;
-        }
-    }
-
-    private Object syncUploadOneFile(FormFileEntity fileFile, int totalPage) {
-        Future<JSONObject> subUploadFuture = null;
-        RequestContext context = RequestContext.get();
-        if (!"ofd".equalsIgnoreCase(fileFile.getFileType()) && !"pdf".equalsIgnoreCase(fileFile.getFileType())) {
-            JSONObject result = new JSONObject();
-            result.put("isOriginal", false);
-            result.put("fileType", "2");
-            result.put("imageUrl", fileFile.getFileUrl());
-            result.put("snapshotUrl", fileFile.getFileUrl());
-            result.put("subFileName", fileFile.getFileName());
-            return result;
-        } else {
-            try {
-                InputStream fileInputStream = UrlServiceUtils.getAttachmentDecodedStream(FileServiceFactory.getAttachmentFileService().getInputStream(fileFile.getFileUrl()));
-                Throwable var6 = null;
-
-                try {
-                    byte[] streamByte = FileUtils.getByte(fileInputStream);
-                    if (StringUtils.isEmpty(fileFile.getFileHash())) {
-                        fileFile.setFileHash(FileConvertUtils.getSHA256(streamByte));
-                    }
-
-                    subUploadFuture = uploadThreadPool.submit(new FileUploadAndSignTask(fileFile.getFileUrl(), streamByte, fileFile.getFileName(), fileFile.getFileType(), fileFile.getFileHash(), fileFile.getSignatureFlag(), context));
-                } catch (Throwable var16) {
-                    var6 = var16;
-                    throw var16;
-                } finally {
-                    if (fileInputStream != null) {
-                        if (var6 != null) {
-                            try {
-                                fileInputStream.close();
-                            } catch (Throwable var15) {
-                                var6.addSuppressed(var15);
-                            }
-                        } else {
-                            fileInputStream.close();
-                        }
-                    }
-
-                }
-            } catch (IOException var18) {
-                logger.error("文件处理失败:" + fileFile.getFileUrl(), var18);
-            }
-
-            return subUploadFuture;
-        }
-    }
-
-    private void saveInvoice(JSONArray finalResult, JSONArray attachResult, boolean isHandleAttach, Map<String, Object> fileBaseInfo, JSONObject businessParam, IRecognitionListener recognitionListener) {
-        String fileUrl = (String)fileBaseInfo.get("fileUrl");
-        String fileName = (String)fileBaseInfo.get("fileName");
-        int totalPage = (Integer)fileBaseInfo.get("totalPage");
-        JSONArray handleResult = new JSONArray();
-        JSONArray mayErrorResult = new JSONArray();
-
-        for(int i = 0; i < finalResult.size(); ++i) {
-            try {
-                JSONObject invoiceInfo = finalResult.getJSONObject(i);
-                int pageNo = (Integer)invoiceInfo.get("pageNo");
-                setInvoiceSeq(invoiceInfo, businessParam, pageNo, i + 1);
-                Set<String> serialNosSet = new HashSet(8);
-                String snapshotUrl = null;
-                String awsInvoiceType = invoiceInfo.getString("invoiceType");
-                Long invoiceType = InputInvoiceTypeEnum.getInvoiceTypeByAwsType(awsInvoiceType);
-                if (InputInvoiceTypeEnum.ELECTRIC_ORDINARY.getCode().equals(invoiceType) || InputInvoiceTypeEnum.ELECTRIC_SPECIAL.getCode().equals(invoiceType)) {
-                    String originalConfig = RimConfigUtils.getConfig("rim_config", "einvoice_auto_sign");
-                    if (!StringUtils.isEmpty(originalConfig) && !"0".equals(originalConfig)) {
-                        invoiceInfo.put("originalState", "1");
-                    } else {
-                        invoiceInfo.put("originalState", "0");
-                    }
-                }
-
-                invoiceInfo.put("invoiceType", invoiceType);
-                Long tax_org = null;
-                String resourcePlugin = "";
-                if (null != businessParam) {
-                    invoiceInfo.putAll(businessParam);
-                    tax_org = businessParam.getLong("tax_org");
-                    resourcePlugin = businessParam.getString("resourcePlugin");
-                }
-
-                if (!ObjectUtils.isEmpty(tax_org)) {
-                    invoiceInfo.put("tax_org", tax_org);
-                }
-
-                if (StringUtils.isNotEmpty(invoiceInfo.getString("snapshotUrl"))) {
-                    snapshotUrl = FileUtils.downLoadAndUpload(invoiceInfo.getString("snapshotUrl"));
-                }
-
-                if (StringUtils.isNotEmpty(snapshotUrl)) {
-                    invoiceInfo.put("snapshotUrl", snapshotUrl);
-                }
-
-                logger.info("发票识别查验返回数据:" + invoiceInfo);
-                ConvertFieldUtil.getStandardInvoice(invoiceInfo);
-                if (StringUtils.isEmpty(invoiceInfo.getString("serialNo")) || serialNosSet.add(invoiceInfo.getString("serialNo"))) {
-                    if ("sign_by_expense".equals(resourcePlugin)) {
-                        InvoiceSaveService invoiceSaveService = InvoiceSaveService.newInstance(invoiceInfo.getString("invoiceType"));
-                        if (invoiceSaveService != null) {
-                            invoiceInfo.put("delete", invoiceSaveService.setInvoiceFiled(invoiceInfo));
-                        }
-                    }
-
-                    String fileHash = invoiceInfo.getString("fileHash");
-                    String resourceSys = invoiceInfo.getString("resourceSys");
-                    String errcode = invoiceInfo.getString("errcode");
-                    if ("4999".equals(errcode) && InvoiceConvertUtils.isVatInvoiceType(invoiceInfo.getLong("invoiceType"))) {
-                        invoiceInfo.put("checkStatus", "3");
-                    }
-
-                    try {
-                        Object invoiceDate = invoiceInfo.get("invoiceDate");
-                        if (invoiceDate instanceof Long) {
-                            Date date = new Date((Long)invoiceDate);
-                            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
-                            String dateString = formatter.format(date);
-                            invoiceInfo.put("invoiceDate", dateString);
-                        }
-
-                        this.invoiceCollectService.saveInvoice(invoiceInfo, fileUrl, fileHash);
-                    } catch (Exception var28) {
-                        String errorMsg = ResManager.loadKDString("发票数据保存异常,请联系管理员", "RecognitionCheckServiceEx_0", "imc-rim-common", new Object[0]);
-                        if (var28 instanceof MsgException) {
-                            errorMsg = ((MsgException)var28).getErrorMsg();
-                        }
-
-                        invoiceInfo.put("errorMsg", errorMsg);
-                        mayErrorResult.add(invoiceInfo);
-                    }
-
-                    String isSaleListInvoice = invoiceInfo.getString("isSaleListInvoice");
-                    Map<String, String> configMap = ImcConfigUtil.getValue("rim_recog_check");
-                    String isDealSaleList = (String)configMap.get("is_dealsalelist");
-                    if ("1".equals(isSaleListInvoice) && !"0".equals(isDealSaleList)) {
-                        this.RecognitionCheckHelperEx.dealInvoiceAttachRelation(invoiceInfo);
-                    }
-
-                    logger.info("发票助手本地上传保存发票后的数据:" + invoiceInfo);
-                }
-
-                handleResult.add(invoiceInfo);
-            } catch (Throwable var29) {
-                handleResult.add(mayErrorResult);
-                logger.info("发票入库失败:", var29);
-            }
-        }
-
-        if (recognitionListener != null) {
-            this.finallyHandleResult(handleResult, isHandleAttach, attachResult, fileUrl, fileName, totalPage, recognitionListener);
-        }
-
-    }
-
-    private void finallyHandleResult(JSONArray handleResult, boolean isHandleAttach, JSONArray attachResult, String fileUrl, String fileName, int totalPage, IRecognitionListener recognitionListener) {
-        Map<Integer, List<Object>> handleMap = (Map)handleResult.stream().collect(Collectors.groupingBy((v) -> {
-            return ((JSONObject)v).getInteger("pageNo");
-        }));
-        Map<Integer, List<Object>> handleAttachMap = Maps.newLinkedHashMap();
-        if (!isHandleAttach) {
-            handleAttachMap = (Map)attachResult.stream().collect(Collectors.groupingBy((v) -> {
-                return ((JSONObject)v).getInteger("pageNo");
-            }));
-        }
-
-        JSONArray handleAttachArray = new JSONArray();
-        Iterator var11 = handleMap.entrySet().iterator();
-
-        while(var11.hasNext()) {
-            Map.Entry<Integer, List<Object>> entry = (Map.Entry)var11.next();
-            int pageNo = (Integer)entry.getKey();
-            JSONArray invoiceArray = JSONArray.parseArray(JSON.toJSONString(entry.getValue()));
-            logger.info("handleAttachMap:{}", handleAttachMap);
-            if (!((Map)handleAttachMap).isEmpty()) {
-                logger.info("添加清单到发票结果集通知前端:{}", pageNo);
-                Iterator var15 = ((Map)handleAttachMap).entrySet().iterator();
-
-                while(var15.hasNext()) {
-                    Map.Entry<Integer, List<Object>> attachEntry = (Map.Entry)var15.next();
-                    int attachPageNo = (Integer)attachEntry.getKey();
-                    if (pageNo == attachPageNo) {
-                        invoiceArray.addAll(JSONArray.parseArray(JSON.toJSONString(attachEntry.getValue())));
-                    } else {
-                        handleAttachArray.addAll(JSONArray.parseArray(JSON.toJSONString(attachEntry.getValue())));
-                    }
-                }
-            }
-
-            RecognitionListenerResult listener = new RecognitionListenerResult(fileUrl, fileName, pageNo, totalPage, invoiceArray);
-            recognitionListener.handle(listener);
-        }
-
-        if (!handleAttachArray.isEmpty()) {
-            Map<Integer, List<Object>> handleAttach = (Map)handleAttachArray.stream().collect(Collectors.groupingBy((v) -> {
-                return ((JSONObject)v).getInteger("pageNo");
-            }));
-            Iterator var19 = handleAttach.entrySet().iterator();
-
-            while(var19.hasNext()) {
-                Map.Entry<Integer, List<Object>> entry = (Map.Entry)var19.next();
-                int pageNo = (Integer)entry.getKey();
-                JSONArray attachArray = JSONArray.parseArray(JSON.toJSONString(entry.getValue()));
-                RecognitionListenerResult listener = new RecognitionListenerResult(fileUrl, fileName, pageNo, totalPage, attachArray);
-                recognitionListener.handle(listener);
-            }
-        }
-
-    }
-
-    private boolean getCheckFlag(JSONObject businessParam) {
-        boolean isCheck = true;
-        if (businessParam != null) {
-            isCheck = !"1".equals(businessParam.getString("notCheck"));
-        }
-
-        if (!isCheck) {
-            businessParam.put("errcode", "4999");
-            businessParam.put("description", CheckContant.getCheckResultDesc("4999"));
-        }
-
-        return isCheck;
-    }
-}

+ 0 - 501
src/main/java/kd/imc/rim/RecognitionCheckTaskEx.java

@@ -1,501 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by FernFlower decompiler)
-//
-
-package kd.imc.rim;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import kd.bos.context.RequestContext;
-import kd.bos.dataentity.entity.DynamicObject;
-import kd.bos.dataentity.entity.DynamicObjectCollection;
-import kd.bos.dataentity.resource.ResManager;
-import kd.bos.dataentity.utils.StringUtils;
-import kd.bos.dlock.DLock;
-import kd.bos.logging.Log;
-import kd.bos.logging.LogFactory;
-import kd.bos.orm.query.QFilter;
-import kd.bos.orm.util.CollectionUtils;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
-import kd.bos.servicehelper.operation.SaveServiceHelper;
-import kd.imc.rim.common.constant.InputInvoiceTypeEnum;
-import kd.imc.rim.common.constant.ResultContant;
-import kd.imc.rim.common.invoice.fpzs.FpzsMainService;
-import kd.imc.rim.common.invoice.recognition.listener.IRecognitionListener;
-import kd.imc.rim.common.service.EInvoiceZipXmlDealService;
-import kd.imc.rim.common.service.ElectAccVoucherService;
-import kd.imc.rim.common.service.ExcelInvoiceUploadService;
-import kd.imc.rim.common.utils.BigDecimalUtil;
-import kd.imc.rim.common.utils.CacheHelper;
-import kd.imc.rim.common.utils.FileUtils;
-import kd.imc.rim.common.utils.MD5;
-import org.apache.commons.lang3.tuple.Pair;
-
-public class RecognitionCheckTaskEx implements Callable<JSONObject> {
-    private static Log logger = LogFactory.getLog(RecognitionCheckTaskEx.class);
-    private static int cache_time_out = 1800;
-    private JSONObject businessParam;
-    private Map<String, Object> customParam;
-    private String url;
-    private String fileName;
-    private String pageId;
-    private String source;
-    private RequestContext ctx;
-    public static final String waiting = "waiting";
-    public static final String success = "success";
-    public static final String fail = "fail";
-    protected static final List<String> telGoodNames = new ArrayList<String>(12) {
-        private static final long serialVersionUID = 2608083843312492007L;
-
-        {
-            this.add("电信服务");
-            this.add("基础电信服务");
-            this.add("语音通话服务");
-            this.add("出租或出售网络元素");
-            this.add("增值电信服务");
-            this.add("短信和彩信服务");
-            this.add("电子数据和信息的传输及应用服务");
-            this.add("互联网接入服务");
-            this.add("广播电视信号传输服务");
-            this.add("卫星电视信号落地转接服务");
-            this.add("其他增值电信服务");
-        }
-    };
-
-    public RecognitionCheckTaskEx(RequestContext ctx, String source, String pageId, JSONObject businessParam, Map<String, Object> customParam, String url, String fileName) {
-        saveCacheFile(pageId, url, "waiting");
-        this.ctx = ctx;
-        this.pageId = pageId;
-        this.businessParam = businessParam;
-        this.url = url;
-        this.source = source;
-        this.fileName = fileName;
-        this.customParam = customParam;
-    }
-
-    public JSONObject call() throws Exception {
-        logger.info("begin RecognitionCheckTask :{},{}", this.url, this.fileName);
-
-        try {
-            RequestContext.copyAndSet(this.ctx);
-            if (StringUtils.isEmpty(this.url)) {
-                return null;
-            } else {
-                JSONObject invoiceResult = new JSONObject();
-                Long orgId = RequestContext.get().getOrgId();
-                long rim_user;
-                if (this.customParam != null) {
-                    try {
-                        rim_user = BigDecimalUtil.transDecimal(this.customParam.get("orgId")).longValue();
-                        if (rim_user > 0L) {
-                            orgId = rim_user;
-                        }
-                    } catch (Exception var12) {
-                    }
-                }
-
-                if (this.businessParam != null) {
-                    rim_user = BigDecimalUtil.transDecimal(this.businessParam.get("rim_user")).longValue();
-                    if (rim_user < 1L) {
-                        this.businessParam.put("rim_user", RequestContext.get().getCurrUserId());
-                    }
-                }
-
-                boolean isNeedDeal = FileUtils.checkFileType(this.fileName, new String[]{"zip", "ofd", "pdf"});
-                if (isNeedDeal) {
-                    ElectAccVoucherService electAccVoucherService = new ElectAccVoucherService();
-                    invoiceResult = electAccVoucherService.dealVoucher(this.url, this.fileName, orgId, this.businessParam, (IRecognitionListener)null);
-                }
-
-                boolean isZipXmlEI = FileUtils.checkFileType(this.fileName, new String[]{"zip", "xml"});
-                if (isZipXmlEI && !"0000".equals(invoiceResult.getString("errcode"))) {
-                    invoiceResult = EInvoiceZipXmlDealService.analysisAndCheckSave(this.url, this.fileName, orgId, this.businessParam, (IRecognitionListener)null);
-                }
-
-                String xbrlErrCode = invoiceResult.getString("errcode");
-                boolean dealResult = StringUtils.isEmpty(xbrlErrCode) || !xbrlErrCode.equals("0000");
-                boolean isZip = FileUtils.checkFileType(this.fileName, new String[]{"zip"});
-                if (dealResult && !isZip) {
-                    if (FileUtils.isExcel(this.fileName)) {
-                        invoiceResult = ExcelInvoiceUploadService.getInstance().uploadExcelInvoice(this.url, this.fileName, (IRecognitionListener)null, this.businessParam);
-                    } else {
-                        logger.info("RecognitionCheckTask识别url:{}{}", this.fileName, this.url);
-                        invoiceResult = RecognitionCheckServiceEx.getInstance().recognitionCheckInvoice(this.url, this.fileName, (IRecognitionListener)null, this.businessParam);
-                    }
-                }
-
-                logger.info("发票助手本地上传最终数据返回:{}-{}", this.pageId, invoiceResult);
-                if (ResultContant.isSuccess(invoiceResult)) {
-                    JSONArray invoiceArray = invoiceResult.getJSONArray("data");
-                    classOfInvoice(invoiceArray);
-                    JSONArray failInvoiceArray = invoiceResult.getJSONArray("failData");
-                    JSONArray attachArray = invoiceResult.getJSONArray("attach");
-                    if (!CollectionUtils.isEmpty(failInvoiceArray)) {
-                        CacheHelper.put(this.pageId + "failResult", failInvoiceArray.toJSONString(), cache_time_out);
-                    }
-
-                    if (invoiceArray == null && attachArray == null) {
-                        saveCacheFile(this.pageId, this.url, "fail");
-                    } else {
-                        CacheHelper.put(this.pageId + "refresh", "1", cache_time_out);
-                        if ("fpzs".equals(this.source)) {
-                            Pair<JSONObject, Boolean> cachePair = FpzsMainService.cacheInvoiceList(this.pageId, this.customParam, invoiceArray, attachArray);
-                            if ((Boolean)cachePair.getRight()) {
-                                CacheHelper.put(this.pageId + "scannerProcessRepeat", cachePair.getRight() + "", cache_time_out);
-                            }
-                        } else {
-                            saveCacheFileResult(this.url, invoiceArray);
-                        }
-
-                        saveCacheFile(this.pageId, this.url, "success");
-                    }
-                } else {
-                    saveCacheFile(this.pageId, this.url, "fail");
-                    saveCacheCause(this.pageId, this.url, "fail", invoiceResult.getString("description"));
-                }
-
-                return invoiceResult;
-            }
-        } catch (Throwable var13) {
-            logger.info("RecognitionCheckTask throwable:{}", var13);
-            saveCacheFile(this.pageId, this.url, "fail");
-            saveCacheCause(this.pageId, this.url, "fail", ResManager.loadKDString("程序错误", "RecognitionCheckTask_0", "imc-rim-common", new Object[0]));
-            return new JSONObject();
-        }
-    }
-
-    public static void classOfInvoice(JSONArray invoiceArray) {
-        if (invoiceArray != null) {
-            for(int i = 0; i < invoiceArray.size(); ++i) {
-                JSONObject invoice = invoiceArray.getJSONObject(i);
-                Long invoiceType = invoice.getLong("invoiceType");
-                if (InputInvoiceTypeEnum.needClassOfInvoice(invoiceType)) {
-                    boolean telFlag = telType(invoice);
-                    boolean childFlag = childType(invoice);
-                    if (telFlag && childFlag) {
-                        setInvoiceClass(invoice, "11", "9");
-                    } else if (telFlag) {
-                        setInvoiceClass(invoice, "9");
-                    } else if (childFlag) {
-                        setInvoiceClass(invoice, "11");
-                    }
-                }
-            }
-
-        }
-    }
-
-    private static boolean childType(JSONObject invoice) {
-        boolean flag = false;
-        Long invoiceType = invoice.getLong("invoiceType");
-        if (InputInvoiceTypeEnum.FINANCIAL_INVOICE.getCode().equals(invoiceType)) {
-            String invoicingPartyName = invoice.getString("invoicingPartyName");
-            if (StringUtils.isNotEmpty(invoicingPartyName) && invoicingPartyName.contains("幼儿园")) {
-                flag = true;
-            }
-        } else if (InputInvoiceTypeEnum.ORDINARY_ELECTRON.getCode().equals(invoiceType) || InputInvoiceTypeEnum.ORDINARY_PAPER.getCode().equals(invoiceType) || InputInvoiceTypeEnum.GENERAL_ELECTRON.getCode().equals(invoiceType) || InputInvoiceTypeEnum.ELECTRIC_ORDINARY.getCode().equals(invoiceType)) {
-            JSONArray items = invoice.getJSONArray("items");
-            if (items == null) {
-                return false;
-            }
-
-            for(int i = 0; i < items.size(); ++i) {
-                JSONObject item = items.getJSONObject(i);
-                String goodName = item.getString("goodsName");
-                if (StringUtils.isNotEmpty(goodName) && goodName.contains("保教费")) {
-                    flag = true;
-                    break;
-                }
-            }
-        }
-
-        return flag;
-    }
-
-    private static boolean telType(JSONObject invoice) {
-        Long invoiceType = invoice.getLong("invoiceType");
-        boolean telFlag = false;
-        if (InputInvoiceTypeEnum.ORDINARY_ELECTRON.getCode().equals(invoiceType) || InputInvoiceTypeEnum.SPECIAL_ELECTRON.getCode().equals(invoiceType) || InputInvoiceTypeEnum.ORDINARY_PAPER.getCode().equals(invoiceType) || InputInvoiceTypeEnum.SPECIAL_PAPER.getCode().equals(invoiceType) || InputInvoiceTypeEnum.TOLL_ELECTRON.getCode().equals(invoiceType) || InputInvoiceTypeEnum.ELECTRIC_ORDINARY.getCode().equals(invoiceType) || InputInvoiceTypeEnum.ELECTRIC_SPECIAL.getCode().equals(invoiceType) || InputInvoiceTypeEnum.GENERAL_ELECTRON.getCode().equals(invoiceType)) {
-            JSONArray items = invoice.getJSONArray("items");
-            if (items == null) {
-                return false;
-            }
-
-            boolean flag = false;
-
-            for(int i = 0; i < items.size(); ++i) {
-                JSONObject item = items.getJSONObject(i);
-                String goodName = item.getString("goodsName");
-                Iterator var8 = telGoodNames.iterator();
-
-                while(var8.hasNext()) {
-                    String s = (String)var8.next();
-                    if (goodName.contains(s)) {
-                        telFlag = true;
-                        flag = true;
-                        break;
-                    }
-                }
-
-                if (flag) {
-                    break;
-                }
-            }
-        }
-
-        return telFlag;
-    }
-
-    private static void setInvoiceClass(JSONObject invoice, String... classType) {
-        Long mainId = invoice.getLong("mainId");
-        DynamicObject invoices = BusinessDataServiceHelper.loadSingle("rim_invoice", "id, mul_class, ext_info", new QFilter[]{new QFilter("id", "=", mainId)});
-        if (invoices != null) {
-            String mulClassStr = String.join(",", classType);
-            String extInfo = invoices.getString("ext_info");
-            JSONObject extObject = new JSONObject();
-            if (StringUtils.isNotEmpty(extInfo)) {
-                try {
-                    extObject = JSONObject.parseObject(extInfo);
-                } catch (Exception var13) {
-                    extObject = new JSONObject();
-                }
-            }
-
-            extObject.put("sys_mulclass", mulClassStr);
-            invoices.set("ext_info", extObject.toString());
-            DynamicObjectCollection mul_class = invoices.getDynamicObjectCollection("mul_class");
-            if (CollectionUtils.isEmpty(mul_class)) {
-                String[] var8 = classType;
-                int var9 = classType.length;
-
-                for(int var10 = 0; var10 < var9; ++var10) {
-                    String typeStr = var8[var10];
-                    DynamicObject classInfo = mul_class.addNew();
-                    classInfo.set("fbasedataid_id", typeStr);
-                    SaveServiceHelper.save(new DynamicObject[]{invoices});
-                }
-            }
-        }
-
-    }
-
-    public JSONObject getBusinessParam() {
-        return this.businessParam;
-    }
-
-    public void setBusinessParam(JSONObject businessParam) {
-        this.businessParam = businessParam;
-    }
-
-    public String getUrl() {
-        return this.url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    public static void saveCacheFileResult(String url, JSONArray result) {
-        if (result != null) {
-            CacheHelper.put(MD5.md5Hex(url), result.toJSONString(), cache_time_out);
-        } else {
-            CacheHelper.remove(MD5.md5Hex(url));
-        }
-
-    }
-
-    public static JSONArray queryCacheFileResult(String url) {
-        String result = CacheHelper.get(MD5.md5Hex(url));
-        return result != null ? JSONArray.parseArray(result) : new JSONArray();
-    }
-
-    public static void saveCacheFile(String pageId, String url, String operate) {
-        cacheFile(pageId, url, operate);
-    }
-
-    public static void saveCacheCause(String pageId, String url, String operate, String cause) {
-        cacheCause(pageId, url, operate, cause);
-    }
-
-    public static JSONObject queryCacheFile(String pageId) {
-        return cacheFile(pageId, (String)null, "query");
-    }
-
-    public static JSONObject queryCacheCause(String pageId) {
-        return cacheCause(pageId, (String)null, "query", (String)null);
-    }
-
-    public static void clearCacheFile(String pageId) {
-        cacheFile(pageId, (String)null, "remove");
-    }
-
-    private static JSONObject cacheCause(String pageId, String url, String operate, String cause) {
-        logger.info(pageId + url + operate + cause);
-        if (StringUtils.isEmpty(pageId)) {
-            return null;
-        } else {
-            String cacheKey = "scaner_cause_" + pageId;
-            DLock lock = DLock.create("lock_" + cacheKey, ResManager.loadKDString("刷新卡片锁", "RecognitionCheckTask_1", "imc-rim-common", new Object[0]));
-            Throwable var6 = null;
-
-            try {
-                int times = 0;
-
-                while(times < 10) {
-                    ++times;
-                    if (lock.tryLock(100L)) {
-                        try {
-                            String cache;
-                            if ("remove".equals(operate)) {
-                                CacheHelper.remove(cacheKey);
-                                cache = null;
-                                return null;
-                            }
-
-                            cache = CacheHelper.get(cacheKey);
-                            JSONObject obj = null;
-                            if (StringUtils.isEmpty(cache)) {
-                                obj = new JSONObject();
-                            } else {
-                                obj = JSON.parseObject(cache);
-                            }
-
-                            JSONObject var10;
-                            if ("query".equals(operate)) {
-                                var10 = obj;
-                                return var10;
-                            }
-
-                            if (StringUtils.isNotEmpty(url) && StringUtils.isNotEmpty(operate) && StringUtils.isNotEmpty(cause)) {
-                                obj.put(url, cause);
-                                CacheHelper.put(cacheKey, obj.toJSONString(), cache_time_out);
-                            }
-
-                            var10 = obj;
-                            return var10;
-                        } finally {
-                            lock.unlock();
-                        }
-                    }
-                }
-            } catch (Throwable var29) {
-                var6 = var29;
-                throw var29;
-            } finally {
-                if (lock != null) {
-                    if (var6 != null) {
-                        try {
-                            lock.close();
-                        } catch (Throwable var27) {
-                            var6.addSuppressed(var27);
-                        }
-                    } else {
-                        lock.close();
-                    }
-                }
-
-            }
-
-            return null;
-        }
-    }
-
-    private static JSONObject cacheFile(String pageId, String url, String operate) {
-        logger.info(pageId + url + operate);
-        if (StringUtils.isEmpty(pageId)) {
-            return null;
-        } else {
-            String cacheKey = "scaner_" + pageId;
-            DLock lock = DLock.create("lock_" + cacheKey, ResManager.loadKDString("刷新卡片锁", "RecognitionCheckTask_1", "imc-rim-common", new Object[0]));
-            Throwable var5 = null;
-
-            JSONObject var11;
-            try {
-                int times = 0;
-
-                do {
-                    if (times >= 10) {
-                        return null;
-                    }
-
-                    ++times;
-                } while(!lock.tryLock(100L));
-
-                long starttime = System.currentTimeMillis();
-
-                try {
-                    String cache;
-                    if ("remove".equals(operate)) {
-                        CacheHelper.remove(cacheKey);
-                        cache = null;
-                        return null;
-                    }
-
-                    cache = CacheHelper.get(cacheKey);
-                    JSONObject obj = null;
-                    if (StringUtils.isEmpty(cache)) {
-                        obj = new JSONObject();
-                    } else {
-                        obj = JSON.parseObject(cache);
-                    }
-
-                    if ("query".equals(operate)) {
-                        var11 = obj;
-                        return var11;
-                    }
-
-                    if (StringUtils.isNotEmpty(url) && StringUtils.isNotEmpty(operate)) {
-                        obj.put(url, operate);
-                        CacheHelper.put(cacheKey, obj.toJSONString(), cache_time_out);
-                    }
-
-                    var11 = obj;
-                } finally {
-                    logger.info("cacheFile总耗时:{}-{}", pageId, System.currentTimeMillis() - starttime);
-                    lock.unlock();
-                }
-            } catch (Throwable var30) {
-                var5 = var30;
-                throw var30;
-            } finally {
-                if (lock != null) {
-                    if (var5 != null) {
-                        try {
-                            lock.close();
-                        } catch (Throwable var28) {
-                            var5.addSuppressed(var28);
-                        }
-                    } else {
-                        lock.close();
-                    }
-                }
-
-            }
-
-            return var11;
-        }
-    }
-
-    public String getSource() {
-        return this.source;
-    }
-
-    public void setSource(String source) {
-        this.source = source;
-    }
-
-    public Map<String, Object> getCustomParam() {
-        return this.customParam;
-    }
-
-    public void setCustomParam(Map<String, Object> customParam) {
-        this.customParam = customParam;
-    }
-}

+ 0 - 267
src/main/java/kd/imc/rim/ScannerServiceEx.java

@@ -1,267 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by FernFlower decompiler)
-//
-
-package kd.imc.rim;
-
-import com.alibaba.fastjson.JSONObject;
-import java.util.Map;
-import kd.bos.context.RequestContext;
-import kd.bos.dataentity.resource.ResManager;
-import kd.bos.ext.form.control.CustomControl;
-import kd.bos.form.ConfirmCallBackListener;
-import kd.bos.form.ConfirmTypes;
-import kd.bos.form.MessageBoxOptions;
-import kd.bos.form.plugin.AbstractFormPlugin;
-import kd.bos.logging.Log;
-import kd.bos.logging.LogFactory;
-import kd.bos.threads.ThreadPool;
-import kd.bos.threads.ThreadPools;
-import kd.imc.rim.common.invoice.collector.ScannerService;
-import kd.imc.rim.common.utils.BigDecimalUtil;
-import kd.imc.rim.common.utils.FileUploadUtils;
-import kd.imc.rim.common.utils.ImcConfigUtil;
-import kd.imc.rim.common.utils.RimConfigUtils;
-import org.apache.commons.lang3.StringUtils;
-
-public class ScannerServiceEx {
-    private static final int threadNum = 5;
-    private static ThreadPool checkThreadPool = ThreadPools.newFixedThreadPool("scanner_check_pool_Ex", 5);
-    private static final Log LOGGER = LogFactory.getLog(ScannerService.class);
-    public static final String operate_invoice = "invoice";
-    public static final String operate_attach = "attach";
-
-    public ScannerServiceEx() {
-    }
-
-    public static void startWebScoket(CustomControl control, String linkKey) {
-        RequestContext request = RequestContext.get();
-        String socketUrl = request.getClientFullContextPath() + "msgwatch/?identifytype=" + linkKey + "&tenantsessionkey=KERPSESSIONID" + request.getTenantId();
-        if (socketUrl.startsWith("https")) {
-            socketUrl = "wss" + socketUrl.substring(5);
-        } else if (socketUrl.startsWith("http")) {
-            socketUrl = "ws" + socketUrl.substring(4);
-        }
-
-        JSONObject map = new JSONObject();
-        map.put("operate", "open");
-        map.put("qrcodeType", "cloudhub");
-        map.put("socketUrl", socketUrl);
-        map.put("linkKey", linkKey);
-        map.put("enableWebSocket", "1");
-        if ("0".equals(RimConfigUtils.getConfig("rim_fpzs", "enablesocket"))) {
-            map.put("enableWebSocket", "0");
-        }
-
-        map.put("time", System.currentTimeMillis());
-        LOGGER.info("startWebScoket:" + JSONObject.toJSONString(map));
-        control.setData(map);
-    }
-
-    public static void startInterval(CustomControl control) {
-        JSONObject json = new JSONObject();
-        json.put("time", 1000);
-        json.put("millisec", 1000);
-        json.put("request", System.currentTimeMillis());
-        control.setData(json);
-    }
-
-    public static void removeUpload(CustomControl control) {
-        JSONObject map1 = new JSONObject();
-        map1.put("operate", "remove");
-        map1.put("fid", control.getView().getEntityId());
-        control.setData(map1);
-    }
-
-    public static void initUpload(CustomControl control, boolean canImportExcels, String title) {
-        JSONObject map1 = new JSONObject();
-        RequestContext request = RequestContext.get();
-        map1.put("operate", "init");
-        map1.put("pageId", control.getView().getPageId());
-        map1.put("uploadUrl", request.getClientFullContextPath() + "attachment/upload.do");
-        map1.put("title", title);
-        Map<String, String> rimFpzsConfig = ImcConfigUtil.getValue("rim_fpzs");
-        int maxfilesize = BigDecimalUtil.transDecimal(rimFpzsConfig.get("maxfilesize")).intValue();
-        if (maxfilesize < 1) {
-            maxfilesize = 10;
-        }
-
-        map1.put("maxFileSize", maxfilesize);
-        setImageCompress(map1, rimFpzsConfig);
-        map1.put("fid", control.getView().getEntityId());
-        map1.put("loadMsg", ResManager.loadKDString("上传中..", "ScannerService_0", "imc-rim-common", new Object[0]));
-        map1.put("canImportExcels", canImportExcels);
-        control.setData(map1);
-    }
-
-    public static void setImageCompress(Map<String, Object> map1, Map<String, String> rimFpzsConfig) {
-        double fileLimitSize = 3.0;
-        double fileQuality = 0.98;
-        int fileLimitPixel = 1500;
-        if (rimFpzsConfig != null && StringUtils.isNotEmpty((CharSequence)rimFpzsConfig.get("imageCompress"))) {
-            String imageCompress = (String)rimFpzsConfig.get("imageCompress");
-            String[] str = imageCompress.split(",");
-            double limitSize;
-            if (str.length > 0) {
-                limitSize = BigDecimalUtil.transDecimal(str[0]).doubleValue();
-                if (limitSize > 0.0 && limitSize <= 8.0) {
-                    fileLimitSize = limitSize;
-                }
-            }
-
-            if (str.length > 1) {
-                limitSize = BigDecimalUtil.transDecimal(str[1]).doubleValue();
-                if (limitSize > 0.0) {
-                    fileQuality = limitSize;
-                }
-            }
-
-            if (str.length > 2) {
-                 limitSize = BigDecimalUtil.transDecimal(str[2]).intValue();
-                if (limitSize > 0) {
-                    fileLimitPixel = (int) limitSize;
-                }
-            }
-        }
-
-        map1.put("fileLimitSize", fileLimitSize);
-        map1.put("fileQuality", fileQuality);
-        map1.put("fileLimitPixel", fileLimitPixel);
-    }
-
-    public static void upload(CustomControl control) {
-        JSONObject map1 = new JSONObject();
-        map1.put("operate", "upload");
-        map1.put("time", System.currentTimeMillis());
-        control.setData(map1);
-    }
-
-    public static void init(CustomControl control, String pageId) {
-        RequestContext request = RequestContext.get();
-        JSONObject map1 = new JSONObject();
-        map1.put("pageId", pageId);
-        map1.put("init", "init");
-        map1.put("savePath", FileUploadUtils.getInvoiceDir("invoice") + pageId + "");
-        map1.put("uploadUrl", request.getClientFullContextPath() + "attachment/upload.do");
-        map1.put("time", System.currentTimeMillis());
-        map1.put("fid", control.getView().getEntityId());
-        setScannerParam(map1);
-        map1.put("downloadUrl", getJsScanner());
-        control.setData(map1);
-    }
-
-    public static void scanner(CustomControl control, String pageId, String operate) {
-        RequestContext request = RequestContext.get();
-        JSONObject map1 = new JSONObject();
-        map1.put("pageId", pageId);
-        map1.put("operate", operate);
-        map1.put("savePath", FileUploadUtils.getInvoiceDir("invoice") + pageId + "");
-        String contextPath = request.getClientFullContextPath();
-        if (contextPath.endsWith("/")) {
-            contextPath = contextPath.substring(0, contextPath.length() - 1);
-        }
-
-        map1.put("contextPath", contextPath);
-        map1.put("uploadUrl", contextPath + "/attachment/upload.do");
-        map1.put("time", System.currentTimeMillis());
-        map1.put("fid", control.getView().getEntityId());
-        setScannerParam(map1);
-        map1.put("downloadUrl", getJsScanner());
-        control.setData(map1);
-    }
-
-    private static void setScannerParam(JSONObject param) {
-        Map<String, String> map = ImcConfigUtil.getValue("rim_fpzs");
-        String resolution = null;
-        String scannerType = null;
-        String limitpixel = null;
-        if (map != null) {
-            resolution = StringUtils.trimToEmpty((String)map.get("resolution"));
-            scannerType = StringUtils.trimToEmpty((String)map.get("scanner_type"));
-            limitpixel = StringUtils.trimToEmpty((String)map.get("limitpixel"));
-        }
-
-        if (StringUtils.isEmpty(scannerType)) {
-            scannerType = "rq";
-        }
-
-        if (map != null && "dm".equals(scannerType)) {
-            param.put("productKey", map.get("productkey"));
-        }
-
-        if (StringUtils.isEmpty(resolution)) {
-            resolution = "100";
-        }
-
-        if (StringUtils.isEmpty(limitpixel)) {
-            limitpixel = "2000";
-        }
-
-        param.put("scannerType", scannerType);
-        param.put("resolution", resolution);
-        param.put("fileLimitPixel", limitpixel);
-        param.put("loadMsg", ResManager.loadKDString("扫描上传中..", "ScannerService_1", "imc-rim-common", new Object[0]));
-    }
-
-    public static boolean scannerFail(AbstractFormPlugin plugin, String eventArgs) {
-        if (eventArgs != null) {
-            if (eventArgs.indexOf("JsScanner.msi") > 0) {
-                plugin.getView().showConfirm(ResManager.loadKDString("扫描仪需要安装JsScanner,是否安装?", "ScannerService_2", "imc-rim-common", new Object[0]), MessageBoxOptions.YesNo, ConfirmTypes.Default, new ConfirmCallBackListener("downJsScanner", plugin));
-                return false;
-            }
-
-            if (eventArgs.indexOf("websocket connect error") > 0) {
-                plugin.getView().showTipNotification(ResManager.loadKDString("请确认已经连接并打开扫描仪!", "ScannerService_3", "imc-rim-common", new Object[0]), 3000);
-                return false;
-            }
-
-            if (eventArgs.indexOf("No data source found in this environment") > 0) {
-                plugin.getView().showTipNotification(ResManager.loadKDString("请检查是否正确安装扫描仪驱动!", "ScannerService_4", "imc-rim-common", new Object[0]), 3000);
-                return false;
-            }
-
-            JSONObject js = JSONObject.parseObject(eventArgs);
-            if (js != null) {
-                String description = js.getString("description");
-                if (!StringUtils.isEmpty(description)) {
-                    plugin.getView().showTipNotification(description, 3000);
-                    return true;
-                }
-            }
-        }
-
-        plugin.getView().showErrorNotification(eventArgs);
-        return false;
-    }
-
-    public static boolean uploadFinish(String eventArgs) {
-        return eventArgs != null && (eventArgs.indexOf("cancelSelectSource") > 0 || eventArgs.indexOf("confirmDownload") > 0 || eventArgs.indexOf("cancelDownload") > 0);
-    }
-
-    public static String getJsScanner() {
-        RequestContext request = RequestContext.get();
-        return request.getClientFullContextPath() + "kingdee/imc/scanner/rq-scanner/lib/JsScanner.msi";
-    }
-
-    public static void downJsScanner(AbstractFormPlugin plugin) {
-        RequestContext request = RequestContext.get();
-        plugin.getView().openUrl(request.getClientFullContextPath() + "kingdee/imc/scanner/rq-scanner/lib/JsScanner.msi");
-    }
-
-    public static void recognitionInvoice(String source, String pageId, String url, String fileName, JSONObject businessParam, Map<String, Object> customParam) {
-        LOGGER.info("Scanner recognitionInvoice...");
-        RecognitionCheckTaskEx task = new RecognitionCheckTaskEx(RequestContext.get(), source, pageId, businessParam, customParam, url, fileName);
-        checkThreadPool.submit(task);
-    }
-
-    public static Long getUploadIndex(JSONObject uploadResult) {
-        Long index = BigDecimalUtil.transDecimal(uploadResult.get("index")).longValue();
-        Long timeStamp = uploadResult.getLong("uploadTimeStamp");
-        if (timeStamp == null) {
-            timeStamp = System.currentTimeMillis();
-        }
-
-        return timeStamp + index;
-    }
-}

+ 0 - 266
src/main/java/kd/imc/rim/utils/ApiHttpUtils.java

@@ -1,266 +0,0 @@
-package kd.imc.rim.utils;
-
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import javassist.Loader;
-import kd.bos.dataentity.entity.DynamicObject;
-import kd.bos.orm.query.QCP;
-import kd.bos.orm.query.QFilter;
-import kd.bos.script.annotations.KSObject;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.util.EntityUtils;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Base64;
-import java.util.Date;
-import java.util.Iterator;
-
-
-@KSObject
-public class ApiHttpUtils {
-
-    public static String Posthttp(String url, String Params){
-        // 获得Http客户端
-        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
-        // 创建Post请求
-        //设置请求路径
-        HttpPost httpPost = new HttpPost(url);
-        httpPost.setHeader("Content-type", "application/json;charset=utf-8");
-        JSONObject object = new JSONObject();
-        JSONObject head = new JSONObject();
-        head.put("mesgtype","bills_crop_base64");
-        head.put("channelcode","JSX");
-        Date date = new Date();
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
-        String formatDate = dateFormat.format(date);
-        head.put("channeldate",formatDate);
-        LocalDateTime now = LocalDateTime.now();
-        DateTimeFormatter hHmmss = DateTimeFormatter.ofPattern("HHmmss");
-        DateTimeFormatter yyyyMMddHHmmssSSSS = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSSS");
-        String channeltime = now.format(hHmmss);
-        String hHmmssSSS1 = now.format(yyyyMMddHHmmssSSSS);
-        head.put("channeltime",channeltime);
-        head.put("channelserno",hHmmssSSS1);
-        head.put("bron","");
-        head.put("tellerno","");
-        head.put("reserve","");
-        head.put("dealcode","");
-        head.put("dealmsg","");
-        head.put("App_key","XYK_DEJ_Key");
-        head.put("APP_secret","XYK_DEJ_SECRET");
-        JSONObject body = new JSONObject();
-        body.put("file_base64",Params);
-        object.put("head",head);
-        object.put("body",body);
-        StringEntity entity = new StringEntity(object.toString(), ContentType.APPLICATION_JSON);
-        httpPost.setEntity(entity);
-        // 响应模型(发送post请求)
-        CloseableHttpResponse response = null;
-        try {
-            response = httpClient.execute(httpPost);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-        // 从响应模型中获取响应实体
-        HttpEntity responseEntity = response.getEntity();
-        JSONObject jsonObject = new JSONObject();
-        if (responseEntity != null) {
-            try {
-                jsonObject = JSON.parseObject(EntityUtils.toString(response.getEntity()));
-                JSONArray jsonArray = jsonObject.getJSONObject("boby").getJSONArray("object_list");
-                return jsonArray.toJSONString();
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-        }
-        // 释放资源
-        if (httpClient != null) {
-            try {
-                httpClient.close();
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-        }
-        if (response != null) {
-            try {
-                response.close();
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-        }
-        return "";
-    }
-
-    public static String HttpPostExample () {
-        try { // 图片路径
-             String imagePath = "path_to_your_image_file.jpg";
-            // 将图片转换为Base64编码
-             byte[] imageBytes = java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(imagePath));
-            String base64Image = Base64.getEncoder().encodeToString(imageBytes);
-            // 创建URL对象
-            URL url = new URL("http://10.3.2.70:8115");
-             //打开HTTP连接
-             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-             connection.setRequestMethod("POST");
-             connection.setRequestProperty("Content-Type", "application/json");
-             connection.setRequestProperty("channelcode", "your_channel_code");
-             connection.setRequestProperty("channeldate", "your_channel_date");
-             connection.setDoOutput(true); // 将Base64编码的图片作为请求体发送
-             try (OutputStream os = connection.getOutputStream())
-             { os.write(base64Image.getBytes()); os.flush(); }
-             //检查响应代码
-             int responseCode = connection.getResponseCode();
-             if (responseCode == HttpURLConnection.HTTP_OK) {
-             System.out.println("Request was successful.");
-             } else { System.out.println("Request failed. Response Code: " + responseCode); }
-            // 关闭连接
-            connection.disconnect(); }
-             catch (Exception e) { e.printStackTrace(); }
-        return null;
-    }
-    public static String toFiledata(String Params) throws Exception {
-        //组装发票数据结构 !
-        JSONObject json = new JSONObject();//返回最外层json
-        json.put("errcode","0000");
-        json.put("traceId","");
-        json.put("description","操作成功");
-        JSONObject data = new JSONObject();//数据层json
-        json.put("batchNo","");
-        JSONArray recoginitionData = new JSONArray();//数据层数组
-        if("".equals(Params)){return null;};
-        JSONArray objects = JSONArray.parseArray(Params);
-        for(int a=0;a<objects.size();a++){
-            Object object = objects.get(a);
-            JSONObject respenjson = (JSONObject) JSONObject.toJSON(object);
-            String type_description = respenjson.getString("type_description");//增值税电子普通发票  行程单  通用定额发票 火车票
-            if("".equals(type_description)){return null;};
-            JSONArray itemList = respenjson.getJSONArray("item_list");
-            JSONObject item_list = new JSONObject();
-            for (int i=0;i<itemList.size();i++){
-                Object obj = itemList.get(i);
-                JSONObject respenjsons = (JSONObject) JSONObject.toJSON(obj);
-                String key = respenjsons.get("key").toString();// 获得key
-                String value = respenjsons.get("value").toString();// 获得value
-                item_list.put(key,value);
-            }
-            if("行程单".equals(type_description)){
-                JSONArray flight_data_list = respenjson.getJSONArray("flight_data_list");
-                for (int i=0;i<flight_data_list.size();i++){
-                    Object obj = flight_data_list.get(i);
-                    JSONArray xcobj = JSONArray.parseArray(obj.toString());
-                    for(int c=0;c<xcobj.size();c++){
-                        Object objc = flight_data_list.get(c);
-                        JSONObject respenjsons = (JSONObject) JSONObject.toJSON(objc);
-                        String key = respenjsons.get("key").toString();// 获得key
-                        String value = respenjsons.get("value").toString();// 获得value
-                        item_list.put(key,value);
-                    }
-                }
-            }
-                QFilter nckd_File = new QFilter("nckd_filetype", QCP.equals, type_description);
-                DynamicObject nckd_FileData = BusinessDataServiceHelper.loadSingle("nckd_filedataconvert", "id,nckd_filetype", new QFilter[]{nckd_File});
-                JSONObject Filedata = FileData(nckd_FileData,item_list);
-                recoginitionData.add(Filedata);
-        }
-        data.put("recoginitionData",recoginitionData);
-        json.put("data",data);
-        return json.toString();
-    }
-
-    //增值税电子普通发票
-    public static JSONObject FileData(DynamicObject nckd_FileData,JSONObject item_list) throws Exception {
-        JSONObject fileObj = new JSONObject();//实际数据json
-        for (DynamicObject entryentity : nckd_FileData.getDynamicObjectCollection("nckd_treeentryentity")) {
-            String nckd_keingde = entryentity.getString("nckd_keingde");
-            String nckd_ocr = entryentity.getString("nckd_ocr");
-            String nckd_acquiesce = entryentity.getString("nckd_acquiesce");
-            if(!"".equals(nckd_ocr) && nckd_ocr!=null){
-                fileObj.put(nckd_keingde,item_list.getString(nckd_ocr));
-            }else if(!"".equals(nckd_acquiesce) && nckd_ocr!=null){
-                fileObj.put(nckd_keingde,nckd_acquiesce);
-            }else {
-                fileObj.put(nckd_keingde,"");
-            }
-        }
-        return fileObj;
-    }
-    //机票行程单
-    public static String jpxcd(JSONObject item_list) throws Exception {
-
-        return null;
-    }
-    //火车票
-    public static String hcp(JSONObject item_list) throws Exception {
-        //组装发票数据结构 !
-        JSONObject json = new JSONObject();//返回最外层json
-        json.put("errcode","0000");
-        json.put("traceId","");
-        json.put("description","操作成功");
-        JSONObject data = new JSONObject();//数据层json
-        json.put("batchNo","");
-        JSONArray recoginitionData = new JSONArray();//数据层数组
-        JSONObject fileObj = new JSONObject();//实际数据json
-        fileObj.put("canBeDeduction","");//0
-        fileObj.put("stationGetOn",item_list.getString("departure_station"));//出发站  ocr字段:departure_station
-        fileObj.put("passengerName",item_list.getString("passenger_name"));//乘客 ocr字段:passenger_name
-        fileObj.put("signStatus","");//0
-        fileObj.put("downloadUrl","");//下载地址链接
-        fileObj.put("fileHash","");//文件哈希值
-        fileObj.put("seatNumber",item_list.getString("seat_number"));//座位 ocr字段:seat_number
-        fileObj.put("localUrl","");//预览链接
-        fileObj.put("trainNum",item_list.getString("train_number"));//车次编号  ocr字段:train_number
-        fileObj.put("trainTime","");//
-        fileObj.put("stationGetOff",item_list.getString("arrival_station"));//目的地 ocr字段:arrival_station
-        fileObj.put("deductionStatus",1);
-        fileObj.put("invoiceType","9");//发票类型
-        fileObj.put("isRepeat",false);//是否重复
-        fileObj.put("pixel","");//未知
-        fileObj.put("oriImageSize","");//未知
-        fileObj.put("pdfToImgSnapshotUrl","");//“”
-        fileObj.put("orientation","0");//null
-        fileObj.put("batchNo","");//
-        fileObj.put("warningCode","1");//
-        fileObj.put("originalState",0);//
-        fileObj.put("originalUrl","");//""
-        fileObj.put("invoiceDate",item_list.getString("departure_date"));//乘车日期  ocr字段:departure_date
-        fileObj.put("serialNo","");//
-        fileObj.put("seat",item_list.getString("class"));//几等座 ocr字段:class
-        fileObj.put("totalAmount",item_list.getString("price"));//票价  ocr字段:price
-        fileObj.put("taxRate","");//
-        fileObj.put("customerIdentityNum",item_list.getString("passenger_id"));//身份证 ocr字段 passenger_id
-        fileObj.put("oriOrientation","0");//
-        fileObj.put("oriRegion","0");//
-        fileObj.put("rotationAngle","");//未知字段
-        fileObj.put("snapshotUrl","");//
-        fileObj.put("imageSerialNo","");//未知字段
-        fileObj.put("printingSequenceNo",item_list.getString("number"));//发票号码 ocr字段 number
-        fileObj.put("recognitionSerialNo","");//
-        fileObj.put("businessType",1);//未知字段
-        fileObj.put("region","");//
-        //值拼接完成后开始set数据结构e
-        recoginitionData.add(fileObj);
-        data.put("recoginitionData",recoginitionData);
-        json.put("data",data);
-        return json.toJSONString();
-    }
-    //通用定额发票
-    public static String tydefp(JSONObject item_list) throws Exception {
-
-        return null;
-    }
-}

+ 0 - 310
src/main/java/kd/imc/rim/utils/CodecUtil.java

@@ -1,310 +0,0 @@
-package kd.imc.rim.utils;
-
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import kd.bos.script.annotations.KSObject;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.util.Base64Utils;
-
-import javax.crypto.Cipher;
-import javax.crypto.KeyGenerator;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-
-/**
- * @author bi lei
- * @date 2020/12/18 10:35
- */
-@KSObject
-public class CodecUtil {
-    private static final Logger logger = LoggerFactory.getLogger(CodecUtil.class);
-    private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
-
-    /**
-     * AES加密密钥
-     */
-    public static final byte[] AES_SECRET_KEY_BYTES = Base64Utils.decodeFromString("KSKiOQgLKcdaCZLbnkgG7V==");
-
-    /**
-     * SHA1加密密钥(用于增加加密的复杂度)
-     */
-    public static final String SHA1_SECRET_KEY = "uErQ0KY3J2CwttyuaeEYR2==";
-
-    /**
-     * 对业务数据进行加密,用AES加密再用Base64编码
-     *
-     * @param data 待加密数据
-     * @return
-     */
-    public static String aesEncrypt(String data) {
-        try {
-            // 加密算法/工作模式/填充方式
-            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-            byte[] dataBytes = data.getBytes("UTF-8");
-            cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(AES_SECRET_KEY_BYTES, "AES"));
-            byte[] result = cipher.doFinal(dataBytes);
-            return Base64Utils.encodeToString(result);
-        } catch (Exception e) {
-            logger.error("执行CodecUtil.aesEncrypt失败:data={},异常:{}", data, e);
-        }
-        return null;
-    }
-
-    /**
-     * 对业务数据进行加密,用AES解密
-     *
-     * @param encryptedDataBase64
-     * @return
-     */
-    public static String aesDecrypt(String encryptedDataBase64) {
-        try {
-            // 加密算法/工作模式/填充方式
-            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-            byte[] dataBytes = Base64Utils.decodeFromString(encryptedDataBase64);
-            cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(AES_SECRET_KEY_BYTES, "AES"));
-            byte[] result = cipher.doFinal(dataBytes);
-            return new String(result);
-        } catch (Exception e) {
-            logger.error("执行CodecUtil.aesDecrypt失败:data={},异常:{}", encryptedDataBase64, e);
-        }
-        return null;
-    }
-
-
-    /**
-     * 对业务数据进行加密,用AES加密再用Base64编码
-     *
-     * @param data 待加密数据
-     * @return
-     */
-    public static String aesEncrypt(String data,String chartsetName) {
-        try {
-            // 加密算法/工作模式/填充方式
-            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-            if(chartsetName == null || chartsetName.length()==0){
-                chartsetName = "UTF-8";
-            }
-            byte[] dataBytes = data.getBytes(chartsetName);
-            cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(AES_SECRET_KEY_BYTES, "AES"));
-            byte[] result = cipher.doFinal(dataBytes);
-            return Base64Utils.encodeToString(result);
-        } catch (Exception e) {
-            logger.error("执行CodecUtil.aesEncrypt失败:data={},异常:{}", data, e);
-        }
-        return null;
-    }
-
-    /**
-     * 对业务数据进行加密,用AES解密
-     *
-     * @param encryptedDataBase64
-     * @return
-     */
-    public static String aesDecryp(String encryptedDataBase64,String chartsetName) {
-        try {
-            // 加密算法/工作模式/填充方式
-            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-            byte[] dataBytes = Base64Utils.decodeFromString(encryptedDataBase64);
-            cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(AES_SECRET_KEY_BYTES, "AES"));
-            byte[] result = cipher.doFinal(dataBytes);
-            if(chartsetName == null || chartsetName.length()==0){
-                chartsetName = "UTF-8";
-            }
-            return new String(result,chartsetName);
-        } catch (Exception e) {
-            logger.error("执行CodecUtil.aesDecrypt失败:data={},异常:{}", encryptedDataBase64, e);
-        }
-        return null;
-    }
-
-
-    /**
-     * 对业务数据进行加密,用AES解密
-     *
-     * @param encryptedDataBase64
-     * @return
-     */
-    public static String aesDecrypt(String encryptedDataBase64,byte[] aesSecretKeyBytes) {
-        try {
-            // 加密算法/工作模式/填充方式
-            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-            byte[] dataBytes = Base64Utils.decodeFromString(encryptedDataBase64);
-            cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(aesSecretKeyBytes, "AES"));
-            byte[] result = cipher.doFinal(dataBytes);
-            return new String(result);
-        } catch (Exception e) {
-            logger.error("执行CodecUtil.aesDecrypt失败:data={},异常:{}", encryptedDataBase64, e);
-        }
-        return null;
-    }
-
-    /**
-     * 对业务数据进行加密,用AES解密
-     *
-     * @param encryptedDataBase64
-     * @return
-     */
-    public static String aesDecrypt(String encryptedDataBase64,byte[] aesSecretKeyBytes,String chartsetName) {
-        try {
-            // 加密算法/工作模式/填充方式
-            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-            byte[] dataBytes = Base64Utils.decodeFromString(encryptedDataBase64);
-            cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(aesSecretKeyBytes, "AES"));
-            byte[] result = cipher.doFinal(dataBytes);
-
-            if(chartsetName == null || chartsetName.length()==0){
-                chartsetName = "UTF-8";
-            }
-            return new String(result,chartsetName);
-        } catch (Exception e) {
-            logger.error("执行CodecUtil.aesDecrypt失败:data={},异常:{}", encryptedDataBase64, e);
-        }
-        return null;
-    }
-
-    /**
-     * 对业务数据进行加密,用AES加密再用Base64编码
-     *
-     * @param data 待加密数据
-     * @return
-     */
-    public static String aesEncrypt(String data,byte[] AES_SECRET_KEY_BYTES) {
-        try {
-            // 加密算法/工作模式/填充方式
-            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-            byte[] dataBytes = data.getBytes(DEFAULT_CHARSET);
-            cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(AES_SECRET_KEY_BYTES, "AES"));
-            byte[] result = cipher.doFinal(dataBytes);
-            return Base64Utils.encodeToString(result);
-        } catch (Exception e) {
-            logger.error("执行CodecUtil.aesEncrypt失败:data={},异常:{}", data, e);
-        }
-        return null;
-    }
-
-    /**
-     * 对业务数据进行加密,用AES解密
-     *
-     * @param encryptedDataBase64
-     * @return
-     */
-    public static String aesDecryp(String encryptedDataBase64,byte[] AES_SECRET_KEY_BYTES) {
-        try {
-            // 加密算法/工作模式/填充方式
-            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-            byte[] dataBytes = Base64Utils.decodeFromString(encryptedDataBase64);
-            cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(AES_SECRET_KEY_BYTES, "AES"));
-            byte[] result = cipher.doFinal(dataBytes);
-            return new String(result,DEFAULT_CHARSET);
-        } catch (Exception e) {
-            logger.error("执行CodecUtil.aesDecrypt失败:data={},异常:{}", encryptedDataBase64, e);
-        }
-        return null;
-    }
-
-
-
-    /**
-     * 对数据进行加密,用SHA1加密再转换为16进制
-     *
-     * @param data
-     * @return
-     */
-    public static String sha1Encrypt(String data,String SHA1_SECRET_KEY ) {
-        return DigestUtils.sha1Hex(data + SHA1_SECRET_KEY);
-    }
-
-    /**
-     * 对数据进行加密,用SHA1加密再转换为16进制
-     *
-     * @param data
-     * @return
-     */
-    public static String sha1Encrypt(String data) {
-        return DigestUtils.sha1Hex(data + SHA1_SECRET_KEY);
-    }
-
-    /**
-     * AES密钥长度,支持128、192、256
-     */
-    private static final int AES_SECRET_KEY_LENGTH = 128;
-
-    private static String generateAESSecretKeyBase64(String key) {
-        try {
-            KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
-            keyGenerator.init(AES_SECRET_KEY_LENGTH);
-            SecretKey secretKey = keyGenerator.generateKey();
-            return Base64Utils.encodeToString(secretKey.getEncoded());
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    static class LoginDemoVo {
-        private String account;
-        private String password;
-
-        public String getAccount() {
-            return account;
-        }
-
-        public void setAccount(String account) {
-            this.account = account;
-        }
-
-        public String getPassword() {
-            return password;
-        }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
-    }
-
-    public static void main(String[] args) throws Exception {
-
-        long timestamp = System.currentTimeMillis();
-        JSONObject r = new JSONObject();
-//        r.put("poundNo","");
-        r.put("subtaskId","13111111111");
-        r.put("validate","11111111");
-        r.put("beginDate","2024-04-03 11:11:11");
-        r.put("endDate","2024-04-03 11:11:11");
-        r.put("poundNo","");
-        r.put("unit",3);
-        r.put("batchNo",3);
-        r.put("productName",3);
-        r.put("netWeight",3);
-//        r.put("loadingStartDate","2024-04-03 11:11:11");
-//        r.put("loadingEndDate","2024-04-03 11:11:11");
-        r.put("remark",3);
-        r.put("operationStatus",3);
-        r.put("firstWeighingTime","2024-04-03 11:11:11");
-        r.put("secondWeighingTime","2024-04-03 11:11:11");
-        String data = JSON.toJSONString(r);
-        //对参数进行加密
-        String encryptedData = CodecUtil.aesEncrypt(data);
-        //生成签名
-        String sign = CodecUtil.sha1Encrypt(encryptedData + timestamp);
-        //封装请求参数
-        r = new JSONObject();
-        r.put("encryptedData",encryptedData);
-        r.put("timestamp",timestamp);
-        r.put("sign",sign);
-        //加密后的请求
-        System.out.println("加密后的请求:" + JSON.toJSONString(r));
-        //请求url
-//        String url = "http://123.183.159.70:5066/sso-server/user/register";
-        //返回结果
-//        String result2 = HttpRequestor.doPost(url, JSON.toJSONString(r));
-
-//        System.out.println(result2);
-
-    }
-}

+ 0 - 118
src/main/java/kd/imc/rim/utils/FileOutputStreamExample.java

@@ -1,118 +0,0 @@
-package kd.imc.rim.utils;
-
-import kd.bos.url.UrlService;
-
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Base64;
-
-import static kd.bos.algox.flink.enhance.krpc.impl.DispatcherImpl.log;
-
-public class FileOutputStreamExample {
-    public static void main(String[] args) {
-        String filePath = "C:/Users/TR/Desktop/测试1.pdf";
-        String imgStrToBase64 = getImgStrToBase64(filePath);
-
-    }
-    /**
-     * 将网络链接图片或者本地图片文件转换成Base64编码字符串
-     *
-     * @param imgStr 网络图片Url/本地图片目录路径
-     * @return
-     */
-    public static String getImgStrToBase64(String imgStr) {
-        InputStream inputStream = null;
-        ByteArrayOutputStream outputStream = null;
-        byte[] buffer = null;
-        try {
-            //判断网络链接图片文件/本地目录图片文件
-            if (imgStr.startsWith("http://") || imgStr.startsWith("https://")) {
-                // 创建URL
-                URL url = new URL(imgStr);
-                // 创建链接
-                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-                conn.setRequestMethod("GET");
-                conn.setConnectTimeout(5000);
-                inputStream = conn.getInputStream();
-                outputStream = new ByteArrayOutputStream();
-                // 将内容读取内存中
-                buffer = new byte[1024];
-                int len = -1;
-                while ((len = inputStream.read(buffer)) != -1) {
-                    outputStream.write(buffer, 0, len);
-                }
-                buffer = outputStream.toByteArray();
-            } else {
-                inputStream = new FileInputStream(imgStr);
-                int count = 0;
-                while (count == 0) {
-                    count = inputStream.available();
-                }
-                buffer = new byte[count];
-                inputStream.read(buffer);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            if (inputStream != null) {
-                try {
-                    // 关闭inputStream流
-                    inputStream.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-            if (outputStream != null) {
-                try {
-                    // 关闭outputStream流
-                    outputStream.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        // 对字节数组Base64编码
-        return Base64.getEncoder().encodeToString(buffer);
-    }
-
-    public static File getNetUrlHttp(String netUrl) {
-       // UrlService.getAttachmentFullUrl(netUrl);
-        //对本地文件命名
-        File file = null;
-        URL urlfile;
-        InputStream inStream = null;
-        OutputStream os = null;
-        try {
-            file = File.createTempFile("net_url", netUrl);
-            //下载
-            urlfile = new URL(netUrl);
-            inStream = urlfile.openStream();
-            os = new FileOutputStream(file);
-
-            int bytesRead = 0;
-            byte[] buffer = new byte[8192];
-            while ((bytesRead = inStream.read(buffer, 0, 8192)) != -1) {
-                os.write(buffer, 0, bytesRead);
-            }
-        } catch (Exception e) {
-            log.error("远程图片获取错误:"+netUrl);
-            e.printStackTrace();
-        } finally {
-            try {
-                if (null != os) {
-                    os.close();
-                }
-                if (null != inStream) {
-                    inStream.close();
-                }
-
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        return file;
-    }
-
-}