|
@@ -0,0 +1,499 @@
|
|
|
|
|
+package sanyangwl.pro.sanyang.controller;
|
|
|
|
|
+
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
+import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
+import com.malk.server.aliwork.YDConf;
|
|
|
|
|
+import com.malk.server.aliwork.YDParam;
|
|
|
|
|
+import com.malk.server.aliwork.YDSearch;
|
|
|
|
|
+import com.malk.server.common.McR;
|
|
|
|
|
+import com.malk.server.dingtalk.DDR_New;
|
|
|
|
|
+import com.malk.service.aliwork.YDClient;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+import sanyangwl.pro.sanyang.Utils.ChanjetEncryptMsg;
|
|
|
|
|
+import sanyangwl.pro.sanyang.Utils.OpenapiHelper;
|
|
|
|
|
+import sanyangwl.pro.sanyang.service.oaLinkcjtServer;
|
|
|
|
|
+import sanyangwl.pro.sanyang.service.ddMessageServer;
|
|
|
|
|
+
|
|
|
|
|
+import java.time.Instant;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+import static java.lang.System.currentTimeMillis;
|
|
|
|
|
+import static sanyangwl.pro.sanyang.Utils.CjtAppticket.*;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 功能:
|
|
|
|
|
+ * 作者:hanxue
|
|
|
|
|
+ * 日期:2025/5/28 18:01
|
|
|
|
|
+ */
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/sanyang")
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+public class oaLinkcjt {
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private oaLinkcjtServer oaLinkcjtService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private YDClient ydClient;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// ============================================付款推送见知START===================================================
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取银行支行
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/getBankCode")
|
|
|
|
|
+ public McR getBankCode(@RequestBody Map param){
|
|
|
|
|
+ try{
|
|
|
|
|
+ List data =oaLinkcjtService.getBankCode(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/getBankSerial")
|
|
|
|
|
+ public McR getBankSerial(@RequestBody Map param){
|
|
|
|
|
+ try{
|
|
|
|
|
+ String data =oaLinkcjtService.getBankSerial(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 推送付款数据
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/pushPayment")
|
|
|
|
|
+ public McR pushPayment(@RequestBody Map param){
|
|
|
|
|
+ log.info("推送付款数据:{}",param);
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.processPayment(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// ============================================付款推送见知END===================================================
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// =================================================供应商接口START==============================================
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新增供应商
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/processSupplier")
|
|
|
|
|
+ public McR supplier(@RequestBody Map param){
|
|
|
|
|
+ log.info("供应商数据处理");
|
|
|
|
|
+ try{
|
|
|
|
|
+ String data =oaLinkcjtService.processSupplier(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 修改供应商
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/changeSupplier")
|
|
|
|
|
+ public McR changeSupplier(@RequestBody Map param){
|
|
|
|
|
+ log.info("供应商数据处理");
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.changeSupplier(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// =================================================供应商接口END==============================================================
|
|
|
|
|
+
|
|
|
|
|
+// =================================================凭证推送接口START===========================================================
|
|
|
|
|
+
|
|
|
|
|
+ // 从宜搭获取付款科目接口
|
|
|
|
|
+ @PostMapping("/getPaySubject")
|
|
|
|
|
+ public McR getPaySubject() {
|
|
|
|
|
+ List data =oaLinkcjtService.getPaySubject();
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 付款单单数据处理
|
|
|
|
|
+ * @RequestBody Map param(processInstanceId,flag=0/1,reimburseType=”payment")
|
|
|
|
|
+ * @return McR
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/processVoucher")
|
|
|
|
|
+ public McR voucher(@RequestBody Map param){
|
|
|
|
|
+ log.info("付款单凭证数据处理:{}",param);
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.processVoucher(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("同步失败信息:{}", e);
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 报销单数据处理
|
|
|
|
|
+ * @RequestBody Map param(processInstanceId,flag=0/1,reimburseType="daily"/"travel"/"business")
|
|
|
|
|
+ * @return McR
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/processReimbursement")
|
|
|
|
|
+ public McR reimbursement(@RequestBody Map param){
|
|
|
|
|
+ log.info("报销单凭证数据处理:{}",param);
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.processReimbursement(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("同步失败信息:{}", e);
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+//================================================凭证推送接口END==============================================================
|
|
|
|
|
+
|
|
|
|
|
+//============================================cjt消息通知配置及获取token接口START==================================================
|
|
|
|
|
+
|
|
|
|
|
+// 消息通知配置
|
|
|
|
|
+ private static final String ENCRYPT_KEY = "5gH8pK2qR9sT4wL7"; // 环境密钥
|
|
|
|
|
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
|
|
|
|
+ @PostMapping("/getMessage")
|
|
|
|
|
+ public Map<String, String> getMessage(@RequestBody ChanjetEncryptMsg encryptMsg) throws Exception {
|
|
|
|
|
+ // 主线程:只提取并保存 appTicket(不解密完整消息)
|
|
|
|
|
+ try {
|
|
|
|
|
+ String enMsg = encryptMsg.getEncryptMsg();
|
|
|
|
|
+ String decryptMsg = OpenapiHelper.aesDecrypt(enMsg, ENCRYPT_KEY);
|
|
|
|
|
+ log.info("收到消息通知:{}", decryptMsg);
|
|
|
|
|
+ // 快速提取 appTicket
|
|
|
|
|
+ if (decryptMsg.contains("appTicket")) {
|
|
|
|
|
+ // 可以用正则或 substring 快速提取,避免完整解析
|
|
|
|
|
+ String appTicket = extractAppTicketFast(decryptMsg);
|
|
|
|
|
+ if (appTicket != null) {
|
|
|
|
|
+ APP_TICKET = appTicket;
|
|
|
|
|
+ log.info("主线程快速保存 appTicket: {}", appTicket);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("主线程快速提取失败,依赖异步处理", e);
|
|
|
|
|
+ // 不抛出,继续返回 success
|
|
|
|
|
+ }
|
|
|
|
|
+ // 异步处理完整逻辑(日志、其他类型等)
|
|
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String enMsg = encryptMsg.getEncryptMsg();
|
|
|
|
|
+ String decryptMsg = OpenapiHelper.aesDecrypt(enMsg, ENCRYPT_KEY);
|
|
|
|
|
+ JsonNode rootNode = OBJECT_MAPPER.readTree(decryptMsg);
|
|
|
|
|
+ String msgType = rootNode.path("msgType").asText();
|
|
|
|
|
+
|
|
|
|
|
+ if ("APP_TICKET".equals(msgType)) {
|
|
|
|
|
+ String appTicket = rootNode.path("bizContent").path("appTicket").asText();
|
|
|
|
|
+ APP_TICKET = appTicket; // 再次确认
|
|
|
|
|
+ log.info("异步最终确认 appTicket: {}", appTicket);
|
|
|
|
|
+ } else if ("TEMP_AUTH_CODE".equals(msgType)) {
|
|
|
|
|
+ String tmpAuthCode = rootNode.path("bizContent").path("tempAuthCode").asText();
|
|
|
|
|
+ TEMP_AUTH_CODE = tmpAuthCode;
|
|
|
|
|
+ log.info("异步保存 tempAuthCode: {}", tmpAuthCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("异步处理失败", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return receiveMsgOK();
|
|
|
|
|
+ }
|
|
|
|
|
+ //快速从解密后的 JSON 字符串中提取 appTicket
|
|
|
|
|
+ private static final Pattern APP_TICKET_PATTERN = Pattern.compile("\"appTicket\"\\s*:\\s*\"([^\"]+)\"");
|
|
|
|
|
+ private String extractAppTicketFast(String decryptMsg) {
|
|
|
|
|
+ if (decryptMsg == null || decryptMsg.isEmpty()) return null;
|
|
|
|
|
+ Matcher matcher = APP_TICKET_PATTERN.matcher(decryptMsg);
|
|
|
|
|
+ return matcher.find() ? matcher.group(1) : null;
|
|
|
|
|
+ }
|
|
|
|
|
+ private Map<String, String> receiveMsgOK() {
|
|
|
|
|
+ Map<String, String> result = new HashMap<>();
|
|
|
|
|
+ result.put("result", "success");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/receiveCode")
|
|
|
|
|
+ public String oAuth(@RequestParam String code, @RequestParam String state) {
|
|
|
|
|
+ System.out.println("Code:" + code);
|
|
|
|
|
+ return code;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/getToken")
|
|
|
|
|
+ public McR getToken(@RequestBody Map param ) throws Exception {
|
|
|
|
|
+ String data =oaLinkcjtService.getToken((String) param.get("type"), (String) param.get("makeReport"));
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// ==========================================cjt消息通知配置及获取token接口END===========================================================
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// =================================================get测试接口START==================================================================
|
|
|
|
|
+ @GetMapping("/test")
|
|
|
|
|
+ public long test(){
|
|
|
|
|
+ return currentTimeMillis();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
|
+ public McR get(@RequestBody Map param){
|
|
|
|
|
+ log.info("get:{}",param);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// ==========================================get测试接口END===============================================
|
|
|
|
|
+
|
|
|
|
|
+// =================================停用接口START==============================================================
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 同步供应商数据--停用
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/syncSupplier")
|
|
|
|
|
+ public McR syncSupplier(@RequestBody Map param){
|
|
|
|
|
+ log.info("供应商数据处理");
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.syncSupplier(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 获取供应商档案数据--停用
|
|
|
|
|
+ @PostMapping("/getSupplier")
|
|
|
|
|
+ public McR getSupplier(){
|
|
|
|
|
+ log.info("供应商档案数据处理");
|
|
|
|
|
+ DDR_New ddrNew;
|
|
|
|
|
+ int pageNumber = 1;
|
|
|
|
|
+ int pageSize = 100;
|
|
|
|
|
+ JSONArray supplierList = new JSONArray();
|
|
|
|
|
+ do {
|
|
|
|
|
+ ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
|
|
+ .formUuid("FORM-795A93DE8B9F4195BC731C86DE7278AEQT9R")
|
|
|
|
|
+ .pageNumber(pageNumber)
|
|
|
|
|
+ .pageSize(pageSize)
|
|
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_list);
|
|
|
|
|
+ if (ddrNew != null && ddrNew.getData() != null) {
|
|
|
|
|
+ JSONArray currentPageData = (JSONArray) ddrNew.getData();
|
|
|
|
|
+ supplierList.addAll(currentPageData);
|
|
|
|
|
+ System.out.println("已处理第 " + pageNumber + " 页数据,当前页记录数: " + currentPageData.size());
|
|
|
|
|
+ if (currentPageData.size() < pageSize) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ pageNumber++; // 准备查询下一页
|
|
|
|
|
+ } while (ddrNew != null && ddrNew.getTotalCount() > (pageNumber - 1) * pageSize);
|
|
|
|
|
+ List supplierArray = new ArrayList();
|
|
|
|
|
+ for(Object ddrNewItem:supplierList){
|
|
|
|
|
+ Map ddrNewMap = (Map) ddrNewItem;
|
|
|
|
|
+ Map ddrsNewMap = (Map) ddrNewMap.get("formData");
|
|
|
|
|
+ String ddrNewCode = ddrsNewMap.get("textField_mb7w3zbf").toString();
|
|
|
|
|
+ supplierArray.add(ddrNewCode);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return McR.success(supplierArray);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 填充供应商档案数据--停用
|
|
|
|
|
+ @PostMapping("/fillSupplier")
|
|
|
|
|
+ public McR fillSupplier(@RequestBody Map param){
|
|
|
|
|
+ log.info("供应商档案数据处理");
|
|
|
|
|
+ DDR_New ddrNew;
|
|
|
|
|
+ int pageNumber = 1;
|
|
|
|
|
+ int pageSize = 100;
|
|
|
|
|
+ JSONArray supplierList = new JSONArray();
|
|
|
|
|
+ do {
|
|
|
|
|
+ ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
|
|
+ .formUuid("FORM-795A93DE8B9F4195BC731C86DE7278AEQT9R")
|
|
|
|
|
+ .searchCondition(JSONObject.toJSONString(Arrays.asList(
|
|
|
|
|
+ new YDSearch("textField_mb7w3zbf", param.get("supplierName"), "textField_mb7w3zbf",
|
|
|
|
|
+ YDSearch.Type.TEXT_FIELD, YDSearch.Operator.EQ) )))// 精准匹配
|
|
|
|
|
+ .pageNumber(pageNumber)
|
|
|
|
|
+ .pageSize(pageSize)
|
|
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_list);
|
|
|
|
|
+ if (ddrNew != null && ddrNew.getData() != null) {
|
|
|
|
|
+ JSONArray currentPageData = (JSONArray) ddrNew.getData();
|
|
|
|
|
+ supplierList.addAll(currentPageData);
|
|
|
|
|
+ System.out.println("已处理第 " + pageNumber + " 页数据,当前页记录数: " + currentPageData.size());
|
|
|
|
|
+ if (currentPageData.size() < pageSize) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ pageNumber++; // 准备查询下一页
|
|
|
|
|
+ } while (ddrNew != null && ddrNew.getTotalCount() > (pageNumber - 1) * pageSize);
|
|
|
|
|
+ Map ddrNewMap = (Map) supplierList.get(0);
|
|
|
|
|
+ Map ddrsNewMap = (Map) ddrNewMap.get("formData");
|
|
|
|
|
+ return McR.success(ddrsNewMap);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取日常报销单oa数据--停用
|
|
|
|
|
+ @PostMapping("/processDaily")
|
|
|
|
|
+ public McR processDaily(@RequestBody Map param){
|
|
|
|
|
+ log.info("日常报销单凭证数据处理");
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.processDailyVoucher(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
|
+ log.error("同步失败:{}", e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取差旅报销单oa数据--停用
|
|
|
|
|
+ @PostMapping("/processTravel")
|
|
|
|
|
+ public McR processTravel(@RequestBody Map param){
|
|
|
|
|
+ log.info("差旅报销单凭证数据处理");
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.processTravelVoucher(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
|
+ log.error("同步失败:{}", e);
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取业务招待费用单oa数据--停用
|
|
|
|
|
+ @PostMapping("/processBusiness")
|
|
|
|
|
+ public McR processBusiness(@RequestBody Map param){
|
|
|
|
|
+ log.info("业务招待费用凭证数据处理");
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.processBusinessVoucher(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
|
+ log.error("同步失败:{}", e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// ========================================停用接口END================================================
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// ================================新需求钉钉流程相关接口START===========================================
|
|
|
|
|
+ /***
|
|
|
|
|
+ * 自动发起支付复核流程
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/autoPayment")
|
|
|
|
|
+ public McR autoPayment(@RequestBody Map param){
|
|
|
|
|
+ try{
|
|
|
|
|
+ return oaLinkcjtService.autoPayment(param);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 更新线下付款宜搭付款状态
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/updateStatus")
|
|
|
|
|
+ public McR updateStatus(@RequestBody Map param){
|
|
|
|
|
+ log.info("线下支付更新审核状态:reimburseType:{},formInstanceId:{}",param.get("reimburseType"),param.get("formInstanceId"));
|
|
|
|
|
+ String formUUid = "";
|
|
|
|
|
+ if(param.get("reimburseType").equals("payment")){
|
|
|
|
|
+ formUUid ="FORM-8151C4EB020A4D79821D73F931F6A27D730D";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ formUUid ="FORM-1FF3117C37394668ABCA09CEE22BF8174XQW";
|
|
|
|
|
+ }
|
|
|
|
|
+ String formInstanceId = param.get("formInstanceId").toString();
|
|
|
|
|
+ try{
|
|
|
|
|
+ List<Map> paymentList = (List<Map>) ydClient.queryData(YDParam.builder()
|
|
|
|
|
+ .formUuid(formUUid)
|
|
|
|
|
+ .searchCondition(JSONObject.toJSONString(Arrays.asList(
|
|
|
|
|
+ new YDSearch("textField_mcog8v86", formInstanceId, "textField_mcog8v86",
|
|
|
|
|
+ YDSearch.Type.TEXT_FIELD, YDSearch.Operator.EQ) // 精准匹配
|
|
|
|
|
+ )))
|
|
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_list_all).getData();
|
|
|
|
|
+ String InstanceId = paymentList.get(0).get("formInstanceId").toString();
|
|
|
|
|
+ Map updateParam = new HashMap();
|
|
|
|
|
+ updateParam.put("textField_md78giwk","已审核已付款");
|
|
|
|
|
+ updateParam.put("dateField_md78giwl", Instant.now().toEpochMilli());
|
|
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
|
|
+ .formUuid(formUUid)
|
|
|
|
|
+ .formInstanceId(InstanceId)
|
|
|
|
|
+ .updateFormDataJson(JSON.toJSONString(updateParam))
|
|
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
|
|
+ return McR.success();
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取关联审批编号
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/getRecordCode")
|
|
|
|
|
+ public McR getApproval(@RequestBody Map param){
|
|
|
|
|
+ log.info("获取关联审批单:{}",param);
|
|
|
|
|
+ return McR.success(oaLinkcjtService.getRecordCode(param));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取对公/报销申请信息
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/getApplyInfo")
|
|
|
|
|
+ public McR getApplyInfo(@RequestBody Map param){
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.getApplyInfo(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 自动同意申请审批任务
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/processApproval")
|
|
|
|
|
+ public McR processApproval(@RequestBody Map param){
|
|
|
|
|
+ log.info("自动同意审批任务:{}",param);
|
|
|
|
|
+ try{
|
|
|
|
|
+ Map data =oaLinkcjtService.processApproval(param);
|
|
|
|
|
+ return McR.success(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("同步失败:{}",e.getMessage());
|
|
|
|
|
+ return McR.errorParam(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// ================================新需求钉钉流程相关接口END===========================================
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}
|