From 5b6bd2b10c8c87b658b888f4d0384aec3ed491ce Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 26 八月 2025 12:21:29 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java |  221 ++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 129 insertions(+), 92 deletions(-)

diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java
index 6ff7672..0cc543f 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java
@@ -1,18 +1,21 @@
 package com.ruoyi.project.service.impl;
 
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.constant.HttpStatus;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.utils.HttpClientKit;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.bean.DtoConversionUtils;
 import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.project.domain.*;
@@ -22,23 +25,22 @@
 import com.ruoyi.project.domain.vo.SpFinancialExpensesReimbursementOut;
 import com.ruoyi.project.mapper.*;
 import com.ruoyi.project.service.*;
-import com.ruoyi.system.domain.SysUserRole;
 import com.ruoyi.system.mapper.SysUserRoleMapper;
 import com.ruoyi.system.service.ISysPostService;
 import com.ruoyi.system.service.ISysUserService;
-import com.sun.org.apache.bcel.internal.generic.NEW;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
-import com.ruoyi.common.utils.StringUtils;
 import org.springframework.transaction.annotation.Transactional;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * 鎶ラ攢鐢宠Service涓氬姟灞傚鐞�
@@ -550,28 +552,54 @@
 
         data.put("data", data2);
         //妯℃澘缂栧彿锛岀敱鑷磋繙鏂规彁渚涳紝璇ュ弬鏁板喅瀹氬彂璧峰崗鍚岀郴缁熶腑鍝釜娴佺▼
-        data.put("templateCode", "001");
+        data.put("templateCode", "cyfbxd_rzhc_ceshi");
         //鏄惁涓哄緟鍙戯細0:鏂板缓-鍙戦�侊紱1:鏂板缓-淇濆瓨寰呭彂
         data.put("draft", "0");
         //鍗忓悓鏍囬鍖洪檮浠讹紝Long鍨婰ist锛屽�间负闄勪欢鐨処d銆侷d鏄檮浠舵帴鍙e搷搴旂粨鏋滀腑fileUrl瀛楁鐨勫��
-        data.put("attachments", null);
-        //鍗忓悓鍏枃鐨刬d
-        data.put("relateDoc", "col|123,456;doc|321,654");
+//        data.put("attachments", null);
+//        //鍗忓悓鍏枃鐨刬d
+//        data.put("relateDoc", "col|123,456;doc|321,654");
         //鏈缃彇妯℃澘璁剧疆鐨勬爣棰�
-        data.put("subject", "null");
+        data.put("subject", "");
+        ServiceReimbursement serviceReimbursement1 = serviceReimbursementMapper.selectById(serviceReimbursement.getId());
+        data.put("summaryId", serviceReimbursement1.getSummaryId() == null ? "" : serviceReimbursement1.getSummaryId());
 
         map.put("data", data);
         String strRes = null;
         if (!active.equals("druid")) {
             //濡傛灉鏄湰鍦扮幆澧冿紝灏变笉璋冭繖涓簡
+            String token = getToken();
+            JSONObject json1 = JSONObject.parseObject(token);
+            token = json1.get("id").toString();
+
+            ObjectMapper objectMapper = new ObjectMapper();
+            String json = null;
+            try {
+                json = objectMapper.writeValueAsString(map);
+            } catch (JsonProcessingException e) {
+                e.printStackTrace();
+            }
             if (serviceReimbursement.getBackflowlevel() == 100L) {
-                strRes = HttpClientKit.postOpr(rexyurl, map.toString());
+                log.error("-----------------Reimbursement鍐嶆鍙戣捣鐨剈rl涓猴細{},  鍏ュ弬涓猴細{}", rexyurl + "?token=" + token, json);
+                strRes = HttpClientKit.postOpr(rexyurl + "?token=" + token, json);
             } else {
-                strRes = HttpClientKit.postOpr(xyurl, map.toString());
+                log.error("-----------------Reimbursement棣栨鍙戣捣鐨剈rl涓猴細{},  鍏ュ弬涓猴細{}", xyurl + "?token=" + token, json);
+                strRes = HttpClientKit.postOpr(xyurl + "?token=" + token, json);
+                // 灏唖ummaryId淇濆瓨璧锋潵,骞跺皢璇ュ�间繚瀛樺埌fund涓紝鐢ㄤ簬鍐嶆鍙戣捣鏃讹紝浣跨敤锛堝崗鍙嬭姹傦紝鍐嶆鍙戣捣鏃讹紝甯︿笂杩欎釜鍊硷級
+                JsonObject root = JsonParser.parseString(strRes).getAsJsonObject();
+                String code = root.get("code").getAsString();
+                if ("0".equals(code)) {
+                    String appBusinessData = root.getAsJsonObject("data").get("app_bussiness_data").getAsString();
+                    JsonObject appDataObj = JsonParser.parseString(appBusinessData).getAsJsonObject();
+                    String summaryId = appDataObj.get("summaryId").getAsString();
+                    serviceReimbursement.setSummaryId(summaryId);
+                    serviceReimbursementMapper.updateById(serviceReimbursement);
+                }
             }
         }
