Compare commits
No commits in common. "3c45588864ce40eda71a5d55f5a7754e7377d08a" and "1849dbaac9b88b864e04273a77ce5e5200585a58" have entirely different histories.
3c45588864
...
1849dbaac9
|
@ -1,619 +0,0 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import kd.bos.bill.BillShowParameter;
|
||||
import kd.bos.bill.OperationStatus;
|
||||
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.resource.ResManager;
|
||||
import kd.bos.dataentity.serialization.SerializationUtils;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||
import kd.bos.filter.CommonFilterColumn;
|
||||
import kd.bos.filter.FilterColumn;
|
||||
import kd.bos.form.IFormView;
|
||||
import kd.bos.form.events.BeforeCreateListDataProviderArgs;
|
||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||
import kd.bos.form.events.FilterContainerInitArgs;
|
||||
import kd.bos.form.events.FilterContainerSearchClickArgs;
|
||||
import kd.bos.form.events.HyperLinkClickArgs;
|
||||
import kd.bos.form.events.SetFilterEvent;
|
||||
import kd.bos.form.field.ComboItem;
|
||||
import kd.bos.form.field.events.BeforeFilterF7SelectEvent;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.bos.image.pojo.ImageInfo;
|
||||
import kd.bos.list.BillList;
|
||||
import kd.bos.list.plugin.AbstractListPlugin;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.mvc.list.ListDataProvider;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.servicehelper.image.ImageServiceHelper;
|
||||
import kd.bos.servicehelper.workflow.WorkflowServiceHelper;
|
||||
import kd.bos.workflow.api.BizProcessStatus;
|
||||
import kd.fi.dhc.constant.EntityField;
|
||||
import kd.fi.dhc.dto.MyBillStatus;
|
||||
import kd.fi.dhc.formplugin.MyBillListPlugin;
|
||||
import kd.fi.dhc.helper.SscImageServiceHelper;
|
||||
import kd.fi.dhc.service.FieldMapService;
|
||||
import kd.fi.dhc.service.impl.FieldMapServiceImpl;
|
||||
import kd.fi.dhc.util.BillShowParameterUtil;
|
||||
import kd.fi.dhc.util.FormValidationUtil;
|
||||
|
||||
/**
|
||||
* 我的报账系统标准列表插件二开
|
||||
* 说明:去除报账状态的显示逻辑
|
||||
*/
|
||||
public class MyBillListPluginExt extends AbstractListPlugin {
|
||||
private List<FilterColumn> commonFilterColumnList = new ArrayList();
|
||||
private FieldMapService service = new FieldMapServiceImpl();
|
||||
private static final String CK_BILLKIND = "billkind";
|
||||
private static Log log = LogFactory.getLog(MyBillListPluginExt.class);
|
||||
|
||||
public MyBillListPluginExt() {
|
||||
}
|
||||
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
super.beforeDoOperation(args);
|
||||
IFormView view = this.getView();
|
||||
String operateKey = ((FormOperate)args.getSource()).getOperateKey();
|
||||
ListSelectedRowCollection selectedRows = ((BillList)this.getControl("billlistap")).getSelectedRows();
|
||||
if (!"doctrackup".equals(operateKey) && !"doctrackdown".equals(operateKey)) {
|
||||
long id;
|
||||
if ("donothing-viewimage".equals(operateKey)) {
|
||||
if (FormValidationUtil.isSelectRowsInvalid(this.getView(), selectedRows, false)) {
|
||||
args.setCancel(true);
|
||||
return;
|
||||
}
|
||||
|
||||
id = (Long)selectedRows.get(0).getPrimaryKeyValue();
|
||||
String selectField = EntityField.buildSelectField(new String[]{"id", "billid", "bill.number"});
|
||||
DynamicObject dyo = QueryServiceHelper.queryOne("dhc_mybilllist", selectField, new QFilter[]{new QFilter("id", "=", id)});
|
||||
if (dyo == null) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("查看影像失败,无法获取单据ID", "MyBillListPlugin_6", "fi-dhc-formplugin", new Object[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
String billId = dyo.getString("billid");
|
||||
String billType = dyo.getString("bill.number");
|
||||
ImageInfo imageInfo = new ImageInfo();
|
||||
imageInfo.setBillId(billId);
|
||||
ImageInfo imageInfoInside = ImageServiceHelper.getImageInfoInside(imageInfo);
|
||||
if (imageInfoInside == null) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("单据无影像,请先上传影像。", "MyBillListPlugin_7", "fi-dhc-formplugin", new Object[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
String imageNumber = imageInfoInside.getImageNo();
|
||||
SscImageServiceHelper.viewphoto(imageNumber, billId, billType, this.getView());
|
||||
} else if ("donothing-viewflow".equals(operateKey)) {
|
||||
if (FormValidationUtil.isSelectRowsInvalid(this.getView(), selectedRows, false)) {
|
||||
args.setCancel(true);
|
||||
return;
|
||||
}
|
||||
|
||||
id = (Long)selectedRows.get(0).getPrimaryKeyValue();
|
||||
DynamicObject dyo = QueryServiceHelper.queryOne("dhc_mybilllist", EntityField.buildSelectField(new String[]{"id", "billid"}), new QFilter[]{new QFilter("id", "=", id)});
|
||||
if (dyo == null) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("查看流程图失败,无法获取单据ID", "MyBillListPlugin_0", "fi-dhc-formplugin", new Object[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
String billId = dyo.getString("billid");
|
||||
|
||||
try {
|
||||
WorkflowServiceHelper.viewFlowchart(this.getView().getPageId(), billId);
|
||||
} catch (Exception var14) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("单据不在流程中,无法查看流程图!", "MyBillListPlugin_10", "fi-dhc-formplugin", new Object[0]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (FormValidationUtil.isSelectRowsInvalid(this.getView(), selectedRows, false)) {
|
||||
args.setCancel(true);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void filterContainerInit(FilterContainerInitArgs args) {
|
||||
super.filterContainerInit(args);
|
||||
this.commonFilterColumnList = args.getCommonFilterColumns();
|
||||
if (!this.isOverClick()) {
|
||||
Iterator var2 = this.commonFilterColumnList.iterator();
|
||||
|
||||
while(var2.hasNext()) {
|
||||
FilterColumn column = (FilterColumn)var2.next();
|
||||
CommonFilterColumn commonColumn = (CommonFilterColumn)column;
|
||||
if (StringUtils.equals(commonColumn.getFieldName(), "bill.name")) {
|
||||
this.iniL5Filter(commonColumn);
|
||||
String cacheValue = SerializationUtils.toJsonString(commonColumn.getComboItems());
|
||||
this.getPageCache().put("allbill", cacheValue);
|
||||
this.getPageCache().put("l5bill", cacheValue);
|
||||
column.setDefaultValue("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void filterContainerBeforeF7Select(BeforeFilterF7SelectEvent args) {
|
||||
super.filterContainerBeforeF7Select(args);
|
||||
String key = args.getFieldName();
|
||||
if (StringUtils.isNotBlank(key) && StringUtils.contains(key, "bill.")) {
|
||||
String selectedField = "entryentity.bill.number";
|
||||
String billKindJson = this.getPageCache().get("billkind");
|
||||
List<QFilter> qFilter = new ArrayList(1);
|
||||
if (StringUtils.isNotBlank(billKindJson)) {
|
||||
List idList = (List)SerializationUtils.fromJsonString(billKindJson, List.class);
|
||||
if (!idList.isEmpty()) {
|
||||
qFilter.add(new QFilter("id", "in", idList));
|
||||
}
|
||||
}
|
||||
|
||||
DynamicObjectCollection collections = QueryServiceHelper.query("dhc_billclassification", selectedField, (QFilter[])qFilter.toArray(new QFilter[0]));
|
||||
List<String> billIdList = new ArrayList(10);
|
||||
Iterator var8 = collections.iterator();
|
||||
|
||||
while(var8.hasNext()) {
|
||||
DynamicObject dyo = (DynamicObject)var8.next();
|
||||
billIdList.add(dyo.getString("entryentity.bill.number"));
|
||||
}
|
||||
|
||||
List<QFilter> qFilters = args.getQfilters();
|
||||
qFilters.add(new QFilter("number", "in", billIdList));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void filterContainerSearchClick(FilterContainerSearchClickArgs args) {
|
||||
super.filterContainerSearchClick(args);
|
||||
CommonFilterColumn l5column = this.getL5CommonFilterColumn(this.commonFilterColumnList);
|
||||
List<Map<String, List<Object>>> fastFilterValue = args.getSearchClickEvent().getFastFilterValues();
|
||||
if (fastFilterValue != null && fastFilterValue.size() > 0 && l5column != null) {
|
||||
this.rebuildL5FilterFromCache(l5column);
|
||||
} else {
|
||||
Map<String, List<Object>> commonFilters = args.getCurrentCommonFilter();
|
||||
if (commonFilters != null) {
|
||||
this.getPageCache().put("isoverclick", "true");
|
||||
List<Object> fieldName = (List)commonFilters.get("FieldName");
|
||||
List<Object> value = (List)commonFilters.get("Value");
|
||||
if (fieldName != null && fieldName.size() > 0 && value != null && value.size() > 0) {
|
||||
String currentFieldName = (String)fieldName.get(0);
|
||||
if (StringUtils.equals(currentFieldName, "billkind.id")) {
|
||||
List<Long> longId = new ArrayList(3);
|
||||
Iterator var9 = value.iterator();
|
||||
|
||||
while(var9.hasNext()) {
|
||||
Object obj = var9.next();
|
||||
String objTmp = obj + "";
|
||||
if (StringUtils.isNotBlank(obj.toString()) && !StringUtils.equals("null", objTmp)) {
|
||||
longId.add(Long.valueOf(objTmp));
|
||||
}
|
||||
}
|
||||
|
||||
if (!longId.isEmpty()) {
|
||||
this.rebuildCommonFilter(longId, this.commonFilterColumnList);
|
||||
this.getPageCache().put("billkind", SerializationUtils.toJsonString(longId));
|
||||
} else {
|
||||
this.rebuildCommonFilter((List)null, this.commonFilterColumnList);
|
||||
this.getPageCache().put("billkind", "");
|
||||
}
|
||||
|
||||
this.focusCommonFilter(args);
|
||||
} else if (l5column != null) {
|
||||
this.rebuildL5FilterFromCache(l5column);
|
||||
}
|
||||
}
|
||||
} else if (l5column != null) {
|
||||
this.rebuildL5FilterReturnFromSchemeSerach(l5column);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void rebuildL5FilterReturnFromSchemeSerach(CommonFilterColumn l5column) {
|
||||
if (this.getPageCache().get("allbill") != null && l5column != null) {
|
||||
// List<ComboItem> l5ComboItem = SerializationUtils.fromJsonStringToList(this.getPageCache().get("allbill"), ComboItem.class);//系统代码
|
||||
List<ComboItem> l5ComboItem = (List<ComboItem>) SerializationUtils.fromJsonStringToList(this.getPageCache().get("allbill"), ComboItem.class);//二开系统代码
|
||||
l5column.setComboItems(l5ComboItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void rebuildL5FilterFromCache(CommonFilterColumn l5column) {
|
||||
if (this.getPageCache().get("l5bill") != null && l5column != null) {
|
||||
// List<ComboItem> l5ComboItem = SerializationUtils.fromJsonStringToList(this.getPageCache().get("l5bill"), ComboItem.class);//系统代码
|
||||
List<ComboItem> l5ComboItem = (List<ComboItem>) SerializationUtils.fromJsonStringToList(this.getPageCache().get("l5bill"), ComboItem.class);//二开系统代码
|
||||
l5column.setComboItems(l5ComboItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setFilter(SetFilterEvent e) {
|
||||
RequestContext requestContext = RequestContext.get();
|
||||
Long currentUserId = Long.valueOf(requestContext.getUserId());
|
||||
QFilter currentPerson = new QFilter("applicant", "=", currentUserId);
|
||||
currentPerson.or(new QFilter("creator", "=", currentUserId));
|
||||
e.getQFilters().add(currentPerson);
|
||||
}
|
||||
|
||||
public void billListHyperLinkClick(HyperLinkClickArgs args) {
|
||||
super.billListHyperLinkClick(args);
|
||||
args.setCancel(true);
|
||||
String fielldName = args.getHyperLinkClickEvent().getFieldName();
|
||||
if (StringUtils.equals(fielldName, "billno")) {
|
||||
ListSelectedRow selectRow = ((BillList)this.getControl("billlistap")).getCurrentSelectedRowInfo();
|
||||
Long selectid = (Long)selectRow.getPrimaryKeyValue();
|
||||
this.showBillForm(selectid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showBillForm(Long selectDataId) {
|
||||
DynamicObject selectBillData = this.getSelectBillData(selectDataId);
|
||||
if (selectBillData == null) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("您选择的数据已被删除", "MyBillListPlugin_5", "fi-dhc-formplugin", new Object[0]));
|
||||
} else {
|
||||
String formId = selectBillData.getString("bill.number");
|
||||
String billId = selectBillData.getString("billid");
|
||||
if (StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(billId)) {
|
||||
BillShowParameter parameter = BillShowParameterUtil.getBusBillShowParamter(formId, billId);
|
||||
if (parameter != null) {
|
||||
parameter.setStatus(OperationStatus.EDIT);
|
||||
this.getView().showForm(parameter);
|
||||
}
|
||||
} else {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("您选择的数据已被删除", "MyBillListPlugin_5", "fi-dhc-formplugin", new Object[0]));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private DynamicObject getSelectBillData(Long selectDataId) {
|
||||
return QueryServiceHelper.queryOne("dhc_mybilllist", "billid,bill.number", new QFilter[]{new QFilter("id", "=", selectDataId)});
|
||||
}
|
||||
|
||||
private void rebuildCommonFilter(List<Long> billkind, List<FilterColumn> filterColumnList) {
|
||||
CommonFilterColumn l5column = this.getL5CommonFilterColumn(filterColumnList);
|
||||
if (l5column != null) {
|
||||
if (StringUtils.isBlank(billkind)) {
|
||||
// List<ComboItem> l5ComboItem = SerializationUtils.fromJsonStringToList(this.getPageCache().get("allbill"), ComboItem.class);//系统代码
|
||||
List<ComboItem> l5ComboItem = (List<ComboItem>) SerializationUtils.fromJsonStringToList(this.getPageCache().get("allbill"), ComboItem.class);//二开系统代码
|
||||
l5column.setComboItems(l5ComboItem);
|
||||
this.getPageCache().put("l5bill", SerializationUtils.toJsonString(l5column.getComboItems()));
|
||||
} else {
|
||||
this.rebuildL5Filter(l5column, billkind);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void iniL5Filter(CommonFilterColumn l5column) {
|
||||
this.setL5ColumnItems(l5column, (QFilter[])null);
|
||||
}
|
||||
|
||||
private void rebuildL5Filter(CommonFilterColumn l5column, List<Long> billkind) {
|
||||
QFilter[] qFilters = new QFilter[]{new QFilter("id", "in", billkind)};
|
||||
if (!billkind.isEmpty()) {
|
||||
this.setL5ColumnItems(l5column, qFilters);
|
||||
this.getPageCache().put("l5bill", SerializationUtils.toJsonString(l5column.getComboItems()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setL5ColumnItems(CommonFilterColumn l5column, QFilter[] qfilters) {
|
||||
String selectedField = "entryentity.bill.id,entryentity.bill.name";
|
||||
DynamicObjectCollection collections = QueryServiceHelper.query("dhc_billclassification", selectedField, qfilters);
|
||||
List<ComboItem> l5ComboItem = new ArrayList();
|
||||
List<String> billTypeIds = new ArrayList();
|
||||
Iterator var7 = collections.iterator();
|
||||
|
||||
while(var7.hasNext()) {
|
||||
DynamicObject dyo = (DynamicObject)var7.next();
|
||||
String billTypeId = dyo.getString("entryentity.bill.id");
|
||||
if (StringUtils.isNotBlank(billTypeId) && !billTypeIds.contains(billTypeId)) {
|
||||
ComboItem item = new ComboItem();
|
||||
item.setId(billTypeId);
|
||||
item.setCaption(new LocaleString(dyo.getString("entryentity.bill.name")));
|
||||
item.setValue(String.valueOf(dyo.get("entryentity.bill.id")));
|
||||
l5ComboItem.add(item);
|
||||
billTypeIds.add(billTypeId);
|
||||
}
|
||||
}
|
||||
|
||||
l5column.setComboItems(l5ComboItem);
|
||||
}
|
||||
|
||||
private CommonFilterColumn getL5CommonFilterColumn(List<FilterColumn> filterColumnList) {
|
||||
CommonFilterColumn l5column = null;
|
||||
Iterator var3 = filterColumnList.iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
FilterColumn column = (FilterColumn)var3.next();
|
||||
CommonFilterColumn commonColumn = (CommonFilterColumn)column;
|
||||
if (StringUtils.equals(commonColumn.getFieldName(), "bill.name")) {
|
||||
l5column = commonColumn;
|
||||
}
|
||||
}
|
||||
|
||||
return l5column;
|
||||
}
|
||||
|
||||
private void focusCommonFilter(FilterContainerSearchClickArgs args) {
|
||||
Map<String, List<Map<String, List<Object>>>> filterValues = args.getSearchClickEvent().getFilterValues();
|
||||
List<Map<String, List<Object>>> customFiterList = (List)filterValues.get("customfilter");
|
||||
Iterator var4 = customFiterList.iterator();
|
||||
|
||||
while(var4.hasNext()) {
|
||||
Map<String, List<Object>> filter = (Map)var4.next();
|
||||
List<Object> fieldNames = (List)filter.get("FieldName");
|
||||
if (fieldNames != null && !fieldNames.isEmpty()) {
|
||||
String fieldName = fieldNames.get(0).toString();
|
||||
if (StringUtils.equals("bill.id", fieldName)) {
|
||||
filter.replace("Value", Collections.singletonList(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean isOverClick() {
|
||||
return StringUtils.equals(this.getPageCache().get("isoverclick"), "true");
|
||||
}
|
||||
|
||||
public void beforeCreateListDataProvider(BeforeCreateListDataProviderArgs args) {
|
||||
super.beforeCreateListDataProvider(args);
|
||||
args.setListDataProvider(new ListDataProvider() {
|
||||
public DynamicObjectCollection getData(int arg0, int arg1) {
|
||||
DynamicObjectCollection collection = super.getData(arg0, arg1);
|
||||
Map<String, String> billInfoMap = new HashMap(22);
|
||||
collection.forEach((v) -> {
|
||||
String billId = String.valueOf(v.get("billid"));
|
||||
if (StringUtils.isNotBlank(billId)) {
|
||||
billInfoMap.put(String.valueOf(v.get("billid")), String.valueOf(v.get("bill.number")));
|
||||
}
|
||||
|
||||
});
|
||||
if (billInfoMap.size() > 0) {
|
||||
try {
|
||||
List<String> pkId = new ArrayList(billInfoMap.keySet());
|
||||
MyBillListPluginExt.this.setNextAuditor(collection, pkId);
|
||||
MyBillListPluginExt.this.setBillStatus(collection, billInfoMap);
|
||||
} catch (Exception var7) {
|
||||
MyBillListPluginExt.log.error("ErWorkFlowFlexListForOtherPlugin >>>>> 设置审批人时出现异常", var7);
|
||||
}
|
||||
}
|
||||
|
||||
String listSortColumn = MyBillListPluginExt.this.getListSortColumn();
|
||||
if (listSortColumn != null) {
|
||||
String[] s = listSortColumn.split(" ");
|
||||
if (s.length > 1) {
|
||||
if ("desc".equals(s[1])) {
|
||||
collection.sort(Comparator.comparing((o) -> {
|
||||
return o.getString(s[0]);
|
||||
}, Comparator.reverseOrder()));
|
||||
} else {
|
||||
collection.sort(Comparator.comparing((o) -> {
|
||||
return o.getString(s[0]);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setNextAuditor(DynamicObjectCollection collection, List<String> pkId) {
|
||||
Map<String, String> auditorsNameMap = this.getNextAuditor(pkId);
|
||||
collection.forEach((v) -> {
|
||||
String pkIdTemp = String.valueOf(v.get("billid"));
|
||||
|
||||
try {
|
||||
v.set("currentdealer", auditorsNameMap.get(pkIdTemp) == null ? "" : auditorsNameMap.get(pkIdTemp));
|
||||
} catch (Exception var4) {
|
||||
log.error("下一步审批人字段在列表中不存在", var4);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private Map<String, String> getNextAuditor(List<String> pkIds) {
|
||||
Map<String, String> nodeMap = new HashMap(20);
|
||||
String[] ids = new String[pkIds.size()];
|
||||
pkIds.toArray(ids);
|
||||
Map<String, List<BizProcessStatus>> allPro = WorkflowServiceHelper.getBizProcessStatus(ids);
|
||||
Iterator var5 = allPro.entrySet().iterator();
|
||||
|
||||
while(var5.hasNext()) {
|
||||
Map.Entry<String, List<BizProcessStatus>> entry = (Map.Entry)var5.next();
|
||||
String pkid = (String)entry.getKey();
|
||||
List<BizProcessStatus> node = (List)allPro.get(pkid);
|
||||
node.forEach((e) -> {
|
||||
String nodeStr = e.getCurrentNodeName();
|
||||
String auditor = e.getParticipantName();
|
||||
if (auditor != null && !"".equals(auditor.trim())) {
|
||||
nodeStr = nodeStr + " / " + auditor;
|
||||
}
|
||||
|
||||
if (nodeStr.length() > 26) {
|
||||
nodeStr = nodeStr.substring(0, 26);
|
||||
}
|
||||
|
||||
nodeMap.put(pkid, nodeStr);
|
||||
});
|
||||
}
|
||||
|
||||
return nodeMap;
|
||||
}
|
||||
|
||||
private void setBillStatus(DynamicObjectCollection collection, Map<String, String> billInfoMap) {
|
||||
Map<String, MyBillStatus> billStatusMap = this.getBillStatus(billInfoMap);
|
||||
collection.forEach((v) -> {
|
||||
String pkIdTemp = String.valueOf(v.get("billid"));
|
||||
|
||||
try {
|
||||
MyBillStatus statusValue = (MyBillStatus)billStatusMap.get(pkIdTemp);
|
||||
if (statusValue != null) {
|
||||
String reimburseStatus = statusValue.getReimburseStatus();
|
||||
String billStatus = statusValue.getBillStatus();
|
||||
String bizStatus = statusValue.getBizStatus();
|
||||
// v.set("reimbursestatus", reimburseStatus);//二开注释掉的
|
||||
v.set("billstatusext", billStatus);
|
||||
v.set("businessstatus", bizStatus);
|
||||
}
|
||||
} catch (Exception var7) {
|
||||
log.info("下一步审批人字段在列表中不存在");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private Map<String, MyBillStatus> getBillStatus(Map<String, String> billInfoMap) {
|
||||
Map<String, List<String>> reorgData = this.orgBillBaseBillType(billInfoMap);
|
||||
Map<String, MyBillStatus> billStatusMap = new HashMap(20);
|
||||
Iterator var4 = reorgData.entrySet().iterator();
|
||||
|
||||
while(true) {
|
||||
String billType;
|
||||
QFilter[] qryFilters;
|
||||
String selectFields;
|
||||
do {
|
||||
if (!var4.hasNext()) {
|
||||
return billStatusMap;
|
||||
}
|
||||
|
||||
Map.Entry<String, List<String>> entry = (Map.Entry)var4.next();
|
||||
billType = (String)entry.getKey();
|
||||
/* List<Long> billIds = (List)((List)entry.getValue()).stream().map((v) -> {
|
||||
return Long.parseLong(v.trim());
|
||||
}).collect(Collectors.toList());*///系统代码
|
||||
List<Long> billIds = (List)((List)entry.getValue()).stream().map((v) -> {
|
||||
if (v == null) {
|
||||
return null;
|
||||
}
|
||||
String strValue = v.toString().trim();
|
||||
if (strValue.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return Long.parseLong(strValue);
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());//二开系统代码
|
||||
qryFilters = new QFilter[]{new QFilter("id", "in", billIds)};
|
||||
selectFields = this.getSelectFieldsWithBillType(billType);
|
||||
} while(StringUtils.isBlank(selectFields));
|
||||
|
||||
DynamicObjectCollection queryData = QueryServiceHelper.query(billType, selectFields, qryFilters);
|
||||
Iterator var11 = queryData.iterator();
|
||||
|
||||
while(var11.hasNext()) {
|
||||
DynamicObject data = (DynamicObject)var11.next();
|
||||
this.updateBillStatusMap(billStatusMap, billType, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, List<String>> orgBillBaseBillType(Map<String, String> billInfoMap) {
|
||||
Map<String, List<String>> rtnData = new HashMap(20);
|
||||
Iterator var3 = billInfoMap.entrySet().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
Map.Entry<String, String> entry = (Map.Entry)var3.next();
|
||||
String billId = (String)entry.getKey();
|
||||
String billType = (String)entry.getValue();
|
||||
if (!StringUtils.isBlank(billType)) {
|
||||
List<String> billIdList = (List)rtnData.get(billType);
|
||||
if (billIdList == null) {
|
||||
/* List<String> billIdList = new ArrayList(1);
|
||||
billIdList.add(billId);
|
||||
rtnData.put(billType, billIdList);*///系统代码
|
||||
List<String> billIdList1 = new ArrayList(1);
|
||||
billIdList1.add(billId);
|
||||
rtnData.put(billType, billIdList1);//二开替代
|
||||
} else {
|
||||
billIdList.add(billId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rtnData;
|
||||
}
|
||||
|
||||
private String getSelectFieldsWithBillType(String billType) {
|
||||
String selectField = null;
|
||||
String billStatus = this.service.getBillStatusField(billType);
|
||||
if (StringUtils.isNotBlank(billStatus)) {
|
||||
selectField = EntityField.buildSelectField(new String[]{"id", billStatus});
|
||||
String isLoan = "er_tripreqbill".equals(billType) ? "isloan" : null;
|
||||
if (StringUtils.isNotBlank(isLoan)) {
|
||||
selectField = EntityField.buildSelectField(new String[]{selectField, isLoan});
|
||||
}
|
||||
}
|
||||
|
||||
return selectField;
|
||||
}
|
||||
|
||||
private void updateBillStatusMap(Map<String, MyBillStatus> billStatusMap, String billType, DynamicObject data) {
|
||||
String billId = data.getString("id");
|
||||
String billStatus = "";
|
||||
String reimburseStatus = "";
|
||||
String bizStatus = "";
|
||||
String billStatusField = this.service.getBillStatusField(billType);
|
||||
if (!StringUtils.isBlank(billStatusField)) {
|
||||
billStatus = data.getString(billStatusField) == null ? "" : data.getString(billStatusField);
|
||||
if (!StringUtils.isBlank(billStatus)) {
|
||||
if (StringUtils.equals("er_tripreqbill", billType)) {
|
||||
boolean isLoan = data.getBoolean("isloan");
|
||||
if (isLoan) {
|
||||
reimburseStatus = this.service.getRemiStatus(billType.concat("_loan"), billStatus);
|
||||
} else {
|
||||
reimburseStatus = this.service.getRemiStatus(billType, billStatus);
|
||||
}
|
||||
} else {
|
||||
reimburseStatus = this.service.getRemiStatus(billType, billStatus);
|
||||
}
|
||||
|
||||
if (reimburseStatus == null) {
|
||||
reimburseStatus = "";
|
||||
}
|
||||
|
||||
String billStatusName = this.service.getBillStatusName(billType, billStatus);
|
||||
if (billStatusName == null) {
|
||||
billStatusName = "";
|
||||
}
|
||||
|
||||
MyBillStatus status = new MyBillStatus();
|
||||
status.setBillStatus(billStatusName);
|
||||
status.setReimburseStatus(reimburseStatus);
|
||||
billStatusMap.put(billId, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getListSortColumn() {
|
||||
BillList billList = (BillList)this.getControl("billlistap");
|
||||
String sortInfo = billList.getEntryState().getSortInfo();
|
||||
if (sortInfo == null) {
|
||||
return null;
|
||||
} else {
|
||||
String[] strings = sortInfo.split(",");
|
||||
if (strings.length < 1) {
|
||||
return null;
|
||||
} else {
|
||||
List<String> collect = (List)Arrays.stream(strings).filter((s) -> {
|
||||
return s.contains("reimbursestatus") || s.contains("billstatusext") || s.contains("currentdealer");
|
||||
}).collect(Collectors.toList());
|
||||
return collect.size() > 0 ? (String)collect.get(0) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,9 +19,8 @@ import java.util.Map;
|
|||
public class ReimbursementStatusTaskPlugin extends AbstractTask {
|
||||
@Override
|
||||
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
||||
QFilter qFilters = new QFilter("bill.number", QCP.equals, "er_publicreimbursebill");//业务单据-对公报销单
|
||||
qFilters.and(new QFilter("billstatusext", QCP.equals, "审核通过"));//单据状态-审核通过
|
||||
qFilters.and(new QFilter("reimbursestatus", QCP.equals, "1"));//报账状态-报账中
|
||||
QFilter qFilters = new QFilter("bill.number", QCP.equals, "er_publicreimbursebill");
|
||||
qFilters.and(new QFilter("billstatusext", QCP.equals, "审核通过"));
|
||||
DynamicObject[] dhc_myBillLists = BusinessDataServiceHelper.load("dhc_mybilllist",
|
||||
"id,billno,reimbursestatus", new QFilter[]{qFilters});//我的报账
|
||||
|
||||
|
|
Loading…
Reference in New Issue