2 Commits 17df8ec9cd ... d2f852ccc2

Autore SHA1 Messaggio Data
  tanya d2f852ccc2 Merge branch 'master' of http://111.75.220.136:10030/turborao/jyyy 3 settimane fa
  tanya db38cf1050 1.单据范围增加借款单 3 settimane fa

+ 55 - 0
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/business/plugin/LocationCityPlugin.java

@@ -0,0 +1,55 @@
+package nckd.jimin.jyyy.fi.business.plugin;
+
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.logging.Log;
+import kd.bos.logging.LogFactory;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.QueryServiceHelper;
+import kd.fi.er.business.trip.exception.TripSyncLogParam;
+
+import java.util.Map;
+
+/**
+ * 获取人员常驻工作地插件
+ */
+public class LocationCityPlugin {
+
+    private static final Log logger = LogFactory.getLog(LocationCityPlugin.class);
+
+    public Object getLocationCity(Map<String, Object> map, TripSyncLogParam tripSyncLogParam) {
+        logger.info("商旅集成,字段映射插件执行:{} ", tripSyncLogParam.getTraceid());
+        DynamicObject billInfo = (DynamicObject)map.get("bill");
+
+        String billfield = (String)map.get("billfield");
+        logger.info("billfield:{}  ", billfield);
+        if(billInfo != null){
+            // 传报销人
+            return getLocationCity(billInfo.getDynamicObject("applier").getPkValue());
+        }
+        return null;
+    }
+
+    public Object getLocationCity(Object userId){
+        // 申请人 -> HR人员 -> 常驻工作地 -> 工作地
+        DynamicObject userInfo = QueryServiceHelper.queryOne("bos_user", "number", new QFilter("id,number", QCP.equals, userId).toArray());
+        DynamicObject hrPerson = QueryServiceHelper.queryOne("hrpi_person", "id", new QFilter[]{
+                new QFilter("number", QCP.equals, userInfo.getString("number")),
+                new QFilter("iscurrentversion", QCP.equals, Boolean.TRUE)
+        });
+
+        if(hrPerson != null){
+            DynamicObject baseLocation = QueryServiceHelper.queryOne("hrpi_baselocation", "location.city.id", new QFilter[]{
+                    new QFilter("person", QCP.equals, hrPerson.getLong("id")),
+                    new QFilter("iscurrentversion", QCP.equals, Boolean.TRUE)
+            });
+
+            if(baseLocation != null){
+                return baseLocation.getLong("location.city.id");
+            }
+
+        }
+        return null;
+    }
+
+}

+ 5 - 0
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/common/constant/BillTypeConstants.java

@@ -35,4 +35,9 @@ public interface BillTypeConstants {
      * 预付单
      */
     String ER_PREPAYBILL = "er_prepaybill";
+
+    /**
+     * 借款单
+     */
+    String ER_DAILYLOANBILL = "er_dailyloanbill";
 }

+ 21 - 0
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/common/entity/MergePrintEntity.java