-        com.alibaba.fastjson2.JSONObject jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(strRes);
-        String code = jsonObject.getJSONObject("code").toString();
+        log.error("-----Reimbursement-------------strRes鐨勫�间负锛歿}", strRes);
+        JSONObject jsonObject = JSONObject.parseObject(strRes);
+        String code = jsonObject.getString("code");
         if (!code.equals("0")) {
             return false;
         }
@@ -588,36 +616,37 @@
             Map<String, Object> map = new HashMap<>();
             map.put("浜ら�氬伐鍏�", reimbursementdetailShared.getTraffictype());
             map.put("浜ら�氳垂", reimbursementdetailShared.getTrafficexpense());
-            map.put("甯傚唴浜ら��", reimbursementdetailShared.getTraffictype2());
+            map.put("甯傚唴浜ら��", reimbursementdetailShared.getCityfee());
             map.put("浣忓璐�", reimbursementdetailShared.getHotelexpense());
             map.put("鏉傝垂", reimbursementdetailShared.getOtherexpense());
             map.put("浼欓璐规姤閿�", reimbursementdetailShared.getFoodexpenses());
             map.put("浼欓璐硅ˉ鍔�", reimbursementdetailShared.getFoodallowance());
             map.put("鍏朵粬璐圭敤", reimbursementdetailShared.getOtherfeeamount());
             map.put("鍏朵粬璐圭敤璇存槑", reimbursementdetailShared.getOtherfeedesc());
-            map.put("閲戦鍚堣", null);
-            map.put("鍑哄樊鏃堕棿璧�", reimbursementdetailShared.getStarttime());
+            map.put("閲戦鍚堣", "");
+            map.put("鍑哄樊鏃堕棿璧�", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(reimbursementdetailShared.getStarttime()));
             map.put("鍑哄彂鍦扮偣", reimbursementdetailShared.getDeparture());
-            map.put("鍑哄樊鏃堕棿姝�", reimbursementdetailShared.getEndtime());
+            map.put("鍑哄樊鏃堕棿姝�", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(reimbursementdetailShared.getEndtime()));
             map.put("鍑哄樊鐩殑鍦�", reimbursementdetailShared.getDestination());
             map.put("澶╂暟", reimbursementdetailShared.getDays());
-            map.put("瀹為檯鎶ラ攢閲戦", null);
+            BigDecimal total = safe(reimbursementdetailShared.getCityfee()).add(safe(reimbursementdetailShared.getTrafficexpense())).add(safe(reimbursementdetailShared.getHotelexpense())).add(safe(reimbursementdetailShared.getOtherexpense())).add(safe(reimbursementdetailShared.getFoodexpenses())).add(safe(reimbursementdetailShared.getFoodallowance())).add(safe(reimbursementdetailShared.getOtherfeeamount()));
+            map.put("瀹為檯鎶ラ攢閲戦", total);
             map.put("璐㈠姟澶囨敞", reimbursementdetailShared.getRemark());
             map.put("id", reimbursementdetailShared.getRdid());
             map.put("鍑哄樊浜�", reimbursementdetailShared.getPersonname());
-            map.put("鍥炰氦閫氬伐鍏�", null);
+            map.put("鍥炰氦閫氬伐鍏�", "");
             map.put("浜哄憳绫诲埆", reimbursementdetailShared.getPersontype());
