Преглед на файлове

银行回单修改

Signed-off-by: EDZ <1>
EDZ преди 3 години
родител
ревизия
d80a2bf7fe

+ 16 - 14
src/main/java/net/chenlin/dp/common/openapi4j/examples/voucher/VoucherAdd.java

@@ -38,6 +38,7 @@ public class VoucherAdd {
 
         Map<String,Object> jsonBodyMap = new HashMap<>();
         Map<String,Object> voucher = new HashMap<>();//凭证数据详情
+        String sqr = map.get("申请人").toString();
 
         voucher.put("voucher_type","记");//凭证类别
 //        voucher.put("fiscal_year","2021");//凭证所属的会计年度,不填写取当前年
@@ -111,7 +112,7 @@ public class VoucherAdd {
         entryDebitMap.put("auxiliary",auxiliaryDebit);
 
 //        entryDebitMap.put("settlement","8");
-        entryDebitMap.put("abstract",map.get("abstract"));
+        entryDebitMap.put("abstract",sqr+"/"+map.get("abstract"));
 //        entryDebitMap.put("debit_quantity","0");
 //        entryDebitMap.put("document_date","2021-09-18");
 //        entryDebitMap.put("document_id","123456");
@@ -166,6 +167,7 @@ public class VoucherAdd {
         List<Map<String,Object>> entryDebit = new ArrayList<>();        //voucher > debit > entryDebit
 
         String bm = map.get("申请人所属部门").toString();
+        String sqr = map.get("申请人").toString();
 
         if(map.get("其他报销科目") != null){
             JSONArray jsonArray = JSONArray.fromObject(map.get("其他报销科目").toString());
@@ -183,7 +185,7 @@ public class VoucherAdd {
                         account_code = getCode(bm,bxKm);
                     }
 
-                    String mingC = bxKm;
+                    String mingC = "-";
                     if(object.get("名称") != null){
                         mingC = object.get("名称").toString();
                     }
@@ -203,7 +205,7 @@ public class VoucherAdd {
                             auxiliaryDebit.put("item_id","YFYYYY00001-99");//项目档案
                         }
                         entryDebitMap.put("auxiliary",auxiliaryDebit);
-                        entryDebitMap.put("abstract",mingC+"/税额");
+                        entryDebitMap.put("abstract",sqr+"/其他报销/"+bxKm+"/"+mingC+"/税额");
 //                        entryDebitMap.put("account_code",map.get("account_code"));
                         String seCode = getCodeSE(bxKm);
                         entryDebitMap.put("account_code",seCode);
@@ -236,7 +238,7 @@ public class VoucherAdd {
                         auxiliaryDebit.put("item_id","YFYYYY00001-99");//项目档案
                     }
                     entryDebitMap.put("auxiliary",auxiliaryDebit);
-                    entryDebitMap.put("abstract",mingC);
+                    entryDebitMap.put("abstract",sqr+"/其他报销/"+bxKm+"/"+mingC);
 //                    entryDebitMap.put("account_code",map.get("account_code"));
                     entryDebitMap.put("account_code",account_code);
                     entryDebitMap.put("natural_debit_currency",jinE.multiply(sl));//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
@@ -264,7 +266,7 @@ public class VoucherAdd {
                         account_code = getCode(bm,bxKm);
                     }
 
-                    String mingC = bxKm;
+                    String mingC = "-";
                     if(object.get("名称") != null){
                         mingC = object.get("名称").toString();
                     }
@@ -284,7 +286,7 @@ public class VoucherAdd {
                             auxiliaryDebit.put("item_id","YFYYYY00001-99");//项目档案
                         }
                         entryDebitMap.put("auxiliary",auxiliaryDebit);
-                        entryDebitMap.put("abstract",mingC+"/税额");
+                        entryDebitMap.put("abstract",sqr+"/差旅报销/"+bxKm+"/"+mingC+"/税额");
 //                        entryDebitMap.put("account_code",map.get("account_code"));
                         String seCode = getCodeSE(bxKm);
                         entryDebitMap.put("account_code",seCode);
@@ -308,7 +310,7 @@ public class VoucherAdd {
                                 auxiliaryDebit.put("item_id","YFYYYY00001-99");//项目档案
                             }
                             entryDebitMap.put("auxiliary",auxiliaryDebit);
-                            entryDebitMap.put("abstract",mingC+"/税额");
+                            entryDebitMap.put("abstract",sqr+"/差旅报销/"+bxKm+"/"+mingC+"/税额");
                             String seCode = getCodeSE(bxKm);
                             entryDebitMap.put("account_code",seCode);
                             //当报销科目为火车,飞机时,税率自动计算(税额=未税金额*9%)
@@ -334,7 +336,7 @@ public class VoucherAdd {
                         auxiliaryDebit.put("item_id","YFYYYY00001-99");//项目档案
                     }
                     entryDebitMap.put("auxiliary",auxiliaryDebit);
-                    entryDebitMap.put("abstract",mingC);
+                    entryDebitMap.put("abstract",sqr+"/差旅报销/"+bxKm+"/"+mingC);
 //                    entryDebitMap.put("account_code",map.get("account_code"));
                     entryDebitMap.put("account_code",account_code);
                     entryDebitMap.put("natural_debit_currency",jinE.multiply(sl));//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
@@ -375,7 +377,7 @@ public class VoucherAdd {
                             auxiliaryDebit.put("item_id","YFYYYY00001-99");//项目档案
                         }
                         entryDebitMap.put("auxiliary",auxiliaryDebit);
-                        entryDebitMap.put("abstract",bxKm+"/税额");
+                        entryDebitMap.put("abstract",sqr+"/私车公用/"+bxKm+"/税额");
 //                        entryDebitMap.put("account_code",map.get("account_code"));
                         String seCode = getCodeSE(bxKm);
                         entryDebitMap.put("account_code",seCode);
@@ -399,7 +401,7 @@ public class VoucherAdd {
                         auxiliaryDebit.put("item_id","YFYYYY00001-99");//项目档案
                     }
                     entryDebitMap.put("auxiliary",auxiliaryDebit);
-                    entryDebitMap.put("abstract",bxKm);
+                    entryDebitMap.put("abstract",sqr+"/私车公用/"+bxKm);
 //                    entryDebitMap.put("account_code",map.get("account_code"));
                     entryDebitMap.put("account_code",account_code);
                     entryDebitMap.put("natural_debit_currency",jinE.multiply(sl));//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
@@ -741,10 +743,10 @@ public class VoucherAdd {
     }
 
     public static void main(String[] args) {
-        BigDecimal se = new BigDecimal("0.0");
-        if(se.compareTo(new BigDecimal("0")) == 0){
-            System.out.println(getCode("营销设计中心-销售部","邮寄/物流"));
-        }
+//        BigDecimal se = new BigDecimal("0.0");
+//        if(se.compareTo(new BigDecimal("0")) == 0){
+            System.out.println(getCode("营销设计中心-项目部","油费"));
+//        }
 
     }
 

+ 14 - 3
src/main/java/net/chenlin/dp/modules/TaskDemo.java

@@ -24,11 +24,22 @@ public class TaskDemo {
     private  SaleOrderController controller=new SaleOrderController();
 
     /**
-     * 定时任务 银行回单 同步至 u8凭证
+     * 定时任务 银行回单 同步至 u8凭证(江苏)
      */
     public static void autoReimbursementNew() throws Exception {
         ReimbursementService reimbursementService = new ReimbursementService();
-        reimbursementService.autoReimbursementNew();
+        reimbursementService.autoReimbursementNew("js");
+        System.out.println("==================================");
+        System.out.println("===========银行回单 同步至 u8凭证任务执行 "+ DateUtils.getNowTime()+" ============" );
+        System.out.println("==================================");
+    }
+
+     /**
+     * 定时任务 银行回单 同步至 u8凭证(山东)
+     */
+    public static void autoReimbursementNewSd() throws Exception {
+        ReimbursementService reimbursementService = new ReimbursementService();
+        reimbursementService.autoReimbursementNew("sd");
         System.out.println("==================================");
         System.out.println("===========银行回单 同步至 u8凭证任务执行 "+ DateUtils.getNowTime()+" ============" );
         System.out.println("==================================");
@@ -41,7 +52,7 @@ public class TaskDemo {
         PettyCashService pettyCashService = new PettyCashService();
         pettyCashService.autoOABankPetty();
         System.out.println("==================================");
-        System.out.println("===========备用金定时任务执行 "+ DateUtils.getNowTime()+" ============" );
+        System.out.println("===========备用金定时任务执行 "+ DateUtils.getNowTime()+" ============");
         System.out.println("==================================");
     }
 

+ 13 - 2
src/main/java/net/chenlin/dp/modules/api/controller/DingdingOpenInterface.java

@@ -173,7 +173,7 @@ public class DingdingOpenInterface {
     /**
      * 获取审批实例详
      */
-    public Map<String,Object> getOrderDetails(String processInstanceId){
+    public static Map<String,Object> getOrderDetails(String processInstanceId){
 
         Map<String,Object> map = new HashMap<>();
 
@@ -312,7 +312,7 @@ public class DingdingOpenInterface {
 
     public static void main(String[] args) throws Exception {
 //        getViewByUserId("2006265537678286");
-        getOrderIdList("PROC-C1EBBC4A-AA0D-4101-BEE8-8BFA5FEFABD8");
+        List<String> list = getOrderIdList2("PROC-A561B73E-8282-4780-BB05-DCBA8125C45C",-30);
 //        getOrderIdList("PROC-DD8FF68E-B90E-4885-8C17-F69E53BE5C81");
 //            for (Map.Entry<String, Object> entry : JSONUtils.jsonToMap(rsp.getBody()).entrySet()) {
 //                System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
@@ -323,6 +323,17 @@ public class DingdingOpenInterface {
 //        Date date = nowTime.getTime();
 //        System.out.println(date.getTime());
 //        System.out.println(nowTime.getTime());
+        for(String o:list){
+            Map<String,Object> map = getOrderDetails(o);
+            if(StringUtils.isNullOrEmpty(map.get("result").toString()) || !map.get("result").toString().equals("agree")){
+                System.out.println("sssss");
+            }else{
+                System.out.println(o);
+//                System.out.println(map);
+            }
+        }
+
+
     }
 
     public static Map toMap(String jsonString) throws JSONException {

+ 1 - 1
src/main/java/net/chenlin/dp/modules/api/controller/interfaceTest.java

@@ -68,7 +68,7 @@ public class interfaceTest {
         //根据单据名称获取对应process_code
         DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/process/get_by_name");
         OapiProcessGetByNameRequest req = new OapiProcessGetByNameRequest();
-        req.setName("付款申请单");
+        req.setName("银行回单(山东)");
         OapiProcessGetByNameResponse rsp = client.execute(req, gettoken);
         System.out.println(rsp.getBody());
 

+ 24 - 2
src/main/java/net/chenlin/dp/modules/api/service/PettyCashService.java

@@ -125,10 +125,11 @@ public class PettyCashService {
         Properties prop = PropUtil.getProperties("/config.properties");
         String PROC = prop.getProperty("byj_process_code");
         String YHHD = prop.getProperty("yhhd_process_code");
+        String YHHDSD = prop.getProperty("yhhdsd_process_code");
         String userid = prop.getProperty("userid");
         String agentid = prop.getProperty("agentid");
         String deptid = prop.getProperty("deptid");
-        List<String> list = dingdingOpenInterface.getOrderIdList2(PROC,-7);
+        List<String> list = dingdingOpenInterface.getOrderIdList2(PROC,-20);
         System.out.println("备用金:"+list);
         List<SyViewEntity> listIdError = u8Service.selectViewByError("备用金至银行凭证");
         List<SyViewEntity> listIdTrue = u8Service.selectViewByTrue("备用金至银行凭证");
@@ -162,11 +163,32 @@ public class PettyCashService {
                 }
                 Map<String,Object> map1 = dingdingOpenInterface.tableToMap(map);
 
+                Map<String,Object> mapPerson = dingdingOpenInterface.getViewByUserId(map.get("originator_userid").toString());
+                String work_place = null;
+                if(mapPerson !=null ){
+                    work_place = mapPerson.get("work_place").toString();
+                    if(StringUtils.isNullOrEmpty(work_place)){
+                        continue;
+                    }
+
+                    if (!work_place.equals("昆山") && !work_place.equals("潍坊")){
+                        continue;
+                    }
+                }else{
+                    continue;
+                }
+
                 DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/processinstance/create");
                 OapiProcessinstanceCreateRequest req = new OapiProcessinstanceCreateRequest();
                 req.setAgentId(Long.valueOf(agentid));
 //                req.setProcessCode("PROC-C1EBBC4A-AA0D-4101-BEE8-8BFA5FEFABD8");//银行回单TEST
-                req.setProcessCode(YHHD);//银行回单TEST
+
+                if(work_place.equals("昆山")){
+                    req.setProcessCode(YHHD);//银行回单(江苏)
+                }else{
+                    req.setProcessCode(YHHDSD);//银行回单(山东)
+                }
+
                 req.setOriginatorUserId(userid);
                 req.setDeptId(Long.valueOf(deptid));
 

+ 37 - 12
src/main/java/net/chenlin/dp/modules/api/service/ReimbursementService.java

@@ -192,12 +192,16 @@ public class ReimbursementService {
     /**
      * 同步银行回单至u8凭证
      * @throws Exception
+     * @param st js:江苏,sd:山东
      */
-    public void autoReimbursementNew() throws Exception {
+    public void autoReimbursementNew(String st) throws Exception {
 
         DingdingOpenInterface dingdingOpenInterface = new DingdingOpenInterface();
         Properties prop = PropUtil.getProperties("/config.properties");
         String PROC = prop.getProperty("yhhd_process_code");
+        if(st.equals("sd")){
+            PROC = prop.getProperty("yhhdsd_process_code");
+        }
 //        List<String> list = dingdingOpenInterface.getOrderIdList(PROC);
 //        List<String> list = dingdingOpenInterface.getOrderIdList2("PROC-C1EBBC4A-AA0D-4101-BEE8-8BFA5FEFABD8",-5);
         List<String> list = dingdingOpenInterface.getOrderIdList2(PROC,-31);
@@ -293,7 +297,6 @@ public class ReimbursementService {
                     }catch (Exception e){
                         mess = e.getMessage();
                     }
-//                    System.out.println(mess);
 
                 }else if(map1.get("单据类型").toString().equals("报销申请")){
                     entity.setParType("报销申请至U8");
@@ -307,7 +310,7 @@ public class ReimbursementService {
                     continue ;
                 }
                 entity.setSyMessage(mess);
-
+                u8Service.saveSyView(entity);
             }
 
         }
@@ -328,11 +331,12 @@ public class ReimbursementService {
         DingdingOpenInterface dingdingOpenInterface = new DingdingOpenInterface();
         Properties prop = PropUtil.getProperties("/config.properties");
         String PROC = prop.getProperty("bx_process_code");//报销单
-        String YHHD = prop.getProperty("yhhd_process_code");//银行回单
+        String YHHD = prop.getProperty("yhhd_process_code");//银行回单(江苏)
+        String YHHDSD = prop.getProperty("yhhdsd_process_code");//银行回单(山东)
         String agentid = prop.getProperty("agentid");
         String deptid = prop.getProperty("deptid");
         String userid = prop.getProperty("userid");
-        List<String> list = dingdingOpenInterface.getOrderIdList2(PROC,-7);
+        List<String> list = dingdingOpenInterface.getOrderIdList2(PROC,-20);
 //        List<String> list = dingdingOpenInterface.getOrderIdList("PROC-DD8FF68E-B90E-4885-8C17-F69E53BE5C81");
         System.out.println("报销申请:"+list);
         List<SyViewEntity> listIdError = u8Service.selectViewByError("报销单至银行凭证");
@@ -365,11 +369,33 @@ public class ReimbursementService {
                 }
                 SyViewEntity entity = new SyViewEntity();
                 Map<String,Object> newMap = tableToMap2(map);
+
+                Map<String,Object> mapPerson = dingdingOpenInterface.getViewByUserId(map.get("originator_userid").toString());
+                String work_place = null;
+                if(mapPerson !=null ){
+                    work_place = mapPerson.get("work_place").toString();
+                    if(StringUtils.isNullOrEmpty(work_place)){
+                        continue;
+                    }
+
+                    if (!work_place.equals("昆山") && !work_place.equals("潍坊")){
+                        continue;
+                    }
+                }else{
+                    continue;
+                }
+
                 DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/processinstance/create");
                 OapiProcessinstanceCreateRequest req = new OapiProcessinstanceCreateRequest();
                 req.setAgentId(Long.valueOf(agentid));
 //                req.setProcessCode("PROC-C1EBBC4A-AA0D-4101-BEE8-8BFA5FEFABD8");//银行回单TEST
-                req.setProcessCode(YHHD);//银行回单
+
+                if (work_place.equals("昆山")){
+                    req.setProcessCode(YHHD);//银行回单(江苏)
+                }else{
+                    req.setProcessCode(YHHDSD);//银行回单(山东)
+                }
+
                 req.setOriginatorUserId(userid);
                 req.setDeptId(Long.valueOf(deptid));
 
@@ -683,7 +709,7 @@ public class ReimbursementService {
                 try {
                     u8Service.saveSyView(entity);
                 }catch (Exception e){
-                    System.out.println("异常2");
+                    System.out.println("异常2同步报销单至银行凭证");
                 }
 //                System.out.println("============"+JSON.toJSONString(rsp));
 //                System.out.println("============"+JSON.toJSONString(rsp.getErrmsg()));
@@ -1204,7 +1230,6 @@ public class ReimbursementService {
 //        autoOABankReceipt();
 //        autoReimbursement();
 //        autoReimbursementNew();
-
 //        String aa  = "";
 //        if("12334".contains("1")){
 //            System.out.println("sssssssssss");
@@ -1219,10 +1244,10 @@ public class ReimbursementService {
 //        List<String> list = dingdingOpenInterface.getOrderIdList2(PROC,-2);
 //        List<String> list1 = dingdingOpenInterface.getOrderIdList2(PROC1,-7);
 //        System.out.println(list);
-        System.out.println("========1======");
-        Thread.currentThread().sleep(5000);//延迟5秒
-        Thread.sleep(3000);//与上行代码无区别
-        System.out.println("========2======");
+//        System.out.println("========1======");
+//        Thread.currentThread().sleep(5000);//延迟5秒
+//        Thread.sleep(3000);//与上行代码无区别
+//        System.out.println("========2======");
 //        System.out.println(list1);