|
@@ -0,0 +1,3226 @@
|
|
|
+//
|
|
|
+// 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"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|