-            map.put("浣忓璐规爣鍑�", null);
+            map.put("浣忓璐规爣鍑�", "");
             map.put("浣忓璐规爣鍑嗗悎璁�", reimbursementdetailShared.getHotelexpense());
-            String fpuuid = IdUtils.simpleUUID();
+            Long fpuuid = System.currentTimeMillis();
             map.put("鍙戠エ闄勪欢", fpuuid);
-            map.put("绁ㄦ嵁璇嗗埆", null);
-            map.put("璇嗗埆浜�", null);
-            map.put("搴忓彿1", null);
-            String qtuuid = IdUtils.simpleUUID();
+            map.put("绁ㄦ嵁璇嗗埆", "");
+            map.put("璇嗗埆浜�", "");
+            map.put("搴忓彿1", "");
+            Long qtuuid = System.currentTimeMillis();
             map.put("鍏朵粬闄勪欢", qtuuid);
-            map.put("涓汉绁ㄥす鐢ㄦ埛", null);
-            map.put("璇嗗埆绁ㄦ嵁", null);
+            map.put("涓汉绁ㄥす鐢ㄦ埛", "");
+            map.put("璇嗗埆绁ㄦ嵁", "");
 
             list.add(map);
 
@@ -654,6 +683,10 @@
         return allMap;
     }
 
+    private BigDecimal safe(BigDecimal val) {
+        return val == null ? BigDecimal.ZERO : val;
+    }
+
     private List<Map<String, Object>> formson_1211(List<ServiceReimbursementpayeeShared> serviceReimbursementpayeeShareds) {
         Map<String, List<Map<String, Object>>> allMap = new HashMap<>();
 
@@ -666,10 +699,10 @@
             map.put("寮�鎴烽摱琛�", serviceReimbursementpayeeShared.getBankname());
             map.put("鎵撴閲戦", serviceReimbursementpayeeShared.getAmount());
             map.put("浜哄憳绫诲埆鎵撴", serviceReimbursementpayeeShared.getPersontype());
-            map.put("鏍哥畻椤圭洰", null);
-            map.put("棰勭畻椤圭洰", null);
-            map.put("鍊熸柟鎽樿", null);
-            map.put("璐锋柟鎽樿", null);
+            map.put("鏍哥畻椤圭洰", "");
+            map.put("棰勭畻椤圭洰", "");
+            map.put("鍊熸柟鎽樿", "");
+            map.put("璐锋柟鎽樿", "");
             list.add(map);
         }
         return list;
@@ -678,21 +711,21 @@
     private Map<String, Object> formmain_1209(ServiceReimbursementShared serviceReimbursementShared) {
         Map<String, Object> formmain_1209 = new HashMap<>();
 
-        formmain_1209.put("鎶ラ攢鏃ユ湡", serviceReimbursementShared.getApplyTime());
-        formmain_1209.put("鍑哄樊浜�-浣滃簾", null);
+        formmain_1209.put("鎶ラ攢鏃ユ湡", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(serviceReimbursementShared.getApplyTime()));
+        formmain_1209.put("鍑哄樊浜�-浣滃簾", "");
         formmain_1209.put("鎶ラ攢浜�", serviceReimbursementShared.getUsername());
         formmain_1209.put("鍖哄煙缁勯暱", serviceReimbursementShared.getManagername());
         formmain_1209.put("鍑哄樊浜嬬敱", serviceReimbursementShared.getReason());
-        formmain_1209.put("澶╂暟鍚堣", null);
+        formmain_1209.put("澶╂暟鍚堣", 0.00);
         formmain_1209.put("浜ら�氳垂鍚堣", serviceReimbursementShared.getTotalamount());
-        formmain_1209.put("甯傚唴浜ら�氬悎璁�", null);
-        formmain_1209.put("浣忓璐瑰悎璁�", null);
-        formmain_1209.put("鏉傝垂鍚堣", null);
-        formmain_1209.put("浼欓璐规姤閿�鍚堣", null);
-        formmain_1209.put("浼欓璐硅ˉ鍔╁悎璁�", null);
-        formmain_1209.put("鍏朵粬璐圭敤鍚堣", null);
+        formmain_1209.put("甯傚唴浜ら�氬悎璁�", 0.00);
+        formmain_1209.put("浣忓璐瑰悎璁�", 0.00);
+        formmain_1209.put("鏉傝垂鍚堣", 0.00);
+        formmain_1209.put("浼欓璐规姤閿�鍚堣", 0.00);
+        formmain_1209.put("浼欓璐硅ˉ鍔╁悎璁�", 0.00);
+        formmain_1209.put("鍏朵粬璐圭敤鍚堣", 0.00);
         formmain_1209.put("棰嗘閲戦澶у啓", serviceReimbursementShared.getBigstrmoney());
-        formmain_1209.put("棰嗘閲戦", serviceReimbursementShared.getTotalamount());
+        formmain_1209.put("棰嗘閲戦", serviceReimbursementShared.getAmountrequested());
         formmain_1209.put("璐㈠姟瀹℃壒", serviceReimbursementShared.getFinancechecher());
         formmain_1209.put("璐㈠姟閮ㄨ礋璐d汉瀹℃壒", serviceReimbursementShared.getFinancedirector());
         formmain_1209.put("鍔炲叕瀹や富浠诲鎵�", serviceReimbursementShared.getOfficedirector());
@@ -700,39 +733,39 @@
         formmain_1209.put("涓氬姟鍓櫌闀垮鎵�", serviceReimbursementShared.getBusvicepresident());
         formmain_1209.put("璐㈠姟鍓櫌闀垮鎵�", serviceReimbursementShared.getFinvicepresident());
         formmain_1209.put("涓績璐熻矗浜哄鎵�", serviceReimbursementShared.getOpochecker());
-        formmain_1209.put("寮�鎴烽摱琛�-浣滃簾", null);
-        formmain_1209.put("鍗″彿-浣滃簾", null);
+        formmain_1209.put("寮�鎴烽摱琛�-浣滃簾", "");
+        formmain_1209.put("鍗″彿-浣滃簾", "");
         formmain_1209.put("鏀粯鏂瑰紡", serviceReimbursementShared.getZffs());
-        formmain_1209.put("缁勯暱", null);
-        formmain_1209.put("瀹℃壒浜哄憳", null);
+        formmain_1209.put("缁勯暱", "");
+        formmain_1209.put("瀹℃壒浜哄憳", "");
         formmain_1209.put("鏀粯鏃ユ湡", serviceReimbursementShared.getRiqi());
-        formmain_1209.put("涓婁紶闄勪欢", null);
-        formmain_1209.put("鎵撴鍚堣", null);
-        formmain_1209.put("鍙戠エ璇嗗埆-浣滃簾", null);
-        formmain_1209.put("璇嗗埆浜�-浣滃簾", null);
-        formmain_1209.put("璐㈠姟瀹℃壒绛惧瓧", null);
+        formmain_1209.put("涓婁紶闄勪欢", "");
+        formmain_1209.put("鎵撴鍚堣", 0.00);
+        formmain_1209.put("鍙戠エ璇嗗埆-浣滃簾", "");
+        formmain_1209.put("璇嗗埆浜�-浣滃簾", "");
+        formmain_1209.put("璐㈠姟瀹℃壒绛惧瓧", "");
         formmain_1209.put("璐㈠姟閮ㄨ礋璐d汉瀹℃壒绛惧瓧", serviceReimbursementShared.getFinancedirector());
-        formmain_1209.put("琛ㄥ崟缂栧彿1", null);
-        formmain_1209.put("CIF璐﹀閰嶇疆1", null);
-        formmain_1209.put("闄㈠尯", null);
-        formmain_1209.put("涓氬姟鍖哄煙", null);
-        formmain_1209.put("璐锋柟绉戠洰", null);
-        formmain_1209.put("缂栫爜", null);
-        formmain_1209.put("鏄惁鏀粯", null);
-        formmain_1209.put("鍑瘉鍙�", null);
-        formmain_1209.put("閾惰鍥炲崟", null);
-        formmain_1209.put("OFD", null);
-        formmain_1209.put("琛ㄥ崟闄勪欢", null);
-        formmain_1209.put("10204", null);
-        formmain_1209.put("鐜伴噾娴侀噺鍒嗘瀽", null);
+        formmain_1209.put("琛ㄥ崟缂栧彿1", "");
+        formmain_1209.put("CIF璐﹀閰嶇疆1", "");
+        formmain_1209.put("闄㈠尯", "");
+        formmain_1209.put("涓氬姟鍖哄煙", "");
+        formmain_1209.put("璐锋柟绉戠洰", "");
+        formmain_1209.put("缂栫爜", "");
+        formmain_1209.put("鏄惁鏀粯", "");
+        formmain_1209.put("鍑瘉鍙�", "");
+        formmain_1209.put("閾惰鍥炲崟", "");
+        formmain_1209.put("OFD", "");
+        formmain_1209.put("琛ㄥ崟闄勪欢", "");
+        formmain_1209.put("10204", "");
+        formmain_1209.put("鐜伴噾娴侀噺鍒嗘瀽", "");
         formmain_1209.put("鎹愮尞鑰�", serviceReimbursementShared.getDonorname());
-        formmain_1209.put("鍑瘉绫诲埆", null);
-        formmain_1209.put("鍚堣", null);
-        formmain_1209.put("瀹為檯鍚堣", null);
-        formmain_1209.put("浼欓琛ュ姪鍚堣", null);
-        formmain_1209.put("鍘嗗彶瀹℃壒璁板綍", null);
-        formmain_1209.put("琛ㄥ崟缂栧彿", serviceReimbursementShared.getBh());
-        formmain_1209.put("鍘嗗彶瀹℃壒宸ㄩ箍鏌ヨ", null);
+        formmain_1209.put("鍑瘉绫诲埆", "");
+        formmain_1209.put("鍚堣", 0.00);
+        formmain_1209.put("瀹為檯鍚堣", 0.00);
+        formmain_1209.put("浼欓琛ュ姪鍚堣", 0.00);
+        formmain_1209.put("鍘嗗彶瀹℃壒璁板綍", "");
+        formmain_1209.put("琛ㄥ崟缂栧彿", serviceReimbursementShared.getReimid());
+        formmain_1209.put("鍘嗗彶瀹℃壒宸ㄩ箍鏌ヨ", "");
         return formmain_1209;
     }
 
