소스 검색

测试

Signed-off-by: EDZ <1>
EDZ 3 년 전
부모
커밋
007d50521b
19개의 변경된 파일591개의 추가작업 그리고 105개의 파일을 삭제
  1. 1 1
      src/main/java/net/chenlin/dp/common/openapi4j/examples/person/PersonGet.java
  2. 29 14
      src/main/java/net/chenlin/dp/common/openapi4j/examples/voucher/VoucherAdd.java
  3. 6 1
      src/main/java/net/chenlin/dp/common/openapi4j/service/PersonService.java
  4. 6 2
      src/main/java/net/chenlin/dp/common/openapi4j/service/VoucherService.java
  5. 55 14
      src/main/java/net/chenlin/dp/modules/TaskDemo.java
  6. 36 13
      src/main/java/net/chenlin/dp/modules/api/controller/DingdingOpenInterface.java
  7. 5 5
      src/main/java/net/chenlin/dp/modules/api/controller/interfaceTest.java
  8. 65 18
      src/main/java/net/chenlin/dp/modules/api/service/PettyCashService.java
  9. 184 12
      src/main/java/net/chenlin/dp/modules/api/service/ReimbursementService.java
  10. 11 0
      src/main/java/net/chenlin/dp/modules/sys/controller/U8TestController.java
  11. 33 1
      src/main/java/net/chenlin/dp/modules/sys/dao/TestU8Mapper.java
  12. 8 1
      src/main/java/net/chenlin/dp/modules/sys/mapper/QuartzJobMapper.xml
  13. 38 0
      src/main/java/net/chenlin/dp/modules/sys/mapper/testU8.xml
  14. 56 5
      src/main/java/net/chenlin/dp/modules/sys/service/impl/testU8ServiceImpl.java
  15. 35 6
      src/main/java/net/chenlin/dp/modules/sys/service/testU8Service.java
  16. 9 2
      src/main/webapp/WEB-INF/view/base/quartz/list.html
  17. 2 2
      src/main/webapp/WEB-INF/view/index.html
  18. 2 2
      src/main/webapp/WEB-INF/view/system/dashboard.html
  19. 10 6
      src/main/webapp/static/js/base/quartz/list.js

+ 1 - 1
src/main/java/net/chenlin/dp/common/openapi4j/examples/person/PersonGet.java

