Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
424c60b0
Commit
424c60b0
authored
Sep 28, 2025
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企微智能表格应用-fxj
parent
df3ca24c
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
487 additions
and
86 deletions
+487
-86
EkpContractInfo.java
...va/com/yifu/cloud/plus/v1/ekp/entity/EkpContractInfo.java
+132
-0
EkpInvoiceInfo.java
...ava/com/yifu/cloud/plus/v1/ekp/entity/EkpInvoiceInfo.java
+132
-0
EkpAlertTableController.java
...cloud/plus/v1/ekp/controller/EkpAlertTableController.java
+8
-1
QwExcelApiController.java
...fu/cloud/plus/v1/ekp/controller/QwExcelApiController.java
+41
-0
QwExcelApiMapper.java
...a/com/yifu/cloud/plus/v1/ekp/mapper/QwExcelApiMapper.java
+66
-0
EkpAlertTableService.java
.../yifu/cloud/plus/v1/ekp/service/EkpAlertTableService.java
+1
-1
QwExcelApiService.java
...com/yifu/cloud/plus/v1/ekp/service/QwExcelApiService.java
+36
-0
EkpAlertTableServiceImpl.java
...ud/plus/v1/ekp/service/impl/EkpAlertTableServiceImpl.java
+2
-2
QwExcelApiServiceImpl.java
...lus/v1/ekp/service/impl/QwExce/QwExcelApiServiceImpl.java
+46
-0
SmartSheetDebugService.java
...m/yifu/cloud/plus/v1/ekp/util/SmartSheetDebugService.java
+21
-80
WeComSmartSheetDebugger.java
.../yifu/cloud/plus/v1/ekp/util/WeComSmartSheetDebugger.java
+2
-2
No files found.
yifu-ekp/yifu-ekp-api/src/main/java/com/yifu/cloud/plus/v1/ekp/entity/EkpContractInfo.java
0 → 100644
View file @
424c60b0
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
ekp
.
entity
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
java.util.Date
;
/**
* EKP合同台账合同信息表
*
* @author fxj
* @date 2025-07-21 09:49:56
*/
@Data
@TableName
(
"view_contract_info"
)
@Schema
(
description
=
"EKP合同台账合同信息表"
)
public
class
EkpContractInfo
{
/**
* 主键
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@ExcelProperty
(
"主键"
)
@Schema
(
description
=
"主键"
)
private
String
fdId
;
/**
* 预警科目ID
*/
@ExcelAttribute
(
name
=
"预警科目ID"
,
maxLength
=
1000
)
@Length
(
max
=
1000
,
message
=
"预警科目ID不能超过1000个字符"
)
@ExcelProperty
(
"预警科目ID"
)
@Schema
(
description
=
"预警科目ID"
)
private
String
fdAlertSubject
;
/**
* 预警科目
*/
@ExcelAttribute
(
name
=
"预警科目"
,
maxLength
=
1000
)
@Length
(
max
=
1000
,
message
=
"预警科目不能超过1000个字符"
)
@ExcelProperty
(
"预警科目"
)
@Schema
(
description
=
"预警科目"
)
private
String
fdAlertSubjectText
;
/**
* 有效日期始
*/
@ExcelAttribute
(
name
=
"有效日期始"
,
isDate
=
true
)
@ExcelProperty
(
"有效日期始"
)
@Schema
(
description
=
"有效日期始"
)
private
Date
fdEffectiveStartDate
;
/**
* 有效日期止
*/
@ExcelAttribute
(
name
=
"有效日期止"
,
isDate
=
true
)
@ExcelProperty
(
"有效日期止"
)
@Schema
(
description
=
"有效日期止"
)
private
Date
fdEffectiveEndDate
;
/**
* 检测方式
*/
@ExcelAttribute
(
name
=
"检测方式"
,
maxLength
=
200
)
@Length
(
max
=
200
,
message
=
"检测方式不能超过200个字符"
)
@ExcelProperty
(
"检测方式"
)
@Schema
(
description
=
"检测方式"
)
private
String
fdDetectionMethod
;
/**
* 阈值(%)
*/
@ExcelAttribute
(
name
=
"阈值"
)
@ExcelProperty
(
"阈值"
)
@Schema
(
description
=
"阈值"
)
private
Integer
fdThresholdValue
;
/**
* 是否有效:是 否
*/
@ExcelAttribute
(
name
=
"是否有效"
,
maxLength
=
200
)
@Length
(
max
=
200
,
message
=
"是否有效不能超过200个字符"
)
@ExcelProperty
(
"是否有效"
)
@Schema
(
description
=
"是否有效"
)
private
String
fdIsActive
;
/**
* 预警内容
*/
@ExcelAttribute
(
name
=
"预警内容"
)
@ExcelProperty
(
"预警内容"
)
@Schema
(
description
=
"预警内容"
)
private
String
fdAlertMessage
;
/**
* 检测方式-每日时间
*/
@ExcelAttribute
(
name
=
"检测方式-每日"
,
isDate
=
true
)
@ExcelProperty
(
"检测方式-每日"
)
@Schema
(
description
=
"检测方式-每日"
)
private
Date
fdEverydayTime
;
/**
* 检测方式-每月:每月时间(日)
*/
@ExcelAttribute
(
name
=
"检测方式"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"检测方式不能超过20个字符"
)
@ExcelProperty
(
"检测方式"
)
@Schema
(
description
=
"检测方式"
)
private
String
fdChecktype
;
/**
* 检测方式-每月:1.每月 2.每日
*/
@ExcelAttribute
(
name
=
"检测方式-每月"
)
@ExcelProperty
(
"检测方式-每月"
)
@Schema
(
description
=
"检测方式-每月"
)
private
Integer
fdMonthday
;
}
yifu-ekp/yifu-ekp-api/src/main/java/com/yifu/cloud/plus/v1/ekp/entity/EkpInvoiceInfo.java
0 → 100644
View file @
424c60b0
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
ekp
.
entity
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
java.util.Date
;
/**
* EKP发票池发票信息表
*
* @author fxj
* @date 2025-07-21 09:49:56
*/
@Data
@TableName
(
"view_invoice_info"
)
@Schema
(
description
=
"EKP发票池发票信息表"
)
public
class
EkpInvoiceInfo
{
/**
* 主键
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@ExcelProperty
(
"主键"
)
@Schema
(
description
=
"主键"
)
private
String
fdId
;
/**
* 预警科目ID
*/
@ExcelAttribute
(
name
=
"预警科目ID"
,
maxLength
=
1000
)
@Length
(
max
=
1000
,
message
=
"预警科目ID不能超过1000个字符"
)
@ExcelProperty
(
"预警科目ID"
)
@Schema
(
description
=
"预警科目ID"
)
private
String
fdAlertSubject
;
/**
* 预警科目
*/
@ExcelAttribute
(
name
=
"预警科目"
,
maxLength
=
1000
)
@Length
(
max
=
1000
,
message
=
"预警科目不能超过1000个字符"
)
@ExcelProperty
(
"预警科目"
)
@Schema
(
description
=
"预警科目"
)
private
String
fdAlertSubjectText
;
/**
* 有效日期始
*/
@ExcelAttribute
(
name
=
"有效日期始"
,
isDate
=
true
)
@ExcelProperty
(
"有效日期始"
)
@Schema
(
description
=
"有效日期始"
)
private
Date
fdEffectiveStartDate
;
/**
* 有效日期止
*/
@ExcelAttribute
(
name
=
"有效日期止"
,
isDate
=
true
)
@ExcelProperty
(
"有效日期止"
)
@Schema
(
description
=
"有效日期止"
)
private
Date
fdEffectiveEndDate
;
/**
* 检测方式
*/
@ExcelAttribute
(
name
=
"检测方式"
,
maxLength
=
200
)
@Length
(
max
=
200
,
message
=
"检测方式不能超过200个字符"
)
@ExcelProperty
(
"检测方式"
)
@Schema
(
description
=
"检测方式"
)
private
String
fdDetectionMethod
;
/**
* 阈值(%)
*/
@ExcelAttribute
(
name
=
"阈值"
)
@ExcelProperty
(
"阈值"
)
@Schema
(
description
=
"阈值"
)
private
Integer
fdThresholdValue
;
/**
* 是否有效:是 否
*/
@ExcelAttribute
(
name
=
"是否有效"
,
maxLength
=
200
)
@Length
(
max
=
200
,
message
=
"是否有效不能超过200个字符"
)
@ExcelProperty
(
"是否有效"
)
@Schema
(
description
=
"是否有效"
)
private
String
fdIsActive
;
/**
* 预警内容
*/
@ExcelAttribute
(
name
=
"预警内容"
)
@ExcelProperty
(
"预警内容"
)
@Schema
(
description
=
"预警内容"
)
private
String
fdAlertMessage
;
/**
* 检测方式-每日时间
*/
@ExcelAttribute
(
name
=
"检测方式-每日"
,
isDate
=
true
)
@ExcelProperty
(
"检测方式-每日"
)
@Schema
(
description
=
"检测方式-每日"
)
private
Date
fdEverydayTime
;
/**
* 检测方式-每月:每月时间(日)
*/
@ExcelAttribute
(
name
=
"检测方式"
,
maxLength
=
20
)
@Length
(
max
=
20
,
message
=
"检测方式不能超过20个字符"
)
@ExcelProperty
(
"检测方式"
)
@Schema
(
description
=
"检测方式"
)
private
String
fdChecktype
;
/**
* 检测方式-每月:1.每月 2.每日
*/
@ExcelAttribute
(
name
=
"检测方式-每月"
)
@ExcelProperty
(
"检测方式-每月"
)
@Schema
(
description
=
"检测方式-每月"
)
private
Integer
fdMonthday
;
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/controller/EkpAlertTableController.java
View file @
424c60b0
...
...
@@ -71,9 +71,16 @@ public class EkpAlertTableController {
}
/**
* @Author fxj
* @Description 企业微信智能表格API调用调试入口
* @Date 15:56 2025/9/26
* @Param
* @return
**/
@PostMapping
(
"/tesxWxExcelApi"
)
public
void
tesxWxExcelApi
()
{
ekpAlertTableService
.
tesxWxExcelApi
();
//
ekpAlertTableService.tesxWxExcelApi();
}
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/controller/QwExcelApiController.java
0 → 100644
View file @
424c60b0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
ekp
.
controller
;
import
com.yifu.cloud.plus.v1.ekp.service.QwExcelApiService
;
import
com.yifu.cloud.plus.v1.ekp.service.ZhaoHangService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 招行卡相关控制器
* @author hgw
* @date 2025-9-9 11:24:36
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/qwExcelApi"
)
@Tag
(
name
=
"招行卡相关控制器"
)
public
class
QwExcelApiController
{
private
final
QwExcelApiService
qwExcelApiService
;
/**
* @Author fxj
* @Description 企业微信智能表格API调用调试入口
* @Date 15:56 2025/9/26
* @Param
* @return
**/
@PostMapping
(
"/tesxWxExcelApi"
)
public
void
tesxWxExcelApi
()
{
qwExcelApiService
.
tesxWxExcelApi
();
}
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/mapper/QwExcelApiMapper.java
0 → 100644
View file @
424c60b0
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
ekp
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.ekp.entity.EkpAlertTable
;
import
com.yifu.cloud.plus.v1.ekp.entity.EkpInvoiceInfo
;
import
com.yifu.cloud.plus.v1.ekp.vo.BudgetWarningVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Author fxj
* @Description EKP的发票信息、合同信息
* @Date 16:28 2025/9/26
* @Param
* @return
**/
@Mapper
public
interface
QwExcelApiMapper
extends
BaseMapper
<
EkpInvoiceInfo
>
{
@Select
(
"select \n"
+
"invoiceNo as '发票号',\n"
+
"contractNo as '合同号',\n"
+
"invoiceFee as '开票金额',\n"
+
"invoiceDate as '开票时间',\n"
+
"invoiceMonth as '开票月份',\n"
+
"saleName as '购买名称',\n"
+
"invoiceStatus as '发票状态',\n"
+
"invoiceRedReversal as '红冲状态',\n"
+
"concatInfo as '发票号&购买方名称&开票月份组合'\n"
+
"FROM view_invoice_info"
)
List
<
Map
<
String
,
Object
>>
selectInvoiceInfoAsMap
();
@Select
(
"select \n"
+
"contractNo as '合同号',\n"
+
"contractName as '合同名称',\n"
+
"customerName as '客户名称',\n"
+
"customerNo as '客户编码',\n"
+
"division as '事业部',\n"
+
"newLine as '事业部条线',\n"
+
"incomeBelong as '业务收入归属部门',\n"
+
"contractStatus as '合同状态'\n"
+
"FROM view_contract_info"
)
List
<
Map
<
String
,
Object
>>
selectContractInfoAsMap
();
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/service/EkpAlertTableService.java
View file @
424c60b0
...
...
@@ -30,6 +30,6 @@ public interface EkpAlertTableService extends IService<EkpAlertTable> {
void
pushBudgetAlertInfoTomanager
(
int
type
);
void
tesxWxExcelApi
();
//
void tesxWxExcelApi();
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/service/QwExcelApiService.java
0 → 100644
View file @
424c60b0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
ekp
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.ekp.entity.EkpInvoiceInfo
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Author fxj
* @Date 2025/9/26
* @Description
* @Version 1.0
*/
public
interface
QwExcelApiService
extends
IService
<
EkpInvoiceInfo
>
{
void
tesxWxExcelApi
();
/**
* @Author fxj
* @Description 获取所有发票池信息
* @Date 16:09 2025/9/26
* @Param
* @return
**/
public
List
<
Map
<
String
,
Object
>>
getInvoiceList
();
/**
* @Author fxj
* @Description 获取所有合同数据
* @Date 16:09 2025/9/26
* @Param
* @return
**/
public
List
<
Map
<
String
,
Object
>>
getContractList
();
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/service/impl/EkpAlertTableServiceImpl.java
View file @
424c60b0
...
...
@@ -309,7 +309,7 @@ public class EkpAlertTableServiceImpl extends ServiceImpl<EkpAlertTableMapper, E
return
false
;
}
@Override
//
@Override
public
void
tesxWxExcelApi
()
{
/*RestTemplate restTemplate = new RestTemplate();
String accessToken = wxConfig.getAccessToken(restTemplate);
...
...
@@ -328,7 +328,7 @@ public class EkpAlertTableServiceImpl extends ServiceImpl<EkpAlertTableMapper, E
ResponseEntity<String> response = restTemplate.postForEntity(createDocUrl,requestEntity, String.class);*/
//smartSheetManager.test(wxConfig);
debugService
.
debugInsertIssue
(
wxConfig
);
//
debugService.debugInsertIssue(wxConfig);
}
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/service/impl/QwExce/QwExcelApiServiceImpl.java
0 → 100644
View file @
424c60b0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
ekp
.
service
.
impl
.
QwExce
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.ekp.config.WxConfig
;
import
com.yifu.cloud.plus.v1.ekp.entity.EkpBankAtta
;
import
com.yifu.cloud.plus.v1.ekp.entity.EkpInvoiceInfo
;
import
com.yifu.cloud.plus.v1.ekp.mapper.EkpBankAttaMapper
;
import
com.yifu.cloud.plus.v1.ekp.mapper.QwExcelApiMapper
;
import
com.yifu.cloud.plus.v1.ekp.service.QwExcelApiService
;
import
com.yifu.cloud.plus.v1.ekp.util.SmartSheetDebugService
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Author fxj
* @Date 2025/9/26
* @Description
* @Version 1.0
*/
@Log4j2
@Service
public
class
QwExcelApiServiceImpl
extends
ServiceImpl
<
QwExcelApiMapper
,
EkpInvoiceInfo
>
implements
QwExcelApiService
{
@Autowired
private
SmartSheetDebugService
debugService
;
@Autowired
private
WxConfig
wxConfig
;
@Override
public
void
tesxWxExcelApi
()
{
List
<
Map
<
String
,
Object
>>
records
=
baseMapper
.
selectInvoiceInfoAsMap
();
debugService
.
debugInsertIssue
(
wxConfig
,
records
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
getInvoiceList
()
{
return
baseMapper
.
selectInvoiceInfoAsMap
();
}
@Override
public
List
<
Map
<
String
,
Object
>>
getContractList
()
{
return
baseMapper
.
selectContractInfoAsMap
();
}
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/util/SmartSheetDebugService.java
View file @
424c60b0
...
...
@@ -3,6 +3,8 @@ package com.yifu.cloud.plus.v1.ekp.util;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yifu.cloud.plus.v1.ekp.config.WxConfig
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -17,6 +19,7 @@ import java.util.Map;
* @Description
* @Version 1.0
*/
@Log4j2
@Service
public
class
SmartSheetDebugService
{
...
...
@@ -27,113 +30,51 @@ public class SmartSheetDebugService {
* 调试企业微信智能表格记录添加问题
*
*/
public
void
debugInsertIssue
(
WxConfig
wxConfig
)
{
public
void
debugInsertIssue
(
WxConfig
wxConfig
,
List
<
Map
<
String
,
Object
>>
records
)
{
if
(
Common
.
isEmpty
(
records
)){
log
.
info
(
"数据为空"
);
return
;
}
String
corpId
=
"wwbcb090af0dfe50e5"
;
// HR审批应用 agentid: 1000009,corpSecret:R0nKkvsY-oF41fuQvUXZ-kFG3_g_Ce0bpZt6mByx524
String
corpSecret
=
"16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9Np"
;
String
docId
=
"dcTSMCj4lWV9MEP7lquZacOY8WS4g-iHxP_jVYA02tdYwb2YYc3BpDR8NrFWkEngHUg8abET4eTIpo9Zv-571NEA"
;
String
sheetId
=
"q979lj"
;
System
.
out
.
println
(
"=== 开始调试企业微信智能表格记录添加问题 ==="
);
log
.
info
(
"=== 开始调试企业微信智能表格记录添加问题 ==="
);
// 1. 获取并打印表格字段信息
System
.
out
.
println
(
"=== 表格字段信息 ==="
);
log
.
info
(
"=== 表格字段信息 ==="
);
List
<
WeComSmartSheetDebugger
.
FieldInfo
>
fields
=
debugger
.
getSheetFields
(
wxConfig
,
corpId
,
corpSecret
,
docId
,
sheetId
);
if
(
fields
.
isEmpty
())
{
System
.
out
.
println
(
"未能获取到表格字段信息,请检查参数是否正确"
);
log
.
info
(
"未能获取到表格字段信息,请检查参数是否正确"
);
return
;
}
for
(
WeComSmartSheetDebugger
.
FieldInfo
field
:
fields
)
{
System
.
out
.
println
(
"字段ID: "
+
field
.
getFieldId
()
+
log
.
info
(
"字段ID: "
+
field
.
getFieldId
()
+
", 字段标题: '"
+
field
.
getTitle
()
+
"'"
+
", 字段类型: "
+
field
.
getType
());
}
// 创建数据
List
<
Map
<
String
,
Object
>>
records
=
new
ArrayList
<>();
// 第一条记录
Map
<
String
,
Object
>
record1
=
new
HashMap
<>();
record1
.
put
(
"姓名"
,
"文本内容1"
);
record1
.
put
(
"部门"
,
"文本内容2"
);
record1
.
put
(
"年龄"
,
"文本内容3"
);
records
.
add
(
record1
);
// 第二条记录
Map
<
String
,
Object
>
record2
=
new
HashMap
<>();
record2
.
put
(
"姓名"
,
"文本内容1"
);
record2
.
put
(
"部门"
,
"文本内容2"
);
record2
.
put
(
"年龄"
,
"文本内容3"
);
records
.
add
(
record2
);
/* // 2. 准备要插入的数据(示例数据,请根据实际情况修改)
List<Map<String, String>> records = new ArrayList<>();
Map<String, Object> record = new HashMap<>();
Map<String, Object> values = new HashMap<>();
List<Map<String, String>> fieldContent = new ArrayList<>();
Map<String, String> textContent = new HashMap<>();
textContent.put("type", "text");
textContent.put("text", "张三");
fieldContent.add(textContent);
textContent = new HashMap<>();
textContent.put("type", "text");
textContent.put("text", "李四");
fieldContent.add(textContent);
// 注意:这里的字段名称必须与表格中的完全一致(包括大小写和空格)
values.put("姓名", fieldContent);
fieldContent = new ArrayList<>();
record = new HashMap<>();
values = new HashMap<>();
textContent = new HashMap<>();
textContent.put("type", "text");
textContent.put("text", "技术部");
fieldContent.add(textContent);
textContent = new HashMap<>();
textContent.put("type", "text");
textContent.put("text", "产品部");
fieldContent.add(textContent);
values.put("部门", fieldContent);
record.put("values", values);
records.add(record);*/
/*fieldContent = new ArrayList<>();
record = new HashMap<>();
values = new HashMap<>();
textContent = new HashMap<>();
textContent.put("type", "text");
textContent.put("text", "技术部");
fieldContent.add(textContent);
textContent = new HashMap<>();
textContent.put("type", "text");
textContent.put("text", "产品部");
fieldContent.add(textContent);
values.put("部门", fieldContent);
record.put("values", values);
records.add(record);*/
// 3. 验证字段匹配性
System
.
out
.
println
(
"\n=== 字段匹配性验证 ==="
);
log
.
info
(
"\n=== 字段匹配性验证 ==="
);
List
<
String
>
mismatches
=
debugger
.
validateFields
(
wxConfig
,
corpId
,
corpSecret
,
docId
,
sheetId
,
records
);
if
(
mismatches
.
isEmpty
())
{
System
.
out
.
println
(
"所有字段都匹配"
);
log
.
info
(
"所有字段都匹配"
);
}
else
{
System
.
out
.
println
(
"以下字段不匹配:"
);
log
.
info
(
"以下字段不匹配:"
);
for
(
String
mismatch
:
mismatches
)
{
System
.
out
.
println
(
"- "
+
mismatch
);
log
.
info
(
"- "
+
mismatch
);
}
System
.
out
.
println
(
"请根据以上信息修正数据后重试"
);
log
.
info
(
"请根据以上信息修正数据后重试"
);
return
;
}
// 4. 测试插入数据并查看详细响应
System
.
out
.
println
(
"\n=== 测试数据插入 ==="
);
log
.
info
(
"\n=== 测试数据插入 ==="
);
String
response
=
debugger
.
testInsertData
(
wxConfig
,
corpId
,
corpSecret
,
docId
,
sheetId
,
records
);
System
.
out
.
println
(
"API响应: "
+
response
);
log
.
info
(
"API响应: "
+
response
);
System
.
out
.
println
(
"\n=== 调试完成 ==="
);
log
.
info
(
"\n=== 调试完成 ==="
);
}
}
\ No newline at end of file
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/util/WeComSmartSheetDebugger.java
View file @
424c60b0
...
...
@@ -59,7 +59,7 @@ public class WeComSmartSheetDebugger {
try
{
RestTemplate
restTemplate
=
new
RestTemplate
();
// 1. 获取access_token
String
accessToken
=
wxConfig
.
getAccessToken
(
restTemplate
);
//getAccessToken(corpId, corpSecret
);
String
accessToken
=
getAccessToken
(
corpId
,
corpSecret
);
//wxConfig.getAccessToken(restTemplate
);
if
(
accessToken
==
null
||
accessToken
.
isEmpty
())
{
System
.
err
.
println
(
"获取access_token失败"
);
return
fieldInfos
;
...
...
@@ -141,7 +141,7 @@ public class WeComSmartSheetDebugger {
try
{
RestTemplate
restTemplate
=
new
RestTemplate
();
// 1. 获取access_token
String
accessToken
=
wxConfig
.
getAccessToken
(
restTemplate
);
//getAccessToken(corpId, corpSecret
);
String
accessToken
=
getAccessToken
(
corpId
,
corpSecret
);
//wxConfig.getAccessToken(restTemplate
);
if
(
accessToken
==
null
||
accessToken
.
isEmpty
())
{
return
"获取access_token失败"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment