EDZ vor 3 Jahren
Ursprung
Commit
d8fe8cae4a

+ 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);

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

@@ -20,7 +20,7 @@ public class TaskDemo {
     /**
      * 定时任务 备用金 同步至 u8凭证
      */
-    public static void autoUpdataPettyJob(){
+    public static void autoUpdataPettyJob() throws Exception {
         PettyCashService pettyCashService = new PettyCashService();
         pettyCashService.autoUpdataPetty();
         System.out.println("==================================");
@@ -31,7 +31,7 @@ public class TaskDemo {
     /**
      * 定时任务 报销申请 同步至 u8凭证
      */
-    public static void autoReimbursementJob(){
+    public static void autoReimbursementJob() throws Exception {
         ReimbursementService reimbursementService = new ReimbursementService();
         reimbursementService.autoReimbursement();
         System.out.println("==================================");

+ 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();
     }
 

+ 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({