Commit da5b0dee by 叶立庆

Merge branch 'v5.8.8' into 'master'

上线合并

See merge request !12
2 parents 957d1297 c2769cff
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</parent> </parent>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-financial-api</artifactId> <artifactId>rpc-dj-financial-api</artifactId>
<version>5.8.6-SNAPSHOT</version> <version>5.8.8-SNAPSHOT</version>
<name>rpc-dj-financial-api</name> <name>rpc-dj-financial-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.dj.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.dj.remote</deploy.scanPackage>
......
...@@ -89,6 +89,9 @@ public class NbCbBatchTransferParamDTO implements Serializable { ...@@ -89,6 +89,9 @@ public class NbCbBatchTransferParamDTO implements Serializable {
@ApiModelProperty(notes = "主体类型") @ApiModelProperty(notes = "主体类型")
private Integer custType; private Integer custType;
@ApiModelProperty(notes = "企微名称 1-广联数科 2-NJ企微 3-优加智汇 4-深圳广联数科")
private Byte wechatType;
@ApiModelProperty(notes = "审批编号") @ApiModelProperty(notes = "审批编号")
private String spNo; private String spNo;
} }
...@@ -17,7 +17,11 @@ public enum OaApplyTransferWechatTypeEnum { ...@@ -17,7 +17,11 @@ public enum OaApplyTransferWechatTypeEnum {
* NJ企微 * NJ企微
*/ */
NJ((byte)2,"NJ企微"), NJ((byte)2,"NJ企微"),
YJZH((byte)3,"优加智汇") YJZH((byte)3,"优加智汇"),
/**
* 深圳广联数科
*/
SZGLSK((byte)4,"深圳广联数科"),
; ;
private Byte value; private Byte value;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</parent> </parent>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-financial</artifactId> <artifactId>rpc-dj-financial</artifactId>
<version>5.8.6-SNAPSHOT</version> <version>5.8.8-SNAPSHOT</version>
<name>rpc-dj-financial</name> <name>rpc-dj-financial</name>
<packaging>war</packaging> <packaging>war</packaging>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-financial-api</artifactId> <artifactId>rpc-dj-financial-api</artifactId>
<version>5.8.6-SNAPSHOT</version> <version>5.8.8-SNAPSHOT</version>
</dependency> </dependency>
<!-- RAR解压依赖 --> <!-- RAR解压依赖 -->
......
...@@ -6,9 +6,12 @@ import cn.com.glsx.dj.financial.enums.BatchTransferSourceEnum; ...@@ -6,9 +6,12 @@ import cn.com.glsx.dj.financial.enums.BatchTransferSourceEnum;
import cn.com.glsx.dj.financial.enums.NbCbCustEnum; import cn.com.glsx.dj.financial.enums.NbCbCustEnum;
import cn.com.glsx.dj.financial.enums.QWApprovalOrderStatusEnum; import cn.com.glsx.dj.financial.enums.QWApprovalOrderStatusEnum;
import cn.com.glsx.dj.financial.manager.QWManager; import cn.com.glsx.dj.financial.manager.QWManager;
import cn.com.glsx.dj.financial.dto.OaApplyBatchTransferDTO;
import cn.com.glsx.dj.financial.mapper.ApprovalRecordsMapper; import cn.com.glsx.dj.financial.mapper.ApprovalRecordsMapper;
import cn.com.glsx.dj.financial.mapper.ApprovalTemplateConfigMapper; import cn.com.glsx.dj.financial.mapper.ApprovalTemplateConfigMapper;
import cn.com.glsx.dj.financial.mapper.OaApplyBatchTransferMapper;
import cn.com.glsx.dj.financial.model.ApprovalRecords; import cn.com.glsx.dj.financial.model.ApprovalRecords;
import cn.com.glsx.dj.financial.model.OaApplyBatchTransfer;
import cn.com.glsx.dj.financial.model.ApprovalTemplateConfig; import cn.com.glsx.dj.financial.model.ApprovalTemplateConfig;
import cn.com.glsx.dj.financial.model.EnterpriseBankAccount; import cn.com.glsx.dj.financial.model.EnterpriseBankAccount;
import cn.com.glsx.dj.financial.model.qw.CallbackData; import cn.com.glsx.dj.financial.model.qw.CallbackData;
...@@ -55,6 +58,9 @@ public class ThirdPartyNiBoBatchStrategy implements ThirdPartyStrategy{ ...@@ -55,6 +58,9 @@ public class ThirdPartyNiBoBatchStrategy implements ThirdPartyStrategy{
private ApprovalTemplateConfigMapper approvalTemplateConfigMapper; private ApprovalTemplateConfigMapper approvalTemplateConfigMapper;
@Autowired @Autowired
private OaApplyBatchTransferMapper oaApplyBatchTransferMapper;
@Autowired
private MerchantCorpConfigService merchantCorpConfigService; private MerchantCorpConfigService merchantCorpConfigService;
@Override @Override
...@@ -145,6 +151,16 @@ public class ThirdPartyNiBoBatchStrategy implements ThirdPartyStrategy{ ...@@ -145,6 +151,16 @@ public class ThirdPartyNiBoBatchStrategy implements ThirdPartyStrategy{
//batchTransferParam.setDjSerialNo(approvalRecord.getSpNo()); //batchTransferParam.setDjSerialNo(approvalRecord.getSpNo());
batchTransferParam.setDjSerialNo(approvalRecord.getMerchantSpNo()); batchTransferParam.setDjSerialNo(approvalRecord.getMerchantSpNo());
//按 merchantSpNo 反查 OA 申请记录,取企微名称(wechatType),用于区分同主体下的不同付款账户
String merchantSpNo = approvalRecord.getMerchantSpNo();
if (StringUtils.isNotBlank(merchantSpNo)) {
OaApplyBatchTransferDTO oaQueryParam = new OaApplyBatchTransferDTO();
oaQueryParam.setMerchantSpNoList(Collections.singletonList(merchantSpNo));
List<OaApplyBatchTransfer> oaApplyList = oaApplyBatchTransferMapper.listSimple(oaQueryParam);
if (oaApplyList != null && !oaApplyList.isEmpty() && oaApplyList.get(0).getWechatType() != null) {
batchTransferParam.setWechatType(oaApplyList.get(0).getWechatType());
}
}
batchTransferParam.setBusinessCode("nis_batch_transfer"); batchTransferParam.setBusinessCode("nis_batch_transfer");
batchTransferParam.setPaymentMethod(approvalRecord.getPaymentMethod()); batchTransferParam.setPaymentMethod(approvalRecord.getPaymentMethod());
log.info("custId:{},bankSummary:{},batchTransferParam:{}",custId,bankSummary,batchTransferParam); log.info("custId:{},bankSummary:{},batchTransferParam:{}",custId,bankSummary,batchTransferParam);
......
...@@ -425,8 +425,14 @@ public class NbCbBatchTransferService { ...@@ -425,8 +425,14 @@ public class NbCbBatchTransferService {
transferParam.setPayName(env.getProperty("second.hand.car.default.yj.pay.name", "深圳市优加智汇科技有限公司")); transferParam.setPayName(env.getProperty("second.hand.car.default.yj.pay.name", "深圳市优加智汇科技有限公司"));
transferParam.setPayAcc(env.getProperty("second.hand.car.default.yj.bank.acc", "86041110001342705")); transferParam.setPayAcc(env.getProperty("second.hand.car.default.yj.bank.acc", "86041110001342705"));
}else if (NbCbCustEnum.GL_CUST.getCustType().equals(transferParam.getCustType())){ }else if (NbCbCustEnum.GL_CUST.getCustType().equals(transferParam.getCustType())){
transferParam.setPayName(env.getProperty("second.hand.car.default.gl.pay.name", "惠州广联数科科技有限公司")); //同为广联主体,深圳广联数科(wechatType=4)使用独立付款账户,其余沿用惠州广联数科
transferParam.setPayAcc(env.getProperty("second.hand.car.default.gl.bank.acc", "86031110001897460")); if (Objects.equals(transferParam.getWechatType(), OaApplyTransferWechatTypeEnum.SZGLSK.getValue())) {
transferParam.setPayName(env.getProperty("second.hand.car.default.szgl.pay.name", "深圳广联数科科技有限公司"));
transferParam.setPayAcc(env.getProperty("second.hand.car.default.szgl.bank.acc", "73160122000277314"));
} else {
transferParam.setPayName(env.getProperty("second.hand.car.default.gl.pay.name", "惠州广联数科科技有限公司"));
transferParam.setPayAcc(env.getProperty("second.hand.car.default.gl.bank.acc", "86031110001897460"));
}
} }
} }
......
...@@ -488,6 +488,9 @@ public class OaApplyBatchTransferService { ...@@ -488,6 +488,9 @@ public class OaApplyBatchTransferService {
if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.GLSK.getValue())) { if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.GLSK.getValue())) {
qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.merchant.id"); qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.merchant.id");
} }
if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.SZGLSK.getValue())) {
qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.szglsk.merchant.id");
}
if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.YJZH.getValue())) { if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.YJZH.getValue())) {
qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.yjzh.merchant.id"); qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.yjzh.merchant.id");
} }
......
...@@ -153,7 +153,7 @@ public class OaApplyTransferService { ...@@ -153,7 +153,7 @@ public class OaApplyTransferService {
List<DjContractApproveRequest.ApplyInfo> applyInfoList = null; List<DjContractApproveRequest.ApplyInfo> applyInfoList = null;
request.setTemplateEnum(WorkWechatApproveTemplateEnum.getByValue(record.getOaTemplateType())); request.setTemplateEnum(WorkWechatApproveTemplateEnum.getByValue(record.getOaTemplateType()));
if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.GLSK.getValue())) { if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.GLSK.getValue()) || Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.SZGLSK.getValue())) {
applyInfoList = buildSaasBusinessPaymentApplyInfo(record, djContractApproveResponse); applyInfoList = buildSaasBusinessPaymentApplyInfo(record, djContractApproveResponse);
} }
if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.NJ.getValue())) { if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.NJ.getValue())) {
...@@ -718,6 +718,9 @@ public class OaApplyTransferService { ...@@ -718,6 +718,9 @@ public class OaApplyTransferService {
if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.GLSK.getValue())) { if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.GLSK.getValue())) {
qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.merchant.id"); qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.merchant.id");
} }
if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.SZGLSK.getValue())) {
qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.szglsk.merchant.id");
}
if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.NJ.getValue())) { if (Objects.equals(wechatType, OaApplyTransferWechatTypeEnum.NJ.getValue())) {
qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.nj.merchant.id"); qwMerchantId = OrePropertyConfigurer.getInteger("dj.work.wechat.access.nj.merchant.id");
} }
......
  • @wangxw1
    commented
    Master

    你好 。我是本次的代码评审工程师,以下是对该代码变更的审查意见:

    一、关键问题与优化建议

    1. 数据库交互逻辑潜在的 NullPointerException 风险
    • 问题描述:在 ThirdPartyNiBoBatchStrategy.java 第 162 行, 通过 oaApplyBatchTransferMapper.listSimple(oaQueryParam) 查询记录后,未对 oaApplyList. get(0) 的字段属性进行判空,直接访问 getWechatType()。
      • 影响分析 :若数据库中查出的记录 wechatType 字段本身为空(DB层未加 NOT NULL 限制),则在调用 get(0).getWechatType() 时若内部属性未赋值,虽不会 直接 NPE,但后续业务逻辑依赖此值可能导致非预期的判断(如 Objects.equals(null, ... ) 永远为 false)。建议增加显式的非空校验以提高健壮性。
      • 优化建议:增加 对 getWechatType() 的判空保护,确保业务逻辑使用兜底默认值或跳过处理。
    1. 配置项依赖的硬编码风险

      • 问题描述:在 NbCbBatchTransferService. java 和 OaApplyBatchTransferService.java 中,新增了多个 OrePropertyConfigurer.getInteger 或 env .getProperty 调用。这些配置项(如 second.hand.car.default.szgl.pay.name )分散在代码中,一旦缺失配置,env.getProperty 可能返回 null,导致程序执行 异常。
      • 影响分析:配置缺失会导致支付信息计算错误,直接影响资金结算的 准确性。
      • 优化建议:检查 PropertyConfigurer 的调用,确保相关配置在 nacos/properties 配置文件中已同步更新;或使用 Environment.getRequiredProperty 确保核心配置项缺失时 能快速失败(Fail-Fast)。
    2. 枚举扩展的完备性与维护性


      • 问题描述:在 OaApplyTransferService.java 和 OaApplyBatchTransferService. java 中,使用了大量 if (Objects.equals(wechatType, ...)) 来匹配 wechatType。随着 枚举项增加(如 SZGLSK),代码中充斥着类似的 if-else 分支。
      • 影响 分析:违反了开闭原则(Open-Closed Principle),逻辑分散且易遗漏。

      • 优化建议:建议将 qwMerchantId 等逻辑提取到 OaApplyTransferWechatTypeEnum 枚 举本身中,通过枚举属性直接映射配置 Key 或 MerchantID,消除业务类中的冗余判断。

    二、

    评分明细

    1. 功能实现的正确性与健壮性(35/40分):逻辑 扩展覆盖了新增主体,但 ThirdPartyNiBoBatchStrategy 中的查询处理缺乏对返回结果的防御性编程 。
    2. 安全性与潜在风险(28/30分):无明显的 SQL 注入风险,涉及 金额处理的逻辑较敏感,需依赖外部配置的正确性。
    3. 最佳实践与可 维护性(15/20分):业务代码中新增多处重复的 if-else 分支,可读性和可维护性有优化空间,建议通过策略模式或枚举增强改善。
    4. ** 性能与资源利用(5/5分)**:性能影响极小,无资源浪费。
    5. 提交信息质量(4/5分):提交信息清晰,但合并请求描述略显单薄,建议规范 化。

    总分:87分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!