@@ -16,7 +16,7 @@ public class PersonGet {
 		String id = args[1];			//	人员编码
 		PersonService ds = new PersonService();
 		try {
-			JSONObject record = ds.get(id, to_account);
+			JSONObject record = ds.get(id, to_account,null);
 			logger.info(record.toString());
 		} catch (OpenAPIException e) {
 			e.printStackTrace();

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

@@ -27,8 +27,9 @@ public class VoucherAdd {
      * 新增凭证
      * @param map 数据
      * @param biz_id  唯一来源id
+     * @param type 数据源 1昆山,3潍坊
      */
-    public static void addVoucher(Map<String,Object> map,String biz_id) {
+    public static void addVoucher(Map<String,Object> map,String biz_id,String type) {
 
         Map<String,Object> jsonBodyMap = new HashMap<>();
         Map<String,Object> voucher = new HashMap<>();//凭证数据详情
@@ -38,27 +39,34 @@ public class VoucherAdd {
 //        voucher.put("accounting_period","1");//所属的会计期间,不填写取当前月份
         voucher.put("date", DateUtils.format(new Date()));//制单日期
 //        voucher.put("enter","DingDing_"+map.get("申请人"));//制单人名称
-        voucher.put("enter","autoDingDing");//制单人名称
+        voucher.put("enter","OA");//制单人名称
 //        voucher.put("cashier",map.get("出纳"));//出纳名称
 
         Map<String,Object> credit = new HashMap<>();                     //voucher > credit
         List<Map<String,Object>> entryCredit = new ArrayList<>();        //voucher > credit > entryCredit
         Map<String,Object> entryCreditMap = new HashMap<>();             //voucher > credit > entryCredit > entryCreditMap
-        List<Map<String,Object>> cash_flowListCredit = new ArrayList<>();//voucher > credit > entryCredit > entryCreditMap > cash_flowListCredit
-        Map<String,Object> cash_flowMapCredit = new HashMap<>();         //voucher > credit > entryCredit > entryCreditMap > cash_flowListCredit > cash_flowMapCredit
-
+//        List<Map<String,Object>> cash_flowListCredit = new ArrayList<>();//voucher > credit > entryCredit > entryCreditMap > cash_flowListCredit
+//        Map<String,Object> cash_flowMapCredit = new HashMap<>();         //voucher > credit > entryCredit > entryCreditMap > cash_flowListCredit > cash_flowMapCredit
+//
 //        cash_flowMapCredit.put("natural_credit_currency","0.00");
 //        cash_flowMapCredit.put("natural_debit_currency","4.00");
+//        cash_flowMapCredit.put("cdept_id","021");
+//        cash_flowMapCredit.put("cperson_id","CHK2019001");
 //        cash_flowListCredit.add(cash_flowMapCredit);
 //        entryCreditMap.put("cash_flow",cash_flowListCredit);
 
-//        entryCreditMap.put("auxiliary",new HashMap<String,Object>());
+        Map<String,Object> auxiliaryCredit = new HashMap<>();
+        auxiliaryCredit.put("dept_id",map.get("dept_code"));
+        auxiliaryCredit.put("personnel_id",map.get("job_number"));
+//        auxiliaryCredit.put("operator","CHK2019001");
+        entryCreditMap.put("auxiliary",auxiliaryCredit);
+
 //        entryCreditMap.put("credit_quantity","0");
 //        entryCreditMap.put("document_date","2021-09-18");
 //        entryCreditMap.put("document_id","321654");
 //        entryCreditMap.put("exchange_rate2","0");
         entryCreditMap.put("abstract",map.get("abstract"));
-        entryCreditMap.put("account_code","1001");
+        entryCreditMap.put("account_code",map.get("account_code"));
 //        entryCreditMap.put("entry_id","0");//
         entryCreditMap.put("natural_credit_currency",map.get("naturalCurrency"));//本币贷方发生额*与本币借方发生额不能同时为空
 //        entryCreditMap.put("primary_credit_amount","0");//
@@ -69,22 +77,29 @@ public class VoucherAdd {
         Map<String,Object> debit = new HashMap<>();                     //voucher > debit
         List<Map<String,Object>> entryDebit = new ArrayList<>();        //voucher > debit > entryDebit
         Map<String,Object> entryDebitMap = new HashMap<>();             //voucher > debit > entryDebit > entryDebitMap
-        List<Map<String,Object>> cash_flowListDebit = new ArrayList<>();//voucher > debit > entryDebit > entryDebitMap > cash_flowListDebit
-        Map<String,Object> cash_flowMapDebit = new HashMap<>();         //voucher > debit > entryDebit > entryDebitMap > cash_flowListDebit > cash_flowMapDebit
-
+//        List<Map<String,Object>> cash_flowListDebit = new ArrayList<>();//voucher > debit > entryDebit > entryDebitMap > cash_flowListDebit
+//        Map<String,Object> cash_flowMapDebit = new HashMap<>();         //voucher > debit > entryDebit > entryDebitMap > cash_flowListDebit > cash_flowMapDebit
+//
 //        cash_flowMapDebit.put("natural_credit_currency","0.00");
 //        cash_flowMapDebit.put("natural_debit_currency","4.00");
+//        cash_flowMapDebit.put("cdept_id","021");
+//        cash_flowMapDebit.put("cperson_id","CHK2019001");
 //        cash_flowListDebit.add(cash_flowMapDebit);
 //        entryDebitMap.put("cash_flow",cash_flowListDebit);
-//
-//        entryDebitMap.put("auxiliary",new HashMap<String,Object>());
+
+        Map<String,Object> auxiliaryDebit = new HashMap<>();
+        auxiliaryDebit.put("dept_id",map.get("dept_code"));
+        auxiliaryDebit.put("personnel_id",map.get("job_number"));
+//        auxiliaryDebit.put("operator","CHK2019001");
+        entryDebitMap.put("auxiliary",auxiliaryDebit);
+
 //        entryDebitMap.put("settlement","8");
         entryDebitMap.put("abstract",map.get("abstract"));
 //        entryDebitMap.put("debit_quantity","0");
 //        entryDebitMap.put("document_date","2021-09-18");
 //        entryDebitMap.put("document_id","123456");
 //        entryDebitMap.put("exchange_rate2","0");
-        entryDebitMap.put("account_code","1001");
+        entryDebitMap.put("account_code",map.get("account_code"));
 //
         entryDebitMap.put("natural_debit_currency",map.get("naturalCurrency"));//本币贷方发生额*与本币借方发生额不能同时为空
 //        entryDebitMap.put("primary_debit_amount","0");//
@@ -101,7 +116,7 @@ public class VoucherAdd {
 
         VoucherService voucherService = new VoucherService();
         try {
-            JSONObject record = voucherService.add(jsonBody, biz_id);
+            JSONObject record = voucherService.add(jsonBody, biz_id,type);
             logger.info(record.toString());
         } catch (OpenAPIException e) {
             e.printStackTrace();

+ 6 - 1
src/main/java/net/chenlin/dp/common/openapi4j/service/PersonService.java

@@ -3,6 +3,7 @@ package net.chenlin.dp.common.openapi4j.service;
 import java.util.HashMap;
 import java.util.Map;
 
+import com.mysql.cj.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,15 +30,19 @@ public class PersonService extends BaseService {
 	 * 获取单个人员信息
 	 * @param id           人员信息id
 	 * @param to_account   目标企业code
+	 * @param ds   			数据源序号(默认取应用的第一个数据源
 	 * @return             人员信息
 	 * @throws OpenAPIException
 	 */
-	public JSONObject get(String id, String to_account) throws OpenAPIException {
+	public JSONObject get(String id, String to_account,String ds) throws OpenAPIException {
 		JSONObject record;
 		try {
 			Map<String, String> paramMap = new HashMap();
 			paramMap.put("to_account", to_account);
 			paramMap.put("id", id);
+			if(!StringUtils.isNullOrEmpty(ds)){
+				paramMap.put("ds_sequence", ds);
+			}
 			String url = this.createURL("person/get", paramMap);
 			logger.debug(url);
 			record = JSONObject.parseObject(HttpUtil.get(url));

+ 6 - 2
src/main/java/net/chenlin/dp/common/openapi4j/service/VoucherService.java

@@ -4,6 +4,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import com.mysql.cj.util.StringUtils;
 import net.chenlin.dp.common.openapi4j.util.PropUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,16 +40,19 @@ public class VoucherService extends BaseService {
         this.access_token = token;
     }
 
-    public JSONObject add(String jsonBody,String biz_id) throws OpenAPIException {
+    public JSONObject add(String jsonBody,String biz_id,String ds) throws OpenAPIException {
         JSONObject record;
         try {
             Properties prop = PropUtil.getProperties("/config.properties");
             String to_account = prop.getProperty("to_account");
-            String tradeId = TradeService.getTradeId();
+//            String tradeId = TradeService.getTradeId();
             Map<String, String> paramMap = new HashMap();
             paramMap.put("to_account", to_account);
 //            paramMap.put("tradeid", tradeId);
             paramMap.put("biz_id", biz_id);
+            if(!StringUtils.isNullOrEmpty(ds)){
+                paramMap.put("ds_sequence", ds);
+            }
             String url = this.createURL("voucher/add", paramMap);
             logger.debug(url);
             String resultStr = HttpUtil.post(url, jsonBody);

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

@@ -2,25 +2,27 @@ package net.chenlin.dp.modules;
 
 import com.taobao.api.ApiException;
 import net.chenlin.dp.common.openapi4j.exception.OpenAPIException;
-import net.chenlin.dp.common.openapi4j.service.SaleOrderService;
 import net.chenlin.dp.common.utils.DateUtils;
-import net.chenlin.dp.modules.api.controller.DingdingOpenInterface;
 import net.chenlin.dp.modules.api.controller.PayrequestController;
 import net.chenlin.dp.modules.api.controller.PurchaseOrderController;
 import net.chenlin.dp.modules.api.controller.SaleOrderController;
 import net.chenlin.dp.modules.api.service.PettyCashService;
 import net.chenlin.dp.modules.api.service.ReimbursementService;
+import net.chenlin.dp.modules.sys.service.testU8Service;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
 
 @Component("TaskDemo")
 public class TaskDemo {
 
+    @Autowired
+    private testU8Service testU8Mapper;
+
     /**
      * 定时任务 备用金 同步至 u8凭证
      */
-    public static void autoUpdataPettyJob(){
+    public static void autoUpdataPettyJob() throws Exception {
         PettyCashService pettyCashService = new PettyCashService();
         pettyCashService.autoUpdataPetty();
         System.out.println("==================================");
@@ -31,7 +33,7 @@ public class TaskDemo {
     /**
      * 定时任务 报销申请 同步至 u8凭证
      */
-    public static void autoReimbursementJob(){
+    public static void autoReimbursementJob() throws Exception {
         ReimbursementService reimbursementService = new ReimbursementService();
         reimbursementService.autoReimbursement();
         System.out.println("==================================");
@@ -44,7 +46,6 @@ public class TaskDemo {
      * 定时任务 销售订单同步至 钉钉
      */
     public static void autoSaleToDingJob() throws OpenAPIException, ApiException {
-        System.out.println("==================================");
         SaleOrderController saleOrderController=new SaleOrderController();
         //saleOrderController.dingSaleOrder();
         System.out.println("===========销售订单同步至钉钉定时任务执行 "+ DateUtils.getNowTime()+" ============" );
@@ -55,7 +56,6 @@ public class TaskDemo {
      * 定时任务 采购订单同步至 钉钉
      */
     public static void autoOrderToDingJob() throws OpenAPIException, ApiException {
-        System.out.println("==================================");
         PurchaseOrderController purchaseOrderController=new PurchaseOrderController();
         //purchaseOrderController.dingPurchaseOrder();
         System.out.println("===========采购订单同步至钉钉定时任务执行 "+ DateUtils.getNowTime()+" ============" );
@@ -66,7 +66,6 @@ public class TaskDemo {
      * 定时任务 付款申请单同步至 钉钉
      */
     public static void autoFkdToDingJob() throws OpenAPIException, ApiException {
-        System.out.println("==================================");
         PayrequestController payrequestController=new PayrequestController();
       //  payrequestController.dingPayrequest();
         System.out.println("===========付款申请单同步至钉钉定时任务执行 "+ DateUtils.getNowTime()+" ============" );
@@ -77,7 +76,6 @@ public class TaskDemo {
      * 定时任务 钉钉销售订单审核回写至U8
      */
     public static void autoSaleToU8Job() throws OpenAPIException {
-        System.out.println("==================================");
         SaleOrderController saleOrderController=new SaleOrderController();
         saleOrderController.saleOrderShenhe();
         System.out.println("===========钉钉销售订单回写至U8定时任务执行 "+ DateUtils.getNowTime()+" ============" );
@@ -87,7 +85,6 @@ public class TaskDemo {
      * 定时任务 钉钉采购订单回写至U8
      */
     public static void autoOrderToU8Job() throws OpenAPIException {
-        System.out.println("==================================");
         PurchaseOrderController purchaseOrderController=new PurchaseOrderController();
         purchaseOrderController.purchaseOrderShenhe();
         System.out.println("===========钉钉采购订单回写至U8定时任务执行 "+ DateUtils.getNowTime()+" ============" );
@@ -97,20 +94,64 @@ public class TaskDemo {
      * 定时任务 钉钉付款申请单回写至U8
      */
     public static void autoFkdToU8Job() throws OpenAPIException {
-        System.out.println("==================================");
         PayrequestController payrequestController=new PayrequestController();
         payrequestController.PayrequestOrderShenhe();
         System.out.println("===========钉钉付款申请单回写至U8定时任务执行 "+ DateUtils.getNowTime()+" ============" );
         System.out.println("==================================");
     }
 
+   /**
+     * 定时任务 crm调用存储过程 同步存货档案
+     */
+    public void autoCallProductIn(String upTime) throws OpenAPIException {
+        testU8Mapper.callProductIn(upTime);
+        System.out.println("===========crm调用存储过程 同步存货档案 "+ DateUtils.getNowTime()+" ============" );
+        System.out.println("==================================参数"+upTime);
+    }
 
+   /**
+     * 定时任务 crm调用存储过程 同步项目大类
+     */
+    public void autoCallProMaxClassIn() throws OpenAPIException {
+        testU8Mapper.callProMaxClassIn();
+        System.out.println("===========crm调用存储过程 同步项目大类 "+ DateUtils.getNowTime()+" ============" );
+        System.out.println("==================================");
+    }
 
+   /**
+     * 定时任务 crm调用存储过程 同步项目档案
+     */
+    public void autoCallProMinClassIn() throws OpenAPIException {
+        testU8Mapper.callProMinClassIn();
+        System.out.println("===========crm调用存储过程 同步项目档案 "+ DateUtils.getNowTime()+" ============" );
+        System.out.println("==================================");
+    }
 
-    public static void main(String[] args) throws OpenAPIException {
-        SaleOrderService saleOrderService = new SaleOrderService();
-        saleOrderService.shenghe("","");
+   /**
+     * 定时任务 crm调用存储过程 同步 现存量
+     */
+    public void autoCallCurrentStock() throws OpenAPIException {
+        testU8Mapper.callCurrentStockJiangSu();     //001 金米龙(江苏)科技材料有限公司
+        testU8Mapper.callCurrentStockShanDong();    //003 金米龙(山东)新型建筑材料有限公司
+        System.out.println("===========crm调用存储过程 同步项目档案 "+ DateUtils.getNowTime()+" ============" );
+        System.out.println("==================================");
+    }
 
+   /**
+     * 定时任务 crm调用存储过程 销售订单回写
+     */
+    public void autoCallSaleBack() throws OpenAPIException {
+        testU8Mapper.callSaleBack();
+        System.out.println("===========crm调用存储过程 销售订单回写 "+ DateUtils.getNowTime()+" ============" );
+        System.out.println("==================================");
+    }
+
+
+
+    public static void main(String[] args) throws OpenAPIException {
+//        SaleOrderService saleOrderService = new SaleOrderService();
+//        saleOrderService.shenghe("","");
+//        autoCallProductIn("");
        /* DingdingOpenInterface dingdingOpenInterface = new DingdingOpenInterface();
         dingdingOpenInterface.getToken();
 

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

@@ -103,7 +103,7 @@ public class DingdingOpenInterface {
                     list.addAll((List<String>) mapList.get("list"));
                 }
             }
-            System.out.println(list);
+//            System.out.println(list);
         } catch (ApiException e) {
             e.printStackTrace();
         } catch (Exception e) {
@@ -159,6 +159,23 @@ public class DingdingOpenInterface {
         return newMap;
     }
 
+   /**
+     * 接口表格数据转换成可使用的map数据
+     * @param map1
+     * @return
+     */
+    public static Map<String,Object> tableToMap2(Map<String,Object> map1){
+
+        List<Map<String,Object>> listMap = (List<Map<String, Object>>) map1.get("form_component_values");
+        Map<String,Object> newMap = new HashMap<>();
+        for(Map<String, Object> o:listMap){
+            System.out.println("====================");
+            System.out.println(o);
+//            newMap.put((String) o.get("name"),o.get("value"));
+        }
+        return newMap;
+    }
+
 
     /**
      * 获取员工id列表
@@ -199,34 +216,40 @@ public class DingdingOpenInterface {
      * 通过用户id查询详情
      * @throws ApiException
      */
-    public static void getViewByUserId(String userId) throws Exception {
+    public static Map<String,Object> getViewByUserId(String userId) throws Exception {
         getToken();//获取token
         DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
         OapiV2UserGetRequest req = new OapiV2UserGetRequest();
-        req.setUserid("2965176200854153");
+//        req.setUserid("2965176200854153");
+        req.setUserid(userId);
         req.setLanguage("zh_CN");
         OapiV2UserGetResponse rsp = client.execute(req, gettoken);
         Map<String,Object> map;
         map = JSONUtils.jsonToMap(rsp.getBody());
+        System.out.println(map);
         if(map.get("errcode").equals(0)){
             Map<String,Object> mapList = (Map<String, Object>) map.get("result");
-            System.out.println(mapList);
-            System.out.println(mapList.get("dept_id_list"));//所属部门ID列表。
-            System.out.println(mapList.get("email"));
-            System.out.println(mapList.get("extension"));
-            System.out.println(mapList.get("job_number"));
-            System.out.println(mapList.get("mobile"));
-            System.out.println(mapList.get("name"));
-            System.out.println(mapList.get("title"));
-            System.out.println(mapList.get("work_place"));
+//            System.out.println(mapList);
+//            System.out.println(mapList.get("dept_id_list"));//所属部门ID列表。
+//            System.out.println(mapList.get("email"));
+//            System.out.println(mapList.get("extension"));
+//            System.out.println(mapList.get("job_number"));
+//            System.out.println(mapList.get("mobile"));
+//            System.out.println(mapList.get("name"));
+//            System.out.println(mapList.get("title"));
+//            System.out.println(mapList.get("work_place"));
+
+            return mapList;
         }
 
+        return null;
+
     }
 
 
 
     public static void main(String[] args) throws Exception {
-        getViewByUserId("");
+        getViewByUserId("2006265537678286");
 //        getOrderIdList("PROC-A561B73E-8282-4780-BB05-DCBA8125C45C");
 //            for (Map.Entry<String, Object> entry : JSONUtils.jsonToMap(rsp.getBody()).entrySet()) {
 //                System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());

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

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

+ 65 - 18
src/main/java/net/chenlin/dp/modules/api/service/PettyCashService.java

@@ -1,7 +1,10 @@
 package net.chenlin.dp.modules.api.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.mysql.cj.util.StringUtils;
 import net.chenlin.dp.common.openapi4j.examples.voucher.VoucherAdd;
+import net.chenlin.dp.common.openapi4j.exception.OpenAPIException;
+import net.chenlin.dp.common.openapi4j.service.PersonService;
 import net.chenlin.dp.common.openapi4j.util.PropUtil;
 import net.chenlin.dp.common.utils.JSONUtils;
 import net.chenlin.dp.modules.api.controller.DingdingOpenInterface;
@@ -17,40 +20,56 @@ import java.util.Properties;
  */
 public class PettyCashService {
 
-    public static void autoUpdataPetty(){
+    public static void autoUpdataPetty() throws Exception {
 
         DingdingOpenInterface dingdingOpenInterface = new DingdingOpenInterface();
         Properties prop = PropUtil.getProperties("/config.properties");
         String PROC = prop.getProperty("byj_process_code");
         List<String> list = dingdingOpenInterface.getOrderIdList(PROC);
-
+//
         if(list.size() > 0){
             for(String o:list){
 
+                String job_number = "";//工号
+                String work_place = "";//办公地(潍坊对03账套 昆山对01账套)
+                String dept_code = ""; //部门编码
+                String type = ""; //数据源账套 1昆山,3潍坊
                 Map<String,Object> map = dingdingOpenInterface.getOrderDetails(o);
+//                Map<String,Object> map = dingdingOpenInterface.getOrderDetails("0861edce-4cfb-4b1d-ac3a-19ed29ae5214");
                 if(StringUtils.isNullOrEmpty(map.get("result").toString()) || !map.get("result").toString().equals("agree")){
                     continue;
                 }
-
+//                System.out.println(map.get("originator_dept_name"));CHK2019001
                 Map<String,Object> map1 = dingdingOpenInterface.tableToMap(map);
-
-//                System.out.println(map.get("business_id"));
-//                System.out.println(map);
-//                System.out.println(map1.get("申请事由"));
-//                System.out.println(map1.get("申请金额(元)"));
-//                System.out.println(map1.get("备注"));
-//                System.out.println(map1.get("申请日期"));
-//                System.out.println(map1.get("收款账户"));
-//                System.out.println(map1.get("收款账号"));
-//                System.out.println(map1.get("[\"使用日期\",\"归还日期\"]"));
+                Map<String,Object> mapPerson = dingdingOpenInterface.getViewByUserId(map.get("originator_userid").toString());
+//                Map<String,Object> mapPerson = dingdingOpenInterface.getViewByUserId("2006265537678286");
+                if(mapPerson !=null ){
+                    job_number = mapPerson.get("job_number").toString();
+                    work_place = mapPerson.get("work_place").toString();
+                    if(StringUtils.isNullOrEmpty(work_place)){
+                       continue;
+                    }
+                    if (work_place.equals("昆山")){
+                        dept_code = getPerson(job_number,"1");
+                        type = "1";
+                    }else if(work_place.equals("潍坊")){
+                        dept_code = getPerson(job_number,"3");
+                        type = "3";
+                    }else{
+                        continue;
+                    }
+
+                }else{
+                    continue;
+                }
 
                 map1.put("abstract",map1.get("申请事由"));
                 map1.put("naturalCurrency",map1.get("申请金额(元)"));
-//                map1.put("naturalCurrency",map1.get("申请金额(元)"));
+                map1.put("account_code","122102");//科目编码
+                map1.put("dept_code",dept_code);//部门编码
+                map1.put("job_number",job_number);//人员编码
+                VoucherAdd.addVoucher(map1,map.get("business_id").toString(),type);
 //                System.out.println(map1);
-//                System.out.println(map.get("business_id").toString());
-                VoucherAdd.addVoucher(map1,map.get("business_id").toString());
-
             }
 
         }
@@ -59,8 +78,36 @@ public class PettyCashService {
     }
 
 
-    public static void main(String[] args) {
+    /**
+     * 根据人员编码查询u8人员信息
+     * @param id
+     * @param ds
+     */
+    public static String getPerson(String id,String ds){
+        Properties prop = PropUtil.getProperties("/config.properties");
+        String to_account = prop.getProperty("to_account");
+        PersonService par = new PersonService();
+        String code = "";
+        try {
+            JSONObject record = par.get(id, to_account,ds);
+
+            if(record.get("errcode").equals("0")){
+                JSONObject record1 = (JSONObject) record.get("person");
+                code = record1.get("cdept_num").toString();
+            }
+            System.out.println(record);
+
+        } catch (OpenAPIException e) {
+            return code;
+        }
+
+        return code;
+    }
+
+
+    public static void main(String[] args) throws Exception {
         autoUpdataPetty();
+//        getPerson("CHK2021001",null);
     }
 
 

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

@@ -1,50 +1,222 @@
 package net.chenlin.dp.modules.api.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.mysql.cj.util.StringUtils;
 import net.chenlin.dp.common.openapi4j.examples.voucher.VoucherAdd;
+import net.chenlin.dp.common.openapi4j.exception.OpenAPIException;
+import net.chenlin.dp.common.openapi4j.service.PersonService;
 import net.chenlin.dp.common.openapi4j.util.PropUtil;
 import net.chenlin.dp.modules.api.controller.DingdingOpenInterface;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
 
 public class ReimbursementService {
 
-    public static void autoReimbursement(){
+    public static void autoReimbursement() throws Exception {
 
         DingdingOpenInterface dingdingOpenInterface = new DingdingOpenInterface();
         Properties prop = PropUtil.getProperties("/config.properties");
         String PROC = prop.getProperty("bx_process_code");
         List<String> list = dingdingOpenInterface.getOrderIdList(PROC);
+        String job_number = "";//工号
+        String work_place = "";//办公地(潍坊对03账套 昆山对01账套)
+        String dept_code = ""; //部门编码
+        String account_code = ""; //科目编码
+        String type = ""; //数据源账套 1昆山,3潍坊
 
         if(list.size() > 0){
             for(String o:list){
 
+//                Map<String,Object> map = dingdingOpenInterface.getOrderDetails("8ee5b37b-8702-4068-874f-eb74c5e78863");
                 Map<String,Object> map = dingdingOpenInterface.getOrderDetails(o);
                 if(StringUtils.isNullOrEmpty(map.get("result").toString()) || !map.get("result").toString().equals("agree")){
                     continue;
                 }
+                Map<String,Object> map1 = tableToMap2(map);
+                Map<String,Object> mapPerson = dingdingOpenInterface.getViewByUserId(map.get("originator_userid").toString());
+
+                if(mapPerson !=null ){
+                    job_number = mapPerson.get("job_number").toString();
+                    work_place = mapPerson.get("work_place").toString();
+                    if(StringUtils.isNullOrEmpty(work_place)){
+                        continue;
+                    }
+
+                    if (work_place.equals("昆山")){
+                        dept_code = getPerson(job_number,"1");
+                        type = "1";
+//                        System.out.println(dept_code);
+                    }else if(work_place.equals("潍坊")){
+                        dept_code = getPerson(job_number,"3");
+                        type = "3";
+                    }else{
+                        continue;
+                    }
+                }else{
+                    continue;
+                }
+
+                if(map.get("originator_dept_name") == null){
+                    continue;
+                }
+
+                if(map1.containsKey("差旅报销")){
+                    account_code = getDeptCode(map.get("originator_dept_name").toString(),"差旅报销");
+                    map1.put("abstract","差旅报销");
+                    map1.put("naturalCurrency",map1.get("差旅报销"));
+                    map1.put("account_code",account_code);//科目编码
+                    map1.put("dept_code",dept_code);//部门编码
+                    map1.put("job_number",job_number);//人员编码
+//                    System.out.println("============================");
+//                    System.out.println(map1);
+                    VoucherAdd.addVoucher(map1,map.get("business_id").toString()+"差旅",type);
+                }
+                if(map1.containsKey("私车公用报销")){
+                    account_code = getDeptCode(map.get("originator_dept_name").toString(),"私车公用报销");
+                    map1.put("abstract","私车公用报销");
+                    map1.put("naturalCurrency",map1.get("私车公用报销"));
+                    map1.put("account_code",account_code);//科目编码
+                    map1.put("dept_code",dept_code);//部门编码
+                    map1.put("job_number",job_number);//人员编码
+//                    System.out.println("============================");
+//                    System.out.println(map1);
+                    VoucherAdd.addVoucher(map1,map.get("business_id").toString()+"私车公用",type);
+                }
+                if(map1.containsKey("其他报销科目")){
+                    account_code = getDeptCode(map.get("originator_dept_name").toString(),"其他报销科目");
+                    map1.put("abstract","其他报销科目");
+                    map1.put("naturalCurrency",map1.get("其他报销科目"));
+                    map1.put("account_code",account_code);//科目编码
+                    map1.put("dept_code",dept_code);//部门编码
+                    map1.put("job_number",job_number);//人员编码
+//                    System.out.println("============================");
+//                    System.out.println(map1);
+                    VoucherAdd.addVoucher(map1,map.get("business_id").toString()+"其他",type);
+                }
 
-                Map<String,Object> map1 = dingdingOpenInterface.tableToMap(map);
+            }
+
+        }
+
+    }
 
-//                System.out.println(map.get("business_id"));
-//                System.out.println("============================");
-//                System.out.println(map1.get("总计金额"));
-                map1.put("abstract","报销");
-                map1.put("naturalCurrency",map1.get("总计金额"));
+    public static Map<String,Object> tableToMap2(Map<String,Object> map1){
 
-                VoucherAdd.addVoucher(map1,map.get("business_id").toString());
+        List<Map<String,Object>> listMap = (List<Map<String, Object>>) map1.get("form_component_values");
+        Map<String,Object> newMap = new HashMap<>();
+        int st = 0;
+        for(Map<String, Object> o:listMap){
+            if(o.get("name")==null || StringUtils.isNullOrEmpty(o.get("name").toString())){
+                continue;
+            }
+            if(o.get("name").equals("差旅报销")){
+                st = 1;
+            }
+            if(o.get("name").equals("私车公用报销")){
+                st = 2;
+            }
+            if(o.get("name").equals("其他报销科目")){
+                st = 3;
+            }
 
+            if(st == 1 && o.get("name").equals("合计")){
+                if(newMap.containsKey("差旅报销")){
+                    newMap.put("差旅报销",Double.valueOf(o.get("value").toString())+Double.valueOf(newMap.get("差旅报销").toString()) );
+                }else {
+                    newMap.put("差旅报销",o.get("value"));
+                }
+            }
+            if(st == 2 && o.get("name").equals("合计")){
+                if(newMap.containsKey("私车公用报销")){
+                    newMap.put("私车公用报销",Double.valueOf(o.get("value").toString())+Double.valueOf(newMap.get("私车公用报销").toString()) );
+                }else {
+                    newMap.put("私车公用报销",o.get("value"));
+                }
+            }
+            if(st == 3 && o.get("name").equals("合计")){
+                if(newMap.containsKey("其他报销科目")){
+                    newMap.put("其他报销科目",Double.valueOf(o.get("value").toString())+Double.valueOf(newMap.get("其他报销科目").toString()) );
+                }else {
+                    newMap.put("其他报销科目",o.get("value"));
+                }
             }
 
         }
+        return newMap;
+    }
+
+    /**
+     * 通过部门名称对应u8科目编码
+     * @param dept
+     * @return
+     */
+    public static String getDeptCode(String dept,String type){
+
+        if(dept.equals("营销设计中心-总经理室") || dept.equals("营销设计中心-采购部") || dept.equals("共享中心-财务部") || dept.equals("共享中心-人事行政部")){
+            if("差旅报销".equals(type)){
+                return "66020704";
+            }else if("私车公用报销".equals(type)){
+                return "66020702";
+            }else{
+                return "66020706";
+            }
+        }else if(dept.equals("营销设计中心-销售部")){
+            if("差旅报销".equals(type)){
+                return "6601070104";
+            }else if("私车公用报销".equals(type)){
+                return "6601070102";
+            }else{
+                return "6601070106";
+            }
+        }else if(dept.equals("营销设计中心-设计部")){
+            if("差旅报销".equals(type)){
+                return "66040704";
+            }else if("私车公用报销".equals(type)){
+                return "66040702";
+            }else{
+                return "66040706";
+            }
+        }else if(dept.equals("营销设计中心-项目部") || dept.equals("营销设计中心-市场部")){
+            if("差旅报销".equals(type)){
+                return "6601070204";
+            }else if("私车公用报销".equals(type)){
+                return "6601070202";
+            }else{
+                return "6601070206";
+            }
+        }
+
+        return null;
+    }
 
+    /**
+     * 根据人员编码查询u8人员信息
+     * @param id
+     * @param ds
+     */
+    public static String getPerson(String id,String ds){
+        Properties prop = PropUtil.getProperties("/config.properties");
+        String to_account = prop.getProperty("to_account");
+        PersonService par = new PersonService();
+        String code = "";
+        try {
+            JSONObject record = par.get(id, to_account,ds);
+
+            if(record.get("errcode").equals("0")){
+                JSONObject record1 = (JSONObject) record.get("person");
+                code = record1.get("cdept_num").toString();
+            }
+            System.out.println(record);
+
+        } catch (OpenAPIException e) {
+            return code;
+        }
 
+        return code;
     }
 
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         autoReimbursement();
     }
 

+ 11 - 0
src/main/java/net/chenlin/dp/modules/sys/controller/U8TestController.java

@@ -2,15 +2,26 @@ package net.chenlin.dp.modules.sys.controller;
 
 import net.chenlin.dp.modules.sys.service.testU8Service;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.sql.*;
 
+@RestController
 public class U8TestController {
 
 
     @Autowired
     private testU8Service testU8Mapper;
 
+    /**
+     * crm调用存储过程 同步存货档案
+     * @param upTime
+     * @return
+     */
+    public void autoCallProductIn(String upTime){
+        testU8Mapper.callProductIn(upTime);
+    }
+
     public static void main(String[] args) {
 
         String connectionUrl =

+ 33 - 1
src/main/java/net/chenlin/dp/modules/sys/dao/TestU8Mapper.java

@@ -14,5 +14,37 @@ import org.springframework.context.annotation.Bean;
 public interface TestU8Mapper extends BaseMapper<QuartzJobLogEntity> {
 
 	int testAll();
-	
+
+	/**
+	 * crm调用存储过程 同步存货档案
+	 * @param upTime
+	 * @return
+	 */
+	void callProductIn(String upTime);
+
+	/**
+	 * crm调用存储过程 同步项目大类
+	 */
+	void callProMaxClassIn();
+
+	/**
+	 * crm调用存储过程 同步项目档案
+	 */
+	void callProMinClassIn();
+
+	/**
+	 * crm调用存储过程 同步 现存量 001 金米龙(江苏)科技材料有限公司
+	 */
+	void callCurrentStockJiangSu();
+
+	/**
+	 * crm调用存储过程 同步 现存量 003 金米龙(山东)新型建筑材料有限公司
+	 */
+	void callCurrentStockShanDong();
+
+	/**
+	 * crm调用存储过程 销售订单回写
+	 */
+	void callSaleBack();
+
 }

+ 8 - 1
src/main/java/net/chenlin/dp/modules/sys/mapper/QuartzJobMapper.xml

@@ -17,7 +17,14 @@
 			quartz_job
 		<where>
 			<if test="name != null and name.trim() != ''">
-				AND bean_name LIKE concat('%',#{name},'%')
+				AND
+				(bean_name LIKE concat('%',#{name},'%') or
+				remark LIKE concat('%',#{name},'%') or
+				method_name LIKE concat('%',#{name},'%'))
+
+			</if>
+			<if test="selectPar != null and selectPar.trim() != ''">
+				AND remark LIKE concat('%',#{selectPar},'%')
 			</if>
 		</where>
 		ORDER BY

+ 38 - 0
src/main/java/net/chenlin/dp/modules/sys/mapper/testU8.xml

@@ -10,4 +10,42 @@
 			AA_Bank
 	</select>
 
+	<select id="callProductIn" parameterType="map" statementType="CALLABLE">
+		{
+			call product_In(
+				#{upTime, mode=IN, jdbcType=VARCHAR}
+			)
+		}
+	</select>
+
+	<select id="callProMaxClassIn" parameterType="map" statementType="CALLABLE">
+		{
+			call ProMaxClass_In
+		}
+	</select>
+
+	<select id="callProMinClassIn" parameterType="map" statementType="CALLABLE">
+		{
+			call ProMinClass_In
+		}
+	</select>
+
+	<select id="callCurrentStockJiangSu" parameterType="map" statementType="CALLABLE">
+		{
+			call CurrentStock_jiangSu
+			}
+	</select>
+
+	<select id="callCurrentStockShanDong" parameterType="map" statementType="CALLABLE">
+		{
+			call CurrentStock_shanDong
+			}
+	</select>
+
+	<select id="callSaleBack" parameterType="map" statementType="CALLABLE">
+		{
+			call sale_Back
+			}
+	</select>
+
 </mapper>

+ 56 - 5
src/main/java/net/chenlin/dp/modules/sys/service/impl/testU8ServiceImpl.java

@@ -1,14 +1,9 @@
 package net.chenlin.dp.modules.sys.service.impl;
 
-import net.chenlin.dp.common.annotation.DataSource;
 import net.chenlin.dp.common.support.orm.db.DynamicDataSource;
-import net.chenlin.dp.modules.sys.dao.QuartzJobLogMapper;
 import net.chenlin.dp.modules.sys.dao.TestU8Mapper;
 import net.chenlin.dp.modules.sys.service.testU8Service;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Service;
 
 
@@ -27,4 +22,60 @@ public class testU8ServiceImpl implements testU8Service {
 		return testU8Mapper.testAll();
 	}
 
+	/**
+	 * crm调用存储过程 同步存货档案
+	 * @param upTime
+	 * @return
+	 */
+	@Override
+	public void callProductIn(String upTime) {
+		DynamicDataSource.setDataSource("last-data-source");
+		testU8Mapper.callProductIn(upTime);
+	}
+
+	/**
+	 * crm调用存储过程 同步项目大类
+	 */
+	@Override
+	public void callProMaxClassIn() {
+		DynamicDataSource.setDataSource("last-data-source");
+		testU8Mapper.callProMaxClassIn();
+	}
+
+	/**
+	 * crm调用存储过程 同步项目档案
+	 */
+	@Override
+	public void callProMinClassIn() {
+		DynamicDataSource.setDataSource("last-data-source");
+		testU8Mapper.callProMinClassIn();
+	}
+
+	/**
+	 * crm调用存储过程 同步 现存量 001 金米龙(江苏)科技材料有限公司
+	 */
+	@Override
+	public void callCurrentStockJiangSu() {
+		DynamicDataSource.setDataSource("last-data-source");
+		testU8Mapper.callCurrentStockJiangSu();
+	}
+
+	/**
+	 * crm调用存储过程 同步 现存量 003 金米龙(山东)新型建筑材料有限公司
+	 */
+	@Override
+	public void callCurrentStockShanDong() {
+		DynamicDataSource.setDataSource("last-data-source");
+		testU8Mapper.callCurrentStockShanDong();
+	}
+
+	/**
+	 * crm调用存储过程 销售订单回写
+	 */
+	@Override
+	public void callSaleBack() {
+		DynamicDataSource.setDataSource("last-data-source");
+		testU8Mapper.callSaleBack();
+	}
+
 }

+ 35 - 6
src/main/java/net/chenlin/dp/modules/sys/service/testU8Service.java

@@ -1,11 +1,6 @@
 package net.chenlin.dp.modules.sys.service;
 
-import net.chenlin.dp.common.entity.Page;
-import net.chenlin.dp.common.entity.R;
-import net.chenlin.dp.modules.sys.entity.QuartzJobLogEntity;
-import org.springframework.beans.factory.annotation.Qualifier;
-
-import java.util.Map;
+import net.chenlin.dp.common.support.orm.db.DynamicDataSource;
 
 /**
  * 定时任务日志
@@ -13,4 +8,38 @@ import java.util.Map;
  */
 public interface testU8Service {
 	int testAll();
+
+	/**
+	 * crm调用存储过程 同步存货档案
+	 * @param upTime
+	 * @return
+	 */
+	void callProductIn(String upTime);
+
+	/**
+	 * crm调用存储过程 同步项目大类
+	 */
+	void callProMaxClassIn();
+
+	/**
+	 * crm调用存储过程 同步项目档案
+	 */
+	void callProMinClassIn();
+
+	/**
+	 * crm调用存储过程 同步 现存量 001 金米龙(江苏)科技材料有限公司
+	 */
+	void callCurrentStockJiangSu();
+
+	/**
+	 * crm调用存储过程 同步 现存量 003 金米龙(山东)新型建筑材料有限公司
+	 */
+	void callCurrentStockShanDong();
+
+	/**
+	 * crm调用存储过程 销售订单回写
+	 */
+	void callSaleBack();
+
+
 }

+ 9 - 2
src/main/webapp/WEB-INF/view/base/quartz/list.html

@@ -1,14 +1,21 @@
 @layout("../../system/layout.html", {title: "定时任务"}){
 <div class="row">
-	<div class="col-md-4 form-inline pull-left">
+	<div class="col-md-6 form-inline pull-left">
 		<div class="form-group">
 			<input v-model="keyword" \@keyup.enter="load" class="form-control" placeholder="请输入查询关键字" style="width: 220px;" />
 		</div>
+		<div class="form-group">
+			<select id="selectPar" \@keyup.enter="load" class="form-control" >
+				<option value="">全部</option>
+				<option value="OA">OA</option>
+				<option value="CRM">CRM</option>
+			</select>
+		</div>
 		<div class="form-group">
 			<a class="btn btn-primary" \@click="load"><i class="fa fa-search"></i>&nbsp;查询</a>
 		</div>
 	</div>
-	<div class="col-md-8">
+	<div class="col-md-6">
 		<div class="btn-toolbar pull-right">
 			<div class="btn-group">
 				<a v-if="hasPermission('quartz:job:list')" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>

+ 2 - 2
src/main/webapp/WEB-INF/view/index.html

@@ -29,10 +29,10 @@
 					<ul class="nav navbar-nav">
 						<li><a href="${ctxPath}"><i
 								class="fa fa-home"></i> &nbsp;首页</a></li>
-						<li><a href="http://dp-dev.mydoc.io/" target="_blank"><i
+						<!--<li><a href="http://dp-dev.mydoc.io/" target="_blank"><i
 								class="fa fa-paper-plane"></i> &nbsp;项目文档</a></li>
 						<li><a href="http://www.chenlintech.com/" target="_blank"><i
-								class="fa fa-info-circle"></i> &nbsp;关于作者</a></li>
+								class="fa fa-info-circle"></i> &nbsp;关于作者</a></li>-->
 						<li><a href="javascript:;" \@click="updatePassword"><i
 								class="fa fa-lock"></i> &nbsp;修改密码</a></li>
 						<li><a href="javascript:;" \@click="logout"><i

+ 2 - 2
src/main/webapp/WEB-INF/view/system/dashboard.html

@@ -1,7 +1,7 @@
 @layout("layout.html", {title: "欢迎页"}){
 <div class="panel panel-default">
     <div class="panel-heading">基本信息</div>
-    <div>
+    <!--<div>
         <h3>&nbsp;&nbsp;&nbsp;项目介绍</h3>
         <ul>
             <li>一个轻量级的Java快速开发平台(框架),能快速开发项目并交付</li>
@@ -37,7 +37,7 @@
             <li><a href="/base/component/editor.html" target="_blank">editor(富文本编辑器)</a></li>
         </ul>
 
-    </div>
+    </div>-->
 </div>
 <script type="text/javascript">
     var vm = new Vue({

+ 10 - 6
src/main/webapp/static/js/base/quartz/list.js

@@ -21,14 +21,18 @@ function getGrid() {
 		height : $(window).height() - 56,
 		queryParams : function(params) {
 			params.name = vm.keyword;
+			params.selectPar = $("#selectPar").val();
 			return params;
 		},
 		columns : [ {
 			checkbox : true
 		}, {
 			field : "jobId",
-			title : "编号",
-			width : "50px"
+			title : "行号",
+			width : "50px",
+            formatter : function(value, row, index) {
+                return index+1;
+            }
 		}, {
 			field : "beanName",
 			title : "类名",
@@ -40,7 +44,7 @@ function getGrid() {
 		}, {
 			field : "params",
 			title : "参数",
-			width : "50px"
+			width : "100px"
 		}, {
 			field : "cronExpression",
 			title : "表达式",
@@ -65,11 +69,11 @@ function getGrid() {
                     }
                 }
 			}
-		}, {
+		}/*, {
 			field : "gmtCreate",
 			title : "创建时间",
-			width : "200px"
-		}, {
+			width : "150px"
+		}*/, {
 			field : "remark",
 			title : "备注"
 		}, {