合同识别清单附件
This commit is contained in:
parent
d6284cb8a6
commit
7ddd611bcc
|
@ -0,0 +1,403 @@
|
||||||
|
package shkd.repc.recon.formplugin;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import kd.bos.bill.OperationStatus;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
|
import kd.bos.entity.datamodel.events.BeforeDeleteEntryEventArgs;
|
||||||
|
import kd.bos.entity.property.EntryProp;
|
||||||
|
import kd.bos.form.*;
|
||||||
|
import kd.bos.form.control.AttachmentPanel;
|
||||||
|
import kd.bos.form.control.EntryGrid;
|
||||||
|
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.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.list.ListFilterParameter;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.AttachmentDto;
|
||||||
|
import kd.bos.servicehelper.AttachmentServiceHelper;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.DeleteServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.bos.util.StringUtils;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import shkd.utils.OAUtils;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同表单插件
|
||||||
|
* qeug_recon_contractbi_ext
|
||||||
|
*/
|
||||||
|
public class ContractFormPlugin extends AbstractFormPlugin implements UploadListener {
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
// 注册监听事件
|
||||||
|
AttachmentPanel attachmentPanel = getControl("qeug_attachmentpanelap");
|
||||||
|
attachmentPanel.addUploadListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(UploadEvent evt) {
|
||||||
|
UploadListener.super.remove(evt);
|
||||||
|
|
||||||
|
AttachmentPanel source = (AttachmentPanel) evt.getSource();
|
||||||
|
String key = source.getKey();
|
||||||
|
if ("qeug_attachmentpanelap".equals(key)) {
|
||||||
|
|
||||||
|
boolean b = deleteList();
|
||||||
|
if (b) {
|
||||||
|
this.getView().showSuccessNotification("已同步删除明细数据");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除汇总明细并且删除清单明细
|
||||||
|
*/
|
||||||
|
private boolean deleteList(){
|
||||||
|
boolean result = true;
|
||||||
|
//合同清单汇总分录
|
||||||
|
DynamicObjectCollection qeug_invoiceentryinfos = this.getView().getModel().getEntryEntity("qeug_invoiceentryinfo");
|
||||||
|
//删除对应明细数据
|
||||||
|
long pkValue = (long)this.getModel().getDataEntity().getPkValue();
|
||||||
|
if (0 == pkValue) {
|
||||||
|
result = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
QFilter q1 = new QFilter("qeug_contractid", QCP.equals, String.valueOf(pkValue));
|
||||||
|
QFilter q2 = null;
|
||||||
|
for (DynamicObject qeug_invoiceentryinfo : qeug_invoiceentryinfos) {
|
||||||
|
String qeugSummarycontent = qeug_invoiceentryinfo.getString("qeug_summarycontent");//分录中的汇总内容(sheet名字)
|
||||||
|
q2 = new QFilter("qeug_sheetname", QCP.equals, qeugSummarycontent);
|
||||||
|
DynamicObject qeug_contractsummarylist = BusinessDataServiceHelper.loadSingle("qeug_contractsummarylist", new QFilter[]{q1,q2});
|
||||||
|
if (null != qeug_contractsummarylist) {
|
||||||
|
int qeug_contractsummarylist1 = DeleteServiceHelper.delete("qeug_contractsummarylist", new QFilter[]{q1,q2});
|
||||||
|
//失败
|
||||||
|
if (0 == qeug_contractsummarylist1) {
|
||||||
|
this.getView().showTipNotification("删除失败:请联系管理员");
|
||||||
|
result = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//删除单据体数据
|
||||||
|
qeug_invoiceentryinfos.clear();
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()});
|
||||||
|
// 删除完成之后刷新界面
|
||||||
|
getView().invokeOperation("refresh");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void afterDoOperation(AfterDoOperationEventArgs args) {
|
||||||
|
super.afterDoOperation(args);
|
||||||
|
//todo 开头结尾根据(项目名称和计量单位都有值的记录行,导入系统中;)---序号属于数字的
|
||||||
|
// 重复点击时覆盖明细列表数据(先删除再新增)----提示先删除行
|
||||||
|
// 删除附件时 情况汇总明细和清单明细 https://developer.kingdee.com/article/132124949988215296?productLineId=29&lang=zh-CN
|
||||||
|
// 删行时 同步删除明细
|
||||||
|
String operateKey = args.getOperateKey();
|
||||||
|
switch (operateKey) {
|
||||||
|
case "deleteentry1":
|
||||||
|
//明细删除行后进行保存
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()});
|
||||||
|
this.getView().showSuccessNotification("已同步删除明细数据");
|
||||||
|
break;
|
||||||
|
//识别清单附件
|
||||||
|
case "qeug_distinguishsumstta":
|
||||||
|
|
||||||
|
//合同清单汇总分录
|
||||||
|
DynamicObjectCollection qeug_invoiceentryinfo = this.getView().getModel().getEntryEntity("qeug_invoiceentryinfo");
|
||||||
|
|
||||||
|
//如果已经有数据,先删除再新增
|
||||||
|
if (!qeug_invoiceentryinfo.isEmpty()) {
|
||||||
|
deleteList();
|
||||||
|
}
|
||||||
|
|
||||||
|
AttachmentPanel qeug_attachmentpanelap = this.getView().getControl("qeug_attachmentpanelap");
|
||||||
|
List<Map<String, Object>> attachments = qeug_attachmentpanelap.getAttachmentData();
|
||||||
|
if (attachments.isEmpty()) {
|
||||||
|
this.getView().showMessage("请上传附清单附件");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map<String, Object> fileMap : attachments) {
|
||||||
|
Object attPkId = fileMap.get("attPkId");
|
||||||
|
if (null == attPkId) {
|
||||||
|
this.getView().showTipNotification("请先保存合同");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AttachmentDto attachmentDto = AttachmentServiceHelper.getAttachmentInfoByAttPk(fileMap.get("attPkId"));
|
||||||
|
String fileUrl = attachmentDto.getResourcePath();//真实路径
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileInputStream in = new FileInputStream(fileUrl);
|
||||||
|
Workbook workbook = WorkbookFactory.create(in);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------明细------------------------------------------------
|
||||||
|
* 获取数据首行根据每个sheet页第一列属不属于数字判断
|
||||||
|
* 第一列不属于数字的行跳过
|
||||||
|
*/
|
||||||
|
|
||||||
|
Map<String, BigDecimal> amounttotalMap = new HashMap<>();
|
||||||
|
for (Sheet sheet : workbook) {
|
||||||
|
int rowNum = 0;
|
||||||
|
// 获取总行数
|
||||||
|
int rowCountsheet = sheet.getPhysicalNumberOfRows();//总行数
|
||||||
|
for (Row cells : sheet) {
|
||||||
|
String billno = cells.getCell(0).toString();
|
||||||
|
//第一列属于数字
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile("^-?\\d+(\\.\\d+)?$");
|
||||||
|
boolean matches = pattern.matcher(billno).matches();
|
||||||
|
if (matches) {
|
||||||
|
rowNum = cells.getRowNum();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal amounttotal =BigDecimal.ZERO;
|
||||||
|
for (int j = rowNum; j <= rowCountsheet - 1; j++) {
|
||||||
|
Row row = sheet.getRow(j);
|
||||||
|
//第一列断号
|
||||||
|
String seq = row.getCell(0).toString();
|
||||||
|
if (StringUtils.isEmpty(seq)) {
|
||||||
|
System.out.println();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//第一列不包含数字
|
||||||
|
boolean containsDigit = seq.matches(".*\\d.*");
|
||||||
|
if (!containsDigit) {
|
||||||
|
System.out.println();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//合同明细清单 qeug_contractsummarylist
|
||||||
|
//todo 存合同id,sheet名字
|
||||||
|
DynamicObject contractsummarylist = BusinessDataServiceHelper.newDynamicObject("qeug_contractsummarylist");
|
||||||
|
contractsummarylist.set("enable","1");//使用状态
|
||||||
|
contractsummarylist.set("status","A");//数据状态
|
||||||
|
contractsummarylist.set("qeug_contractid",this.getModel().getDataEntity().getPkValue().toString());//合同id
|
||||||
|
contractsummarylist.set("qeug_sheetname",sheet.getSheetName());//sheet名字
|
||||||
|
for (Cell cell : row) {
|
||||||
|
int columnIndex = cell.getColumnIndex();
|
||||||
|
switch (columnIndex){
|
||||||
|
case 0:
|
||||||
|
double num = Double.parseDouble(cell.toString());
|
||||||
|
int result = (int)num;
|
||||||
|
contractsummarylist.set("qeug_seq",String.valueOf(result));//序号
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
contractsummarylist.set("qeug_projectnumber",cell);//项目编码
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
contractsummarylist.set("qeug_projectname",cell);//项目名称
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
contractsummarylist.set("qeug_featuredescript",cell);//项目特征描述
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
contractsummarylist.set("qeug_engincontent",cell);//工程内容
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
contractsummarylist.set("qeug_unit",cell);//计量单位
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
if (StringUtils.isNotEmpty(cell.toString())) {
|
||||||
|
contractsummarylist.set("qeug_decimalqty",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//工程量
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
if (StringUtils.isNotEmpty(cell.toString())) {
|
||||||
|
contractsummarylist.set("qeug_unitprice",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//综合单价
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
if (StringUtils.isNotEmpty(cell.toString())) {
|
||||||
|
BigDecimal bigDecimal = BigDecimal.valueOf(Double.parseDouble(cell.toString()));
|
||||||
|
contractsummarylist.set("qeug_amounttotal",bigDecimal);//合计
|
||||||
|
amounttotal = amounttotal.add(bigDecimal);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
if (StringUtils.isNotEmpty(cell.toString())) {
|
||||||
|
contractsummarylist.set("qeug_artificial",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//人工费
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
if (StringUtils.isNotEmpty(cell.toString())) {
|
||||||
|
contractsummarylist.set("qeug_provisional",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//材料及工程设备暂估价
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
if (StringUtils.isNotEmpty(cell.toString())) {
|
||||||
|
contractsummarylist.set("qeug_remarks",cell);//备注
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{contractsummarylist});
|
||||||
|
}
|
||||||
|
amounttotalMap.put(sheet.getSheetName(),amounttotal);//一个sheet一个总金额
|
||||||
|
// this.getView().showSuccessNotification("清单汇总识别--生产明细成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------汇总------------------------------------------------
|
||||||
|
*/
|
||||||
|
DynamicObjectCollection qeugInvoiceentryinfo = this.getView().getModel().getEntryEntity("qeug_invoiceentryinfo");
|
||||||
|
// 获取工作簿中所有的 Sheet 数量
|
||||||
|
int numberOfSheets = workbook.getNumberOfSheets();
|
||||||
|
|
||||||
|
// 遍历每个 Sheet 并输出其名称
|
||||||
|
for (int i = 0; i < numberOfSheets; i++) {
|
||||||
|
Sheet sheet = workbook.getSheetAt(i);
|
||||||
|
|
||||||
|
qeugInvoiceentryinfo.addNew();
|
||||||
|
this.getModel().setValue("qeug_seq", i+1,i);//序号
|
||||||
|
this.getModel().setValue("qeug_summarycontent", sheet.getSheetName(),i);//汇总内容
|
||||||
|
BigDecimal bigDecimal = amounttotalMap.get(sheet.getSheetName());
|
||||||
|
this.getModel().setValue("qeug_amount", bigDecimal,i);//金额(元)
|
||||||
|
this.getModel().setValue("qeug_isnew", false,i);//是否新增行
|
||||||
|
|
||||||
|
}
|
||||||
|
this.getView().updateView("qeug_invoiceentryinfo");
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()});
|
||||||
|
this.getView().showSuccessNotification("清单汇总识别成功");
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//下载清单模板
|
||||||
|
case "downloadlist":
|
||||||
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("qeug_downloadlist", new QFilter[]{new QFilter("number", QCP.equals, "MB-0001")});
|
||||||
|
if (null != dynamicObject) {
|
||||||
|
List<Map<String, Object>> attachmentes = AttachmentServiceHelper.getAttachments("qeug_downloadlist", dynamicObject.getPkValue().toString(), "qeug_attachmentpanelap");
|
||||||
|
for (Map<String, Object> attachment : attachmentes) {
|
||||||
|
String uid = (String) attachment.get("uid");
|
||||||
|
String url = (String) attachment.get("url");
|
||||||
|
this.getView().download(url);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.getView().showErrorNotification("请先联系管理员维护模板附件管理中的清单模板模板!");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
super.beforeDoOperation(args);
|
||||||
|
|
||||||
|
FormOperate source = (FormOperate) args.getSource();
|
||||||
|
String operateKey = source.getOperateKey();
|
||||||
|
switch (operateKey) {
|
||||||
|
// //识别清单附件之前--保存页面
|
||||||
|
// case "qeug_distinguishsumstta":
|
||||||
|
// SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()});
|
||||||
|
// break;
|
||||||
|
//分录--查看合同清单明细按钮
|
||||||
|
case "operationcolumnap":
|
||||||
|
int index = this.getModel().getEntryCurrentRowIndex("qeug_invoiceentryinfo");
|
||||||
|
boolean qeugIsnew = (boolean)this.getModel().getValue("qeug_isnew", index);
|
||||||
|
if (qeugIsnew) {
|
||||||
|
this.getView().showTipNotification("新增行无法查看明细");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getListShowParamer(this.getView(), this.getModel());
|
||||||
|
break;
|
||||||
|
case "deleteentry1":
|
||||||
|
//用户在删除汇总明细时,如果当前汇总已经生成清单,一并删除掉
|
||||||
|
EntryGrid qeug_invoiceentryinfo = (EntryGrid)this.getView().getControl("qeug_invoiceentryinfo");
|
||||||
|
int[] selectRows = qeug_invoiceentryinfo.getSelectRows();
|
||||||
|
if (selectRows.length > 0) {
|
||||||
|
for (int i = 0; i < selectRows.length; i++) {
|
||||||
|
int selectRow = selectRows[i];
|
||||||
|
long pkValue = (long)this.getModel().getDataEntity().getPkValue();
|
||||||
|
if (0 == pkValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String qeug_summarycontent = (String)this.getModel().getValue("qeug_summarycontent",selectRow);//分录中的汇总内容(sheet名字)
|
||||||
|
QFilter q1 = new QFilter("qeug_sheetname", QCP.equals, qeug_summarycontent);
|
||||||
|
QFilter q2 = new QFilter("qeug_contractid", QCP.equals, String.valueOf(pkValue));
|
||||||
|
DynamicObject qeug_contractsummarylist = BusinessDataServiceHelper.loadSingle("qeug_contractsummarylist", new QFilter[]{q1,q2});
|
||||||
|
if (null != qeug_contractsummarylist) {
|
||||||
|
int qeug_contractsummarylist1 = DeleteServiceHelper.delete("qeug_contractsummarylist", new QFilter[]{q1,q2});
|
||||||
|
//失败
|
||||||
|
if (0 == qeug_contractsummarylist1) {
|
||||||
|
this.getView().showTipNotification("删除失败:请联系管理员");
|
||||||
|
args.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开列表展示清单详情页
|
||||||
|
* @param formView 页面
|
||||||
|
* @param model 模型
|
||||||
|
*/
|
||||||
|
private void getListShowParamer(IFormView formView, IDataModel model) {
|
||||||
|
|
||||||
|
ListShowParameter parameter = ShowFormHelper.createShowListForm("qeug_contractsummarylist", true);
|
||||||
|
parameter.getOpenStyle().setShowType(ShowType.Modal);//Floating MainNewTabPage NewBrowserPage InContainer
|
||||||
|
parameter.setBillFormId("qeug_contractsummarylist");
|
||||||
|
parameter.setHasRight(true);
|
||||||
|
StyleCss styleCss = new StyleCss();
|
||||||
|
styleCss.setWidth("1500");
|
||||||
|
styleCss.setHeight("800");
|
||||||
|
parameter.getOpenStyle().setInlineStyleCss(styleCss);
|
||||||
|
DynamicObjectCollection dynColl = formView.getModel().getEntryEntity("qeug_invoiceentryinfo");
|
||||||
|
int index = model.getEntryCurrentRowIndex("qeug_invoiceentryinfo");
|
||||||
|
DynamicObject dynamicObject = dynColl.get(index);
|
||||||
|
String qeug_summarycontent = dynamicObject.getString("qeug_summarycontent");//汇总内容(sheetName)
|
||||||
|
Object pkValue = formView.getModel().getDataEntity().getPkValue();//合同ID
|
||||||
|
|
||||||
|
QFilter q1 = new QFilter("qeug_sheetname", QCP.equals, qeug_summarycontent);
|
||||||
|
QFilter q2 = new QFilter("qeug_contractid",QCP.equals, String.valueOf(pkValue));
|
||||||
|
List<QFilter> listQF = Lists.newArrayList();
|
||||||
|
listQF.add(q1.and(q2));
|
||||||
|
parameter.setListFilterParameter(new ListFilterParameter(listQF, null));
|
||||||
|
this.getView().showForm(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// case "newentry1":
|
||||||
|
// //合同清单汇总分录
|
||||||
|
// DynamicObjectCollection invoiceentryinfo = this.getView().getModel().getEntryEntity("qeug_invoiceentryinfo");
|
||||||
|
// int size = invoiceentryinfo.size();
|
||||||
|
// String qeug_seq = (String)this.getModel().getValue("qeug_seq",size-2);//最后一个序号
|
||||||
|
// BigDecimal seq = BigDecimal.valueOf(Double.valueOf(qeug_seq));
|
||||||
|
// seq = seq.add(BigDecimal.ONE);
|
||||||
|
//
|
||||||
|
// double num = Double.parseDouble(seq.toString());
|
||||||
|
// int result = (int)num;
|
||||||
|
//
|
||||||
|
// this.getModel().setValue("qeug_seq",result,size-1);//序号++
|
||||||
|
//
|
||||||
|
// break;
|
|
@ -11,8 +11,11 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.fileservice.FileServiceFactory;
|
import kd.bos.fileservice.FileServiceFactory;
|
||||||
import kd.bos.form.CloseCallBack;
|
import kd.bos.form.CloseCallBack;
|
||||||
import kd.bos.form.ShowType;
|
import kd.bos.form.ShowType;
|
||||||
|
import kd.bos.form.control.AttachmentPanel;
|
||||||
import kd.bos.form.control.Control;
|
import kd.bos.form.control.Control;
|
||||||
import kd.bos.form.control.EntryGrid;
|
import kd.bos.form.control.EntryGrid;
|
||||||
|
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.AfterDoOperationEventArgs;
|
||||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
import kd.bos.form.operate.FormOperate;
|
import kd.bos.form.operate.FormOperate;
|
||||||
|
@ -32,8 +35,7 @@ import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 付款申请单 || 费用登记单 插件
|
* 付款申请单 || 费用登记单 插件
|
||||||
|
@ -42,6 +44,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class ReconPayreqFormPlugin extends AbstractFormPlugin {
|
public class ReconPayreqFormPlugin extends AbstractFormPlugin {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterDoOperation(AfterDoOperationEventArgs args) {
|
public void afterDoOperation(AfterDoOperationEventArgs args) {
|
||||||
super.afterDoOperation(args);
|
super.afterDoOperation(args);
|
||||||
|
@ -70,25 +73,6 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin {
|
||||||
//成功--新增分录行
|
//成功--新增分录行
|
||||||
if (b) {
|
if (b) {
|
||||||
|
|
||||||
for (Map<String, Object> fileMap : attachments) {
|
|
||||||
AttachmentDto attachmentDto = AttachmentServiceHelper.getAttachmentInfoByAttPk(fileMap.get("attPkId"));
|
|
||||||
String fileUrl = attachmentDto.getResourcePath();
|
|
||||||
|
|
||||||
try {
|
|
||||||
FileInputStream in = new FileInputStream(fileUrl);
|
|
||||||
Workbook workbook = WorkbookFactory.create(in);
|
|
||||||
|
|
||||||
Sheet sheet = workbook.getSheetAt(0);
|
|
||||||
for (int j = 1; j < 5; j++) {
|
|
||||||
Row row = sheet.getRow(j);
|
|
||||||
String billno = row.getCell(0).toString();
|
|
||||||
}
|
|
||||||
System.out.println("");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//发票信息分录
|
//发票信息分录
|
||||||
for (int i = 0; i < attachments.size(); i++) {
|
for (int i = 0; i < attachments.size(); i++) {
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class TestOPPlugin extends AbstractOperationServicePlugIn {
|
||||||
customerHeader.put("Content-Type", "application/json");
|
customerHeader.put("Content-Type", "application/json");
|
||||||
customerHeader.put("token", oaToken);
|
customerHeader.put("token", oaToken);
|
||||||
|
|
||||||
|
|
||||||
//组装请求体
|
//组装请求体
|
||||||
// DynamicObject supplier = dataEntity.getDynamicObject("supplier");
|
// DynamicObject supplier = dataEntity.getDynamicObject("supplier");
|
||||||
// if (null != supplier) {
|
// if (null != supplier) {
|
||||||
|
@ -62,7 +63,6 @@ public class TestOPPlugin extends AbstractOperationServicePlugIn {
|
||||||
JSONObject customerBody = assembleBody(OAUtils.l(dataEntity.getPkValue()));
|
JSONObject customerBody = assembleBody(OAUtils.l(dataEntity.getPkValue()));
|
||||||
if (null != customerBody) {
|
if (null != customerBody) {
|
||||||
String customerPostjson = null;
|
String customerPostjson = null;
|
||||||
String str = null;
|
|
||||||
try {
|
try {
|
||||||
customerPostjson = HttpClientUtils.postjson(customerUrl, customerHeader, customerBody.toJSONString());
|
customerPostjson = HttpClientUtils.postjson(customerUrl, customerHeader, customerBody.toJSONString());
|
||||||
logger.info("ICS新增/更新OA客户租户接口返回结果:\n{}", customerPostjson);
|
logger.info("ICS新增/更新OA客户租户接口返回结果:\n{}", customerPostjson);
|
||||||
|
@ -146,7 +146,7 @@ public class TestOPPlugin extends AbstractOperationServicePlugIn {
|
||||||
custBankaccMapBody.add(custBankaccBody);
|
custBankaccMapBody.add(custBankaccBody);
|
||||||
}
|
}
|
||||||
//无银行信息
|
//无银行信息
|
||||||
if (entry_banks.size() == 0) {
|
if (entry_banks.isEmpty()) {
|
||||||
JSONObject custBankaccBody = new JSONObject();
|
JSONObject custBankaccBody = new JSONObject();
|
||||||
custBankaccBody.put("accnum","");//"银行账号",
|
custBankaccBody.put("accnum","");//"银行账号",
|
||||||
custBankaccBody.put("pk_bankdoc", "");// "开户行名称:例如招商银行股份有限公司上海分行外高桥支行龙江支行"
|
custBankaccBody.put("pk_bankdoc", "");// "开户行名称:例如招商银行股份有限公司上海分行外高桥支行龙江支行"
|
||||||
|
|
Loading…
Reference in New Issue