用款部门过滤报销人
This commit is contained in:
parent
d8247aeab1
commit
4a98296374
|
@ -36,6 +36,9 @@ import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
import kd.bos.form.events.ClientCallBackEvent;
|
import kd.bos.form.events.ClientCallBackEvent;
|
||||||
import kd.bos.form.events.ClosedCallBackEvent;
|
import kd.bos.form.events.ClosedCallBackEvent;
|
||||||
|
import kd.bos.form.field.BasedataEdit;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||||
import kd.bos.form.operate.FormOperate;
|
import kd.bos.form.operate.FormOperate;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
import kd.bos.imageplatform.axis.IScanWebServiceImplServiceStub;
|
import kd.bos.imageplatform.axis.IScanWebServiceImplServiceStub;
|
||||||
|
@ -78,16 +81,22 @@ import java.util.stream.Collectors;
|
||||||
* 发票识别,发票验真验重
|
* 发票识别,发票验真验重
|
||||||
* qeug_recon_payreqbill_ext && qeug_recon_connotextb_ext
|
* qeug_recon_payreqbill_ext && qeug_recon_connotextb_ext
|
||||||
*/
|
*/
|
||||||
public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadListener {
|
public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF7SelectListener {
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(OAUtils.class);
|
private static final Log logger = LogFactory.getLog(OAUtils.class);
|
||||||
|
|
||||||
List<String> fileExtendList = new ArrayList<String>(Arrays.asList("png","jpg","jpeg","ofd","pdf","xml"));//发票文件后缀集合
|
List<String> fileExtendList = new ArrayList<String>(Arrays.asList("png","jpg","jpeg","ofd","pdf","xml"));//发票文件后缀集合
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerListener(EventObject e) {
|
public void registerListener(EventObject e) {
|
||||||
super.registerListener(e);
|
super.registerListener(e);
|
||||||
AttachmentPanel attachmentPanel = getControl("qeug_attachmentpanelap");
|
String billtype = this.getModel().getDataEntity().getDynamicObjectType().getName();//获取单据标识
|
||||||
attachmentPanel.addUploadListener(this);
|
if ("recon_connotextbill".equals(billtype)){//当单据为费用登记单时,对该控件进行过滤监听。
|
||||||
|
BasedataEdit edit = this.getView().getControl("qeug_personbank");//获取报销人控件
|
||||||
|
edit.addBeforeF7SelectListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -637,7 +646,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadL
|
||||||
linkBody.put("loginName",loginName);
|
linkBody.put("loginName",loginName);
|
||||||
String token = "";
|
String token = "";
|
||||||
try {
|
try {
|
||||||
String linkPostjson = HttpClientUtils.postjson(linkUrl, null, linkBody.toJSONString());
|
String linkPostjson = HttpClientUtils.postjson(linkUrl, null, linkBody.toJSONString(),3*60*1000,3*60*1000);
|
||||||
logger.info("获取OaToken接口返回结果:\n{}", linkPostjson);
|
logger.info("获取OaToken接口返回结果:\n{}", linkPostjson);
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(linkPostjson)) {
|
if (StringUtils.isNotEmpty(linkPostjson)) {
|
||||||
|
@ -665,7 +674,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadL
|
||||||
base64Header.put("Content-Type", "application/json");
|
base64Header.put("Content-Type", "application/json");
|
||||||
base64Header.put("token", token);
|
base64Header.put("token", token);
|
||||||
try {
|
try {
|
||||||
String linkPostjson = HttpClientUtils.postjson(linkUrl, base64Header,strJson);
|
String linkPostjson = HttpClientUtils.postjson(linkUrl, base64Header,strJson,3*60*1000,3*60*1000);
|
||||||
logger.info("获取parseOCRData接口返回结果:\n{}", linkPostjson);
|
logger.info("获取parseOCRData接口返回结果:\n{}", linkPostjson);
|
||||||
if (StringUtils.isNotEmpty(linkPostjson)) {
|
if (StringUtils.isNotEmpty(linkPostjson)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(linkPostjson);
|
JSONObject jsonObject = JSONObject.parseObject(linkPostjson);
|
||||||
|
@ -691,7 +700,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadL
|
||||||
saveCheckHeader.put("token", token);
|
saveCheckHeader.put("token", token);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String linkPostjson = HttpClientUtils.postjson(linkUrl, saveCheckHeader,strJson);
|
String linkPostjson = HttpClientUtils.postjson(linkUrl, saveCheckHeader,strJson,3*60*1000,3*60*1000);
|
||||||
logger.info("获取saveOutInvoice接口返回结果:\n{}", linkPostjson);
|
logger.info("获取saveOutInvoice接口返回结果:\n{}", linkPostjson);
|
||||||
if (StringUtils.isNotEmpty(linkPostjson)) {
|
if (StringUtils.isNotEmpty(linkPostjson)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(linkPostjson);
|
JSONObject jsonObject = JSONObject.parseObject(linkPostjson);
|
||||||
|
@ -749,5 +758,36 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadL
|
||||||
String baseStr = new String(Base64.getEncoder().encode(bytes));
|
String baseStr = new String(Base64.getEncoder().encode(bytes));
|
||||||
return baseStr;
|
return baseStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报销人根据用款部门过滤
|
||||||
|
* @param beforeF7SelectEvent
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
|
||||||
|
String name = beforeF7SelectEvent.getProperty().getName();
|
||||||
|
if ("qeug_personbank".equals(name)){
|
||||||
|
DynamicObject dataEntity = this.getModel().getDataEntity();
|
||||||
|
DynamicObject usedepart = dataEntity.getDynamicObject("usedepart");//获取用款部门数据
|
||||||
|
if (usedepart != null){
|
||||||
|
Long departId = usedepart.getLong("id");//用款部门id
|
||||||
|
List<Long> allUsersOfOrg = UserServiceHelper.getAllUsersOfOrg(departId);//得到当前组织的全部人员,包括直属员工和下属组织的员工
|
||||||
|
QFilter qFilter = new QFilter("id", QCP.in, allUsersOfOrg);
|
||||||
|
DynamicObject[] bos_users = BusinessDataServiceHelper.load("bos_user", "id,number", qFilter.toArray());
|
||||||
|
List<String> userNumbers = new ArrayList<String>();//构建人员工号容器
|
||||||
|
for (DynamicObject bos_user : bos_users) {
|
||||||
|
String number = bos_user.getString("number");
|
||||||
|
userNumbers.add(number);
|
||||||
|
}
|
||||||
|
QFilter qfByNumber = new QFilter("number", QCP.in, userNumbers);
|
||||||
|
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||||
|
formShowParameter.getListFilterParameter().setFilter(qfByNumber);
|
||||||
|
}else {
|
||||||
|
beforeF7SelectEvent.setCancel(true);
|
||||||
|
this.getView().showTipNotification("请先选择用款部门");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule("recon_invoicebill", recon_invoicebill, null);
|
// CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule("recon_invoicebill", recon_invoicebill, null);
|
Loading…
Reference in New Issue