@@ -741,20 +774,7 @@
         log.info("uploadOAFileAndUpdate鏂规硶鐨勫叆鍙�:{}", remShare);
         System.out.println("uploadOAFileAndUpdate鏂规硶鐨勫叆鍙�:" + remShare);
         //涓婁紶OA鏂囦欢
-        //String strUrl = "http://129.88.242.39:8899/seeyon/rest/token?userName=opo&password=127814f8-84e8-4304-84a5-a71573567efd&loginName=demo3";
-        String strUrl = "http://129.88.242.39:8899/seeyon/rest/token";
-        //String strUrl = "http://slb.hospitalstar.com:8899/seeyon/rest/token";
-        //涓婁紶鏂囦欢鎴愬姛鍚庯紝鍘绘洿鏂扮浉鍏崇殑鏁版嵁搴�
-
-        Map<String, Object> map = new HashMap<String, Object>();
-        map.put("userName", "opo");
-        map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5");
-        map.put("loginName", "demo3");
-
-        JSONObject jsonObj = new JSONObject(map);
-
-        System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString());
-        String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString());
+        String strRes = getToken();
 
         JSONObject json1 = JSONObject.parseObject(strRes);
         strRes = json1.get("id").toString();
@@ -776,6 +796,23 @@
         return 0;
     }
 
+    private String getToken() {
+        String strUrl = "http://129.88.242.39:8899/seeyon/rest/token";
+        //String strUrl = "http://slb.hospitalstar.com:8899/seeyon/rest/token";
+        //涓婁紶鏂囦欢鎴愬姛鍚庯紝鍘绘洿鏂扮浉鍏崇殑鏁版嵁搴�
+
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("userName", "opo");
+        map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5");
+        map.put("loginName", "demo");
+
+        JSONObject jsonObj = new JSONObject(map);
+
+        System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString());
+        String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString());
+        return strRes;
+    }
+
     private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceReimbursementdetailShared remShare, String flag) throws Exception {
         if (!CollectionUtils.isEmpty(parseArray)) {
             for (int i = 0; i < parseArray.size(); i++) {

--
Gitblit v1.9.3