@@ -24,17 +24,30 @@ public class MergePrintEntity {
      */
     private int index;
 
+    private boolean isMainBill;
+
     public MergePrintEntity(String formId, String templateId, List<Object> pkIds) {
         this.formId = formId;
         this.templateId = templateId;
         this.pkIds = pkIds;
     }
 
+
+
+    public MergePrintEntity(String formId, String templateId, List<Object> pkIds, int index, boolean isMainBill) {
+        this.formId = formId;
+        this.templateId = templateId;
+        this.pkIds = pkIds;
+        this.index = index;
+        this.isMainBill = isMainBill;
+    }
+
     public MergePrintEntity(String formId, String templateId, List<Object> pkIds, int index) {
         this.formId = formId;
         this.templateId = templateId;
         this.pkIds = pkIds;
         this.index = index;
+        this.isMainBill = false;
     }
 
     public String getFormId() {
@@ -68,4 +81,12 @@ public class MergePrintEntity {
     public void setIndex(int index) {
         this.index = index;
     }
+
+    public boolean isMainBill() {
+        return isMainBill;
+    }
+
+    public void setMainBill(boolean mainBill) {
+        isMainBill = mainBill;
+    }
 }

+ 20 - 12
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/common/util/ReceiveTicketUtils.java

@@ -1,11 +1,8 @@
 package nckd.jimin.jyyy.fi.common.util;
 
 import com.kingdee.bos.util.backport.Collections;
-import kd.bos.cache.CacheFactory;
-import kd.bos.cache.TempFileCache;
 import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.dataentity.entity.DynamicObjectCollection;
-import kd.bos.dataentity.resource.ResManager;
 import kd.bos.dataentity.utils.StringUtils;
 import kd.bos.db.DB;
 import kd.bos.db.DBRoute;
@@ -22,10 +19,11 @@ import kd.bos.servicehelper.AttachmentServiceHelper;
 import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.PrintServiceHelper;
 import kd.bos.servicehelper.QueryServiceHelper;
+import kd.bos.svc.util.print.PrintFileUtil;
 import kd.bos.util.CollectionUtils;
 import kd.bos.web.actions.utils.FilePathUtil;
-import nckd.jimin.jyyy.fi.common.constant.ErPrintSetConstant;
 import nckd.jimin.jyyy.fi.common.constant.BillTypeConstants;
+import nckd.jimin.jyyy.fi.common.constant.ErPrintSetConstant;
 import nckd.jimin.jyyy.fi.common.entity.MergePrintEntity;
 
 import java.io.ByteArrayInputStream;
@@ -79,15 +77,15 @@ public class ReceiveTicketUtils {
         }
 
         if(CollectionUtils.isNotEmpty(mergeArray)){
-            byte[] bytes = PrintServiceHelper.mergeMultiPdf(mergeArray);//拼接文件流
-            ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
-            TempFileCache tfc = CacheFactory.getCommonCacheFactory().getTempFileCache();
+            byte[] multiPdf = PrintServiceHelper.mergeMultiPdf(mergeArray);//拼接文件流
             // 设置临时文件有效时间
-            return tfc.saveAsUrl(fileName+".pdf", bin, 60 * 60 * 2);//文件流生成临时文件
+            return "tempfile/print.do?" + PrintFileUtil.saveInputStream2TempFile(fileName+".pdf",
+                    new ByteArrayInputStream(multiPdf), 3600 * 2);
         }
         return "";
     }
 
+
     public static String getPrintTemplateId(String appId,String formId, Object billId) {
         TplMatcherParam param = new TplMatcherParam();
         param.setEntityId(formId);//表单id
@@ -146,20 +144,30 @@ public class ReceiveTicketUtils {
         if(billEntryList.size() > 1){
             throw new KDBizException("打印配置中单据存在多条配置。");
         }
+        DynamicObject billConfigEntry = billEntryList.get(0);
 
         Map<String, Set<Object>> relationBelowBillMap = ErFindRelationBillUtils.getRelationBelowBillMap(billId.toString(), formId);
-        DynamicObject billConfigEntry = billEntryList.get(0);
+        // 打印单据
         if(billConfigEntry.getBoolean(ErPrintSetConstant.BillPtSetEntry.KEY_NCKD_ISPTCOVER)){
-            String printTemplateId = getPrintTemplateId(null, formId, billId);
-            mergePrintList.add(new MergePrintEntity(formId,printTemplateId, Collections.singletonList(billId),billConfigEntry.getInt(ErPrintSetConstant.BillPtSetEntry.KEY_NCKD_COVERORDER)));
+            String mainBillTpl = getPrintTemplateId(null, formId, billId);
+            mergePrintList.add(new MergePrintEntity(formId,mainBillTpl, Collections.singletonList(billId),billConfigEntry.getInt(ErPrintSetConstant.BillPtSetEntry.KEY_NCKD_COVERORDER),true));
         }
+
         if(billConfigEntry.getBoolean(ErPrintSetConstant.BillPtSetEntry.KEY_NCKD_ISPTVOUCHER)){
             if(relationBelowBillMap.containsKey(BillTypeConstants.GL_VOUCHER)){
                 Set<Object> voucherIdList = relationBelowBillMap.get(BillTypeConstants.GL_VOUCHER);
+                List<MergePrintEntity> vcPrintList = new ArrayList<>(voucherIdList.size());
                 for(Object voucherId : voucherIdList){
                     String printTemplateId = getPrintTemplateId(null, BillTypeConstants.GL_VOUCHER, voucherId);
-                    mergePrintList.add(new MergePrintEntity(BillTypeConstants.GL_VOUCHER,printTemplateId, Collections.singletonList(voucherId),billConfigEntry.getInt(ErPrintSetConstant.BillPtSetEntry.KEY_NCKD_VOUCHERORDER)));
+                    vcPrintList.add(new MergePrintEntity(BillTypeConstants.GL_VOUCHER,printTemplateId, Collections.singletonList(voucherId),billConfigEntry.getInt(ErPrintSetConstant.BillPtSetEntry.KEY_NCKD_VOUCHERORDER)));
+                }
+
+                // 如果不打印业务单据,则从凭证中选一条作为住单据
+                if(!billConfigEntry.getBoolean(ErPrintSetConstant.BillPtSetEntry.KEY_NCKD_ISPTCOVER)){
+                    vcPrintList.get(0).setMainBill(true);
                 }
+
+                mergePrintList.addAll(vcPrintList);
             }
         }
         if(billConfigEntry.getBoolean(ErPrintSetConstant.BillPtSetEntry.KEY_NCKD_ISPTRECEIPT)){

+ 4 - 27
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/plugin/form/ErDailyVehicleBillEdit.java

@@ -2,9 +2,7 @@ package nckd.jimin.jyyy.fi.plugin.form;
 
 import kd.bos.bill.AbstractBillPlugIn;
 import kd.bos.dataentity.entity.DynamicObject;
-import kd.bos.orm.query.QCP;
-import kd.bos.orm.query.QFilter;
-import kd.bos.servicehelper.QueryServiceHelper;
+import nckd.jimin.jyyy.fi.business.plugin.LocationCityPlugin;
 
 import java.util.EventObject;
 
@@ -24,31 +22,10 @@ public class ErDailyVehicleBillEdit extends AbstractBillPlugIn {
      * 外办城市默认赋值
      */
     protected void initVehiclecity(){
-        // 申请人 -> HR人员 -> 常驻工作地 -> 工作地
+
         DynamicObject dataEntity = this.getModel().getDataEntity(true);
         DynamicObject applier = dataEntity.getDynamicObject("applier");
-        if(applier == null){
-            return;
-        }
-        DynamicObject hrPerson = QueryServiceHelper.queryOne("hrpi_person", "id", new QFilter[]{
-                new QFilter("number", QCP.equals, applier.getString("number")),
-                new QFilter("iscurrentversion", QCP.equals, Boolean.TRUE)
-        });
-
-        if(hrPerson == null){
-            return;
-        }
-        DynamicObject baseLocation = QueryServiceHelper.queryOne("hrpi_baselocation", "location.city.id", new QFilter[]{
-                new QFilter("person", QCP.equals, hrPerson.getLong("id")),
-                new QFilter("iscurrentversion", QCP.equals, Boolean.TRUE)
-        });
-
-        if(baseLocation == null){
-            return;
-        }
-        long cityId = baseLocation.getLong("location.city.id");
-        if(cityId != 0L){
-            getModel().setItemValueByID("vehiclecity",cityId);
-        }
+        Object cityId = new LocationCityPlugin().getLocationCity(applier.getPkValue());
+        getModel().setItemValueByID("vehiclecity",cityId);
     }
 }

+ 6 - 4
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/plugin/form/HandInReceiveTicketPlugin.java

@@ -130,7 +130,7 @@ public class HandInReceiveTicketPlugin extends AbstractFormPlugin implements Row
         }
 
         String[] findBillArray = new String[]{BillTypeConstants.ER_PUBLICREIMBURSEBILL,BillTypeConstants.ER_DAILYREIMBURSEBILL,
-                BillTypeConstants.ER_TRIPREIMBURSEBILL,BillTypeConstants.ER_CHECKINGPAYBILL,BillTypeConstants.ER_PREPAYBILL};
+                BillTypeConstants.ER_TRIPREIMBURSEBILL,BillTypeConstants.ER_CHECKINGPAYBILL,BillTypeConstants.ER_PREPAYBILL,BillTypeConstants.ER_DAILYLOANBILL};
         for(String billType : findBillArray){
             Boolean isFind = loadBillInfo(billType, scanNumber);
             if(isFind){
@@ -411,6 +411,8 @@ public class HandInReceiveTicketPlugin extends AbstractFormPlugin implements Row
             allRow[i] = i ;
         }
         reloadEntryRow(allRow);
+
+        getView().showSuccessNotification("刷新成功。");
     }
 
     protected void doMail(){
@@ -533,12 +535,12 @@ public class HandInReceiveTicketPlugin extends AbstractFormPlugin implements Row
         Object companyId = selectRow.getDynamicObject(HandInReceiveTicketConstant.SCANBILLENTRY.KEY_NCKD_COMPANY).getPkValue();
         String formId = selectRow.getString(HandInReceiveTicketConstant.SCANBILLENTRY.KEY_NCKD_FORMID);
         String billId = selectRow.getString(HandInReceiveTicketConstant.SCANBILLENTRY.KEY_NCKD_BILLID);
-
         // 通过打印配置获取单据打印信息
         List<MergePrintEntity> printPdfConfig = ReceiveTicketUtils.getPrintPdfConfig(formId,Long.valueOf(billId),companyId);
+
         String printFileName = String.format("%s报销信息打印",selectRow.getString(HandInReceiveTicketConstant.SCANBILLENTRY.KEY_NCKD_NUMBER));
-        String downloadUrl = ReceiveTicketUtils.mergePrintPdf(getView(), printPdfConfig, printFileName);
-        getView().download(downloadUrl);
+        String previewUrl = ReceiveTicketUtils.mergePrintPdf(getView(), printPdfConfig, printFileName);
+        getView().openUrl(previewUrl);
         getView().showSuccessNotification("打印成功。");
     }
 

+ 13 - 4
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/plugin/workflow/TaskApproverWorkflowPlugin.java

@@ -1,9 +1,9 @@
 package nckd.jimin.jyyy.fi.plugin.workflow;
 
 
+import com.kingdee.bos.util.backport.Collections;
 import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
-import kd.bos.dataentity.resource.ResManager;
 import kd.bos.entity.EntityMetadataCache;
 import kd.bos.logging.BizLog;
 import kd.bos.orm.query.QCP;
@@ -11,6 +11,7 @@ import kd.bos.orm.query.QFilter;
 import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.operation.SaveServiceHelper;
 import kd.bos.workflow.api.AgentExecution;
+import kd.bos.workflow.api.AgentTask;
 import kd.bos.workflow.engine.extitf.IWorkflowPlugin;
 import nckd.jimin.jyyy.fi.common.constant.ErReimBurseBillConstant;
 
@@ -26,7 +27,12 @@ public class TaskApproverWorkflowPlugin implements IWorkflowPlugin {
         IWorkflowPlugin.super.notify(e);
         String businessKey = e.getBusinessKey();
         String entityNumber = e.getEntityNumber();
-        updateBillTaskApprover(businessKey,entityNumber);
+        //获取当前工作流节点
+        AgentTask currentTask = e.getCurrentTask();
+        //获取当前节点实际审批人ID
+        Long assigneeId = currentTask.getAssigneeId();
+
+        updateBillTaskApprover(businessKey,entityNumber, Collections.singletonList(assigneeId));
     }
 
     /**
@@ -34,7 +40,7 @@ public class TaskApproverWorkflowPlugin implements IWorkflowPlugin {
      * @param billId
      * @param formId
      */
-    protected void updateBillTaskApprover(Object billId,String formId){
+    protected void updateBillTaskApprover(Object billId,String formId,List<Long> currentApprover){
         DynamicObjectType entityType = EntityMetadataCache.getDataEntityType(formId);
         if(!entityType.getProperties().containsKey(ErReimBurseBillConstant.KEY_NCKD_TASKAPPROVER)){
             BizLog.log(String.format("单据类型【%1&s】没有共享审核人字段,无需更新",formId));
@@ -48,9 +54,12 @@ public class TaskApproverWorkflowPlugin implements IWorkflowPlugin {
                 new QFilter("billnumber", QCP.equals,billInfo.getString("billno"))
         },"completetime desc");
 
+        // 优先取共享审核人
         if(taskTaskhistories.length > 0){
             billInfo.set(ErReimBurseBillConstant.KEY_NCKD_TASKAPPROVER,taskTaskhistories[0].getDynamicObject("personid"));
-            SaveServiceHelper.save(new DynamicObject[]{ billInfo });
+        }else{
+            billInfo.set(ErReimBurseBillConstant.KEY_NCKD_TASKAPPROVER,currentApprover.get(0));
         }
+        SaveServiceHelper.save(new DynamicObject[]{ billInfo });
     }
 }