待办提交自动退出,合同附件识别优化,OA供应商变更逻辑,待办驳回删除消息
This commit is contained in:
parent
2e6044fc27
commit
4338215f30
|
@ -13,6 +13,7 @@ import kd.bos.entity.datamodel.events.IDataModelChangeListener;
|
||||||
import kd.bos.entity.property.BasedataProp;
|
import kd.bos.entity.property.BasedataProp;
|
||||||
import kd.bos.entity.property.EntryProp;
|
import kd.bos.entity.property.EntryProp;
|
||||||
import kd.bos.entity.property.MulBasedataProp;
|
import kd.bos.entity.property.MulBasedataProp;
|
||||||
|
import kd.bos.fileservice.FileServiceFactory;
|
||||||
import kd.bos.form.*;
|
import kd.bos.form.*;
|
||||||
import kd.bos.form.control.AttachmentPanel;
|
import kd.bos.form.control.AttachmentPanel;
|
||||||
import kd.bos.form.control.EntryGrid;
|
import kd.bos.form.control.EntryGrid;
|
||||||
|
@ -27,6 +28,8 @@ import kd.bos.form.operate.FormOperate;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
import kd.bos.list.ListFilterParameter;
|
import kd.bos.list.ListFilterParameter;
|
||||||
import kd.bos.list.ListShowParameter;
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.AttachmentDto;
|
import kd.bos.servicehelper.AttachmentDto;
|
||||||
|
@ -36,6 +39,7 @@ import kd.bos.servicehelper.operation.DeleteServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
import kd.bos.util.StringUtils;
|
import kd.bos.util.StringUtils;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import shkd.utils.DobeDWUtils;
|
||||||
import shkd.utils.OAUtils;
|
import shkd.utils.OAUtils;
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
@ -46,7 +50,10 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -60,7 +67,7 @@ import java.util.regex.Pattern;
|
||||||
*/
|
*/
|
||||||
public class ContractFormPlugin extends AbstractFormPlugin implements UploadListener, BasedataEditListener, IDataModelChangeListener {
|
public class ContractFormPlugin extends AbstractFormPlugin implements UploadListener, BasedataEditListener, IDataModelChangeListener {
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(ContractFormPlugin.class);
|
||||||
|
|
||||||
private static final String BASEDATA_FIELD = "multitypepartya";
|
private static final String BASEDATA_FIELD = "multitypepartya";
|
||||||
|
|
||||||
|
@ -240,177 +247,157 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis
|
||||||
this.getView().showTipNotification("请先保存单据");
|
this.getView().showTipNotification("请先保存单据");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AttachmentDto attachmentDto = AttachmentServiceHelper.getAttachmentInfoByAttPk(fileMap.get("attPkId"));
|
List<Map<String, Object>> attachmentes = AttachmentServiceHelper.getAttachments("recon_contractbill", this.getModel().getValue("id"), "qeug_attachmentpanelap");
|
||||||
String fileUrl = attachmentDto.getResourcePath();//真实路径
|
for (Map<String, Object> attachment : attachmentes) {
|
||||||
|
String url = attachment.get("url").toString();
|
||||||
|
try {
|
||||||
|
URLConnection urlConnection = new URL(url).openConnection();
|
||||||
|
InputStream in = urlConnection.getInputStream();
|
||||||
|
// FileInputStream in = new FileInputStream(fileUrl);
|
||||||
|
Workbook workbook = WorkbookFactory.create(in);
|
||||||
|
|
||||||
try {
|
/**
|
||||||
FileInputStream in = new FileInputStream(fileUrl);
|
* --------------------------------------明细------------------------------------------------
|
||||||
Workbook workbook = WorkbookFactory.create(in);
|
* 获取数据首行根据每个sheet页第一列属不属于数字判断
|
||||||
|
* 第一列不属于数字的行跳过
|
||||||
|
*/
|
||||||
|
|
||||||
// for (int sheetIndex = 0; sheetIndex < workbook.getNumberOfSheets(); sheetIndex++) {
|
Map<String, BigDecimal> amounttotalMap = new HashMap<>();
|
||||||
// Sheet sheet = workbook.getSheetAt(sheetIndex);
|
for (Sheet sheet : workbook) {
|
||||||
// List<String[]> data = new ArrayList<>();
|
int rowNum = 0;
|
||||||
// String currentCategory = "";
|
// 获取总行数
|
||||||
// for (Row row : sheet) {
|
int rowCountsheet = sheet.getPhysicalNumberOfRows();//总行数
|
||||||
// if (isRowEmpty(row)) {
|
for (Row cells : sheet) {
|
||||||
// continue;
|
String billno = cells.getCell(0).toString();
|
||||||
// }
|
//第一列属于数字
|
||||||
// Cell firstCell = row.getCell(0);
|
|
||||||
// if (firstCell!= null && firstCell.getCellType() == CellType.NUMERIC) {
|
|
||||||
// data.add(getRowData(row));
|
|
||||||
// } else {
|
|
||||||
// currentCategory = getCellValue(row.getCell(0));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// for (String[] row : data) {
|
|
||||||
// System.out.print(currentCategory + "\t");
|
|
||||||
// for (String cellValue : row) {
|
|
||||||
// System.out.print(cellValue + "\t");
|
|
||||||
// }
|
|
||||||
// System.out.println();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
Pattern pattern = Pattern.compile("^-?\\d+(\\.\\d+)?$");
|
||||||
* --------------------------------------明细------------------------------------------------
|
boolean matches = pattern.matcher(billno).matches();
|
||||||
* 获取数据首行根据每个sheet页第一列属不属于数字判断
|
if (matches) {
|
||||||
* 第一列不属于数字的行跳过
|
rowNum = cells.getRowNum();
|
||||||
*/
|
break;
|
||||||
|
|
||||||
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
|
|
||||||
// 存合同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});
|
BigDecimal amounttotal =BigDecimal.ZERO;
|
||||||
}
|
for (int j = rowNum; j <= rowCountsheet - 1; j++) {
|
||||||
amounttotalMap.put(sheet.getSheetName(),amounttotal);//一个sheet一个总金额
|
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
|
||||||
|
// 存合同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("清单汇总识别--生产明细成功");
|
// 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);//是否新增行
|
|
||||||
DynamicObject bd_currency = BusinessDataServiceHelper.loadSingle("bd_currency",
|
|
||||||
new QFilter[]{new QFilter("number", QCP.equals, "CNY")});
|
|
||||||
if (null != bd_currency) {
|
|
||||||
this.getModel().setValue("qeug_currencylist", bd_currency,i);//清单币别
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------汇总------------------------------------------------
|
||||||
|
*/
|
||||||
|
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);//是否新增行
|
||||||
|
DynamicObject bd_currency = BusinessDataServiceHelper.loadSingle("bd_currency",
|
||||||
|
new QFilter[]{new QFilter("number", QCP.equals, "CNY")});
|
||||||
|
if (null != bd_currency) {
|
||||||
|
this.getModel().setValue("qeug_currencylist", bd_currency,i);//清单币别
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
this.getView().updateView("qeug_invoiceentryinfo");
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()});
|
||||||
|
this.getView().showSuccessNotification("清单汇总识别成功");
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
this.getView().updateView("qeug_invoiceentryinfo");
|
|
||||||
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()});
|
|
||||||
this.getView().showSuccessNotification("清单汇总识别成功");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//下载清单模板
|
//下载清单模板
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class PushOASupplierOPPlugin extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(PushOASupplierOPPlugin.class);
|
private static final Log logger = LogFactory.getLog(PushOASupplierOPPlugin.class);
|
||||||
|
|
||||||
private static final String RESM_OFFICIAL_SUPPLIER = "resm_official_supplier";//正式供应商
|
public static final String RESM_OFFICIAL_SUPPLIER = "resm_official_supplier";//正式供应商
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterExecuteOperationTransaction(AfterOperationArgs e){
|
public void afterExecuteOperationTransaction(AfterOperationArgs e){
|
||||||
|
@ -44,11 +44,21 @@ public class PushOASupplierOPPlugin extends AbstractOperationServicePlugIn {
|
||||||
if ("audit".equals(operationKey)) {
|
if ("audit".equals(operationKey)) {
|
||||||
|
|
||||||
for (DynamicObject dataEntity : e.getDataEntities()) {
|
for (DynamicObject dataEntity : e.getDataEntities()) {
|
||||||
|
String name = dataEntity.getDynamicObjectType().getName();
|
||||||
|
String supplierName = "";
|
||||||
|
DynamicObject supplier = null;
|
||||||
|
if ("resm_change_supplier".equals(name)) {
|
||||||
|
supplierName = dataEntity.getDynamicObject("supplier").getString("name");
|
||||||
|
supplier = dataEntity.getDynamicObject("supplier");
|
||||||
|
}else {
|
||||||
|
supplierName = dataEntity.getString("name");
|
||||||
|
supplier = dataEntity;
|
||||||
|
}
|
||||||
//获取token
|
//获取token
|
||||||
String oaToken = OAUtils.getOaToken(dataEntity.getString("name"));
|
String oaToken = OAUtils.getOaToken(supplierName);
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(oaToken)) {
|
if (StringUtils.isNotEmpty(oaToken) && null != supplier) {
|
||||||
pushOASupplier(oaToken,dataEntity);
|
pushOASupplier(oaToken,supplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +75,7 @@ public class PushOASupplierOPPlugin extends AbstractOperationServicePlugIn {
|
||||||
DynamicObject official_supplier = BusinessDataServiceHelper.loadSingle(RESM_OFFICIAL_SUPPLIER, new QFilter[]{q});
|
DynamicObject official_supplier = BusinessDataServiceHelper.loadSingle(RESM_OFFICIAL_SUPPLIER, new QFilter[]{q});
|
||||||
if (null != official_supplier) {
|
if (null != official_supplier) {
|
||||||
|
|
||||||
String code = official_supplier.getString("number");
|
String code = official_supplier.getString("qeug_oacode");
|
||||||
String name = official_supplier.getString("name");
|
String name = official_supplier.getString("name");
|
||||||
String taxpayerid = official_supplier.getString("tx_register_no");
|
String taxpayerid = official_supplier.getString("tx_register_no");
|
||||||
String shortname = official_supplier.getString("simplename");
|
String shortname = official_supplier.getString("simplename");
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package shkd.todotask;
|
||||||
|
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.workflow.taskcenter.plugin.validate.IApprovalSubPlugin;
|
||||||
|
import shkd.utils.OAUtils;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待办提交关闭页面
|
||||||
|
*/
|
||||||
|
public class closeTaskPagePlugin implements IApprovalSubPlugin {
|
||||||
|
private static final Log logger = LogFactory.getLog(closeTaskPagePlugin.class);
|
||||||
|
@Override
|
||||||
|
public boolean executeClosePageAfterSubmitTask(boolean isPCShow, Map<String, Object> customParams) {
|
||||||
|
logger.info("进入页面关闭方法");
|
||||||
|
logger.info("进入页面关闭方法");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import kd.bos.util.StringUtils;
|
||||||
import kd.bos.workflow.engine.impl.persistence.entity.operationlog.OperationLogEntity;
|
import kd.bos.workflow.engine.impl.persistence.entity.operationlog.OperationLogEntity;
|
||||||
import kd.bos.workflow.engine.msg.AbstractMessageServiceHandler;
|
import kd.bos.workflow.engine.msg.AbstractMessageServiceHandler;
|
||||||
import kd.bos.workflow.engine.msg.ctx.MessageContext;
|
import kd.bos.workflow.engine.msg.ctx.MessageContext;
|
||||||
|
import kd.bos.workflow.engine.msg.info.MessageInfo;
|
||||||
import kd.bos.workflow.engine.msg.info.ToDoInfo;
|
import kd.bos.workflow.engine.msg.info.ToDoInfo;
|
||||||
import kd.bos.workflow.service.WorkflowService;
|
import kd.bos.workflow.service.WorkflowService;
|
||||||
import kd.bos.workflow.service.impl.ServiceFactory;
|
import kd.bos.workflow.service.impl.ServiceFactory;
|
||||||
|
@ -66,6 +67,7 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
|
||||||
}
|
}
|
||||||
//获取Url
|
//获取Url
|
||||||
String url = toDoInfo.getUrl(); // 链接
|
String url = toDoInfo.getUrl(); // 链接
|
||||||
|
String url1 = toDoInfo.getUrl(); // 链接
|
||||||
try {
|
try {
|
||||||
url = URLEncoder.encode(url, "UTF-8");
|
url = URLEncoder.encode(url, "UTF-8");
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
@ -107,7 +109,9 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
|
||||||
thirdPartyMap.put("startName",startName);
|
thirdPartyMap.put("startName",startName);
|
||||||
thirdPartyMap.put("createDateStr",createDateStr);
|
thirdPartyMap.put("createDateStr",createDateStr);
|
||||||
thirdPartyMap.put("url",url);
|
thirdPartyMap.put("url",url);
|
||||||
|
thirdPartyMap.put("url1",url1);
|
||||||
thirdPartyMap.put("billNo",billNo);
|
thirdPartyMap.put("billNo",billNo);
|
||||||
|
thirdPartyMap.put("startNumber",startNumber);//发起人
|
||||||
|
|
||||||
//推送OA待办新增接口
|
//推送OA待办新增接口
|
||||||
thirdParty(thirdPartyMap);
|
thirdParty(thirdPartyMap);
|
||||||
|
@ -122,24 +126,24 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
|
||||||
//todo 待办推送第三方,节点审批通过或者驳回到某节点时都会进入(dealToDo)方法,代码如何判断该节点是驳回还是审批通过
|
//todo 待办推送第三方,节点审批通过或者驳回到某节点时都会进入(dealToDo)方法,代码如何判断该节点是驳回还是审批通过
|
||||||
//获取当前任务ID
|
//获取当前任务ID
|
||||||
Long taskId = messageContext.getTaskId();
|
Long taskId = messageContext.getTaskId();
|
||||||
// List<OperationLogEntity> operationLogByTaskId = ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId);
|
//获取任务步骤
|
||||||
String decisionType = ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId).get(0).getDecisionType();
|
Long executionId = messageContext.getExecutionId();
|
||||||
|
List<OperationLogEntity> operationLogByTaskId = ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId);
|
||||||
|
String decisionType = "";
|
||||||
|
if (operationLogByTaskId.size() > 0) {
|
||||||
|
decisionType = ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId).get(0).getDecisionType();
|
||||||
|
}else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String subState = "0";
|
||||||
String subState = "";
|
|
||||||
//驳回
|
//驳回
|
||||||
if("reject".equals(decisionType)){
|
if("reject".equals(decisionType)){
|
||||||
subState = "3";
|
subState = "3";
|
||||||
}
|
}
|
||||||
//审批通过
|
|
||||||
else if ("approve".equals(decisionType)) {
|
|
||||||
subState = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取流程实例ID
|
//获取流程实例ID
|
||||||
Long processInstanceId = messageContext.getProcessInstanceId();
|
Long processInstanceId = messageContext.getProcessInstanceId();
|
||||||
//获取任务步骤
|
|
||||||
Long executionId = messageContext.getExecutionId(); // 节点ID
|
|
||||||
|
|
||||||
//获取单据编码
|
//获取单据编码
|
||||||
String billNo = messageContext.getBillNo();
|
String billNo = messageContext.getBillNo();
|
||||||
|
@ -174,15 +178,15 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
|
||||||
Long taskId = messageContext.getTaskId();
|
Long taskId = messageContext.getTaskId();
|
||||||
|
|
||||||
String decisionType = ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId).get(0).getDecisionType();
|
String decisionType = ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId).get(0).getDecisionType();
|
||||||
String subState = "";
|
String subState = "3";
|
||||||
//单据撤销
|
// //单据撤销
|
||||||
if("reject".equals(decisionType)){
|
// if("reject".equals(decisionType)){
|
||||||
subState = "2";
|
// subState = "2";
|
||||||
}
|
// }
|
||||||
//终止流程
|
// //终止流程
|
||||||
else if ("approve".equals(decisionType)) {
|
// else if ("approve".equals(decisionType)) {
|
||||||
subState = "3";
|
// subState = "3";
|
||||||
}
|
// }
|
||||||
|
|
||||||
//获取单据编码
|
//获取单据编码
|
||||||
String billNo = messageContext.getBillNo();
|
String billNo = messageContext.getBillNo();
|
||||||
|
@ -202,7 +206,67 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
|
||||||
updatePendingState(updateStateMap);
|
updatePendingState(updateStateMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
System.out.println("createToDo");
|
}
|
||||||
System.out.println("createToDo");
|
|
||||||
|
@Override
|
||||||
|
public void sendMessage(MessageContext messageContext, MessageInfo message) {
|
||||||
|
super.sendMessage(messageContext, message);
|
||||||
|
//获取单据编码
|
||||||
|
String billNo = messageContext.getBillNo();
|
||||||
|
//消息内容
|
||||||
|
String content = message.getContent();
|
||||||
|
//消息时间
|
||||||
|
Date createDate = messageContext.getCreateDate();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String createDateStr = sdf.format(createDate);
|
||||||
|
//获取当前任务ID
|
||||||
|
Long taskId = messageContext.getTaskId();
|
||||||
|
//获取审批人集合
|
||||||
|
List<DynamicObject> approvers = new ArrayList<>();
|
||||||
|
List<Long> userIds = message.getUserIds(); // 审批人ID集合
|
||||||
|
List<DynamicObject> approversLists = getApprovers(userIds, approvers);
|
||||||
|
//获取任务创建人
|
||||||
|
Long startUserId = messageContext.getStartUserId(); // 审批实例发起人id
|
||||||
|
DynamicObject startUser = BusinessDataServiceHelper.loadSingle(startUserId, "bos_user");
|
||||||
|
String startNumber = "";
|
||||||
|
String startName = "";
|
||||||
|
if (null != startUser) {
|
||||||
|
startNumber = startUser.getString("number");
|
||||||
|
startName = startUser.getString("name");
|
||||||
|
if (!userIds.contains(startUserId)) {
|
||||||
|
approversLists.add(startUser);//添加发起人到审批人集合_便于后续接口调用(用户绑定接口)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//获取Url
|
||||||
|
String url = message.getContentUrl(); // 链接
|
||||||
|
String url1 = message.getContentUrl(); // 链接
|
||||||
|
try {
|
||||||
|
url = URLEncoder.encode(url, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
url = "http://172.31.254.240:9090/seeyon/isc.do?method=ssoISC&toUrl=" + url;
|
||||||
|
|
||||||
|
//获取token
|
||||||
|
String oaToken = OAUtils.getOaToken(billNo);
|
||||||
|
if (StringUtils.isNotEmpty(oaToken)) {
|
||||||
|
|
||||||
|
HashMap<String, Object> thirdPartyMap = new HashMap<>();
|
||||||
|
thirdPartyMap.put("oaToken",oaToken);
|
||||||
|
thirdPartyMap.put("approversLists",approversLists);
|
||||||
|
thirdPartyMap.put("taskId",taskId);
|
||||||
|
thirdPartyMap.put("content",content);
|
||||||
|
thirdPartyMap.put("createDateStr",createDateStr);
|
||||||
|
thirdPartyMap.put("url",url);
|
||||||
|
thirdPartyMap.put("url1",url1);
|
||||||
|
thirdPartyMap.put("billNo",billNo);
|
||||||
|
thirdPartyMap.put("startNumber",startNumber);//发起人
|
||||||
|
|
||||||
|
//推送OA待办新增接口
|
||||||
|
thirdpartyMessage(thirdPartyMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,10 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.logging.Log;
|
import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
import kd.bos.util.HttpClientUtils;
|
import kd.bos.util.HttpClientUtils;
|
||||||
import kd.bos.util.StringUtils;
|
import kd.bos.util.StringUtils;
|
||||||
|
|
||||||
|
@ -13,6 +17,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static shkd.repc.resm.opplugin.PushOASupplierOPPlugin.RESM_OFFICIAL_SUPPLIER;
|
||||||
import static shkd.repc.resm.opplugin.PushOASupplierOPPlugin.assembleBody;
|
import static shkd.repc.resm.opplugin.PushOASupplierOPPlugin.assembleBody;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,23 +28,14 @@ import static shkd.repc.resm.opplugin.PushOASupplierOPPlugin.assembleBody;
|
||||||
public class OAUtils {
|
public class OAUtils {
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(OAUtils.class);
|
private static final Log logger = LogFactory.getLog(OAUtils.class);
|
||||||
public static final String oaUrl = System.getProperty("oaurl");//(测试环境外网地址)
|
// public static final String oaUrl = System.getProperty("oaurl");//(测试环境外网地址)
|
||||||
// public static final String oaUrl = "http://172.31.254.240:9090";//本地(内网地址)
|
public static final String oaUrl = "http://172.31.254.240:9090";//本地(内网地址)
|
||||||
|
|
||||||
//致远服务前获取token接口
|
//致远服务前获取token接口
|
||||||
public static String getOaToken(String billNo){
|
public static String getOaToken(String billNo){
|
||||||
|
|
||||||
//String url = System.getProperty("efms.infcompany.url.ip");
|
|
||||||
//logger.info("url");
|
|
||||||
|
|
||||||
//致远服务前获取token接口
|
|
||||||
// String userName = "ICSTest";
|
|
||||||
// String password = "8f72e360-268e-41ba-9886-af9a802e4de3";
|
|
||||||
|
|
||||||
String userName = "JDtest";
|
String userName = "JDtest";
|
||||||
String password = "235c78d7-03a6-4b32-8632-7b75a002276b";
|
String password = "235c78d7-03a6-4b32-8632-7b75a002276b";
|
||||||
// String oaUrl = System.getProperty("oaurl");
|
|
||||||
// String oaUrl = "http://172.31.254.240:9090";
|
|
||||||
String linkUrl = oaUrl +"/seeyon/rest/token";
|
String linkUrl = oaUrl +"/seeyon/rest/token";
|
||||||
//接口请求体
|
//接口请求体
|
||||||
JSONObject linkBody = new JSONObject();
|
JSONObject linkBody = new JSONObject();
|
||||||
|
@ -83,28 +79,35 @@ public class OAUtils {
|
||||||
//组装请求体
|
//组装请求体
|
||||||
// DynamicObject supplier = dataEntity.getDynamicObject("syssupplier");//系统供应商
|
// DynamicObject supplier = dataEntity.getDynamicObject("syssupplier");//系统供应商
|
||||||
// if (null != supplier) {
|
// if (null != supplier) {
|
||||||
JSONObject customerBody = assembleBody(OAUtils.l(dataEntity.getPkValue()));
|
JSONObject customerBody = assembleBody(OAUtils.l(dataEntity.getPkValue()));
|
||||||
if (null != customerBody) {
|
if (customerBody != null) {
|
||||||
String customerPostjson = null;
|
String customerPostjson = null;
|
||||||
try {
|
boolean isSuccess = false; // 新增变量来标记成功状态
|
||||||
customerPostjson = HttpClientUtils.postjson(customerUrl, customerHeader, customerBody.toJSONString());
|
try {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(customerPostjson);
|
customerPostjson = HttpClientUtils.postjson(customerUrl, customerHeader, customerBody.toJSONString());
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(customerPostjson);
|
||||||
|
|
||||||
if (!jsonObject.isEmpty()) {
|
if (!jsonObject.isEmpty()) {
|
||||||
String result = jsonObject.getString("success");
|
isSuccess = "true".equals(jsonObject.getString("success"));
|
||||||
boolean success = "true".equals(result);
|
if (isSuccess) {
|
||||||
|
String id = jsonObject.getString("id");
|
||||||
DobeDWUtils.saveLog(dataEntity.getString("name"),
|
// 获取正式供应商
|
||||||
"致远", customerBody.toJSONString(), customerPostjson,
|
QFilter q = new QFilter("id", QCP.equals, dataEntity.getPkValue());
|
||||||
success, "调用ICS新增/更新OA客户租户接口");
|
DynamicObject officialSupplier = BusinessDataServiceHelper.loadSingle(RESM_OFFICIAL_SUPPLIER, new QFilter[]{q});
|
||||||
|
if (officialSupplier != null) {
|
||||||
|
officialSupplier.set("qeug_oacode", id);
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{officialSupplier});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
|
||||||
DobeDWUtils.saveLog(dataEntity.getString("name"),
|
|
||||||
"致远", customerBody.toJSONString(), customerPostjson,
|
|
||||||
false, "调用ICS新增/更新OA客户租户接口");
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
DobeDWUtils.saveLog(dataEntity.getString("name"), "致远", customerBody.toJSONString(), customerPostjson, false, "调用ICS新增/更新OA客户租户接口");
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
} finally {
|
||||||
|
// 日志记录,放在 finally 中确保无论如何都会执行
|
||||||
|
DobeDWUtils.saveLog(dataEntity.getString("name"), "致远", customerBody.toJSONString(), customerPostjson, isSuccess, isSuccess ? "调用ICS更新OA客户租户接口" : "调用ICS新增OA客户租户接口");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -197,11 +200,11 @@ public class OAUtils {
|
||||||
jsonObject.put("taskId", String.valueOf(thirdPartyMap.get("taskId")));//第三方待办主键(保证唯一)
|
jsonObject.put("taskId", String.valueOf(thirdPartyMap.get("taskId")));//第三方待办主键(保证唯一)
|
||||||
jsonObject.put("registerCode", "3004");//系统注册编码
|
jsonObject.put("registerCode", "3004");//系统注册编码
|
||||||
jsonObject.put("title", String.valueOf(thirdPartyMap.get("title")) );//待办标题
|
jsonObject.put("title", String.valueOf(thirdPartyMap.get("title")) );//待办标题
|
||||||
// jsonObject.put("thirdSenderId", startNumber);//第三方待办发起人主键
|
// jsonObject.put("thirdSenderId", String.valueOf(thirdPartyMap.get("startNumber")));//第三方待办发起人主键
|
||||||
jsonObject.put("thirdSenderId", "jdtest");//todo 第三方待办发起人主键
|
jsonObject.put("thirdSenderId", "jdtest");//todo 第三方待办发起人主键
|
||||||
// jsonObject.put("senderName", String.valueOf(thirdPartyMap.get("startName")) );//第三方待办发起人姓名
|
// jsonObject.put("senderName", String.valueOf(thirdPartyMap.get("startName")) );//第三方待办发起人姓名
|
||||||
jsonObject.put("senderName", "金蝶测试" );//todo 第三方待办发起人姓名
|
jsonObject.put("senderName", "金蝶测试" );//todo 第三方待办发起人姓名
|
||||||
// jsonObject.put("thirdReceiverId", approver.getString("number"));//第三方待办接收人主键(保证唯一)
|
// jsonObject.put("thirdReceiverId", approver.getString("number"));//第三方待办接收人主键(保证唯一)
|
||||||
jsonObject.put("thirdReceiverId", "jdtest");//todo 第三方待办接收人主键(保证唯一)
|
jsonObject.put("thirdReceiverId", "jdtest");//todo 第三方待办接收人主键(保证唯一)
|
||||||
jsonObject.put("creationDate", String.valueOf(thirdPartyMap.get("createDateStr")));//待办创建时间(格式:yyyy-MM-dd HH:mm:ss)
|
jsonObject.put("creationDate", String.valueOf(thirdPartyMap.get("createDateStr")));//待办创建时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||||
jsonObject.put("state", "0");//状态:0:未办理;1:已办理
|
jsonObject.put("state", "0");//状态:0:未办理;1:已办理
|
||||||
|
@ -225,7 +228,7 @@ public class OAUtils {
|
||||||
// 记录日志
|
// 记录日志
|
||||||
logger.info(logMessage);
|
logger.info(logMessage);
|
||||||
DobeDWUtils.saveLog(String.valueOf(thirdPartyMap.get("billNo")),
|
DobeDWUtils.saveLog(String.valueOf(thirdPartyMap.get("billNo")),
|
||||||
"致远", pendingsBody.toJSONString(), pendingPostjson,
|
"致远", pendingsBody.toJSONString()+"\n"+String.valueOf(thirdPartyMap.get("url1")), pendingPostjson,
|
||||||
result, "调用推送OA待办新增接口");
|
result, "调用推送OA待办新增接口");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +299,71 @@ public class OAUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金蝶系统推送OA待办新增
|
||||||
|
* @param thirdPartyMap 流程参数
|
||||||
|
*/
|
||||||
|
public static void thirdpartyMessage(HashMap<String, Object> thirdPartyMap){
|
||||||
|
|
||||||
|
// String oaUrl = System.getProperty("oaurl");
|
||||||
|
String messagesUrl = oaUrl + "/seeyon/rest/thirdpartyMessage/receive/messageList";
|
||||||
|
|
||||||
|
Map<String, String> messageHeader = new HashMap<>();
|
||||||
|
messageHeader.put("Content-Type", "application/json");
|
||||||
|
messageHeader.put("token", String.valueOf(thirdPartyMap.get("oaToken")));
|
||||||
|
//组装请求体
|
||||||
|
JSONObject messageBody = new JSONObject();
|
||||||
|
JSONArray messageList = new JSONArray();
|
||||||
|
//接口不支持接收人字段为多人,但接口支持批量 so 多人审批,遍历审批人集合,调用OA调待办接口
|
||||||
|
List<DynamicObject> approversLists = (List<DynamicObject>)thirdPartyMap.get("approversLists");
|
||||||
|
for (DynamicObject approver :approversLists ) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("thirdpartyMessageId", String.valueOf(thirdPartyMap.get("taskId")));//第三方待办主键(保证唯一)
|
||||||
|
jsonObject.put("thirdpartyRegisterCode", "3004");//系统注册编码
|
||||||
|
jsonObject.put("messageContent", String.valueOf(thirdPartyMap.get("content")) );//消息内容
|
||||||
|
// jsonObject.put("thirdpartySenderId", String.valueOf(thirdPartyMap.get("startNumber")));//第三方待办发起人主键
|
||||||
|
jsonObject.put("thirdpartySenderId", "jdtest");//todo 第三方待办发起人主键
|
||||||
|
// jsonObject.put("thirdpartyReceiverId", approver.getString("number"));//第三方待办接收人主键(保证唯一)
|
||||||
|
jsonObject.put("thirdpartyReceiverId", "jdtest");//todo 第三方待办接收人主键(保证唯一)
|
||||||
|
jsonObject.put("creation_date", String.valueOf(thirdPartyMap.get("createDateStr")));//待办创建时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||||
|
jsonObject.put("messageURL", String.valueOf(thirdPartyMap.get("url")));//PC端穿透链接
|
||||||
|
jsonObject.put("messageH5URL", "test");//移动端穿透链接
|
||||||
|
messageList.add(jsonObject);
|
||||||
|
}
|
||||||
|
messageBody.put("messages", messageList);
|
||||||
|
|
||||||
|
String pendingPostjson = null;
|
||||||
|
try {
|
||||||
|
// 发送POST请求并获取响应
|
||||||
|
pendingPostjson = HttpClientUtils.postjson(messagesUrl, messageHeader, messageBody.toJSONString());
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(pendingPostjson);
|
||||||
|
|
||||||
|
// 检查JSON对象是否为空
|
||||||
|
if (jsonObject != null && !jsonObject.isEmpty()) {
|
||||||
|
Boolean result = jsonObject.getBoolean("success");
|
||||||
|
String logMessage = result ? "金蝶系统推送OA消息成功!" : "金蝶系统推送OA消息失败!";
|
||||||
|
|
||||||
|
// 记录日志
|
||||||
|
logger.info(logMessage);
|
||||||
|
DobeDWUtils.saveLog(String.valueOf(thirdPartyMap.get("billNo")),
|
||||||
|
"致远", messageBody.toJSONString()+"\n"+String.valueOf(thirdPartyMap.get("url1")), pendingPostjson,
|
||||||
|
result, "调用推送OA消息接口");
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("接口返回结果:\n{}", pendingPostjson);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 记录异常信息
|
||||||
|
String errorMessage = String.format("接口异常:%s", e.getMessage());
|
||||||
|
logger.info(errorMessage);
|
||||||
|
DobeDWUtils.saveLog(String.valueOf(thirdPartyMap.get("billNo")),
|
||||||
|
"致远", messageBody.toJSONString(), e.getMessage(),
|
||||||
|
false, "调用推送OA消息接口");
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue