GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 修复 WxMaExpressOrderCargo 字段类型以支持小数值 by Copilot · Pull Request #3802 · binarywang/WxJava

Conversation

Copilot AI commented Dec 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

微信官方 API 文档规定 cargo 对象中的 weight、space_x、space_y、space_z 字段类型为 number,支持小数值(如 1.2kg、20.0cm)。但原实现使用 Integer 类型,导致无法处理小数。

变更内容

  • WxMaExpressOrderCargo.java: 将以下字段类型从 Integer 改为 Double

    • weight - 货物总重量(单位:kg)
    • spaceLength (space_x) - 货物长度(单位:cm)
    • spaceWidth (space_y) - 货物宽度(单位:cm)
    • spaceHeight (space_z) - 货物高度(单位:cm)
  • WxMaExpressServiceImplTest.java: 更新测试用例使用小数值

示例

WxMaExpressOrderCargo cargo = new WxMaExpressOrderCargo();
cargo.setWeight(1.2);        // 支持小数,符合官方文档示例
cargo.setSpaceLength(20.0);
cargo.setSpaceWidth(15.0);
cargo.setSpaceHeight(10.0);

兼容性

向后兼容。整数值自动装箱为 Double(5 → 5.0),现有代码无需修改。

Original prompt

This section details on the original issue you should resolve

<issue_title>WxMaExpressOrderCargo 类中变量类型问题</issue_title>
<issue_description>WxMaExpressOrderCargo类中的weight,spaceLength,,spaceWidth 不支持小数

Image</issue_description>

Comments on the Issue (you are @copilot in this section)

@binarywang 原始问题来自:https://gitee.com/binary/weixin-java-tools/issues/IDBUKJ

Custom agent used: 全部用中文
需要用中文,包括PR标题和分析总结过程

  • Fixes WxMaExpressOrderCargo 类中变量类型问题 #3801

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Initial plan
ecd3e82
Copilot AI assigned Copilot and binarywang Dec 10, 2025
Copilot started work on behalf of binarywang December 10, 2025 02:05
View session
@binarywang
将 WxMaExpressOrderCargo 类中的 weight、spaceLength、spaceWidth、spaceHeight…
90c3d53
… 字段类型从 Integer 改为 Double 以支持小数值

Co-authored-by: binarywang <[email protected]>
Copilot AI changed the title [WIP] Fix variable type issues in WxMaExpressOrderCargo class 修复 WxMaExpressOrderCargo 字段类型以支持小数值 Dec 10, 2025
Copilot AI requested a review from binarywang December 10, 2025 02:11
Copilot finished work on behalf of binarywang December 10, 2025 02:11
@binarywang
binarywang marked this pull request as ready for review December 10, 2025 06:20
Copilot AI review requested due to automatic review settings December 10, 2025 06:20
Copilot started reviewing on behalf of binarywang December 10, 2025 06:20
View session
Copilot AI reviewed Dec 10, 2025
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

此 PR 修复了 WxMaExpressOrderCargo 类中的字段类型问题,使其符合微信官方 API 规范并支持小数值。原实现使用 Integer 类型存储重量和尺寸,无法处理诸如 1.2kg 或 20.5cm 等小数值,现已更正为 Double 类型。

核心变更

  • 将 4 个物理测量字段从 Integer 改为 Double:weight、spaceLength、spaceWidth、spaceHeight
  • 更新测试用例使用小数值验证新类型(1.2kg、10.0cm、20.0cm、15.0cm)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
WxMaExpressOrderCargo.java 将 weight、spaceLength、spaceWidth、spaceHeight 字段类型从 Integer 改为 Double 以支持小数值
WxMaExpressServiceImplTest.java 更新测试用例使用小数值(1.2、10.0、20.0、15.0)验证字段类型变更

审查结论:代码变更正确且完整,符合项目规范。类型变更向后兼容(整数值可自动装箱为 Double),测试覆盖充分,注解使用正确(@SerializedName 配置 snake_case),且遵循了现有的 Lombok 注解模式(@DaTa、@NoArgsConstructor、@AllArgsConstructor)。无需额外修改。

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@binarywang
binarywang merged commit d26172e into develop Dec 10, 2025
7 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@binarywang binarywang added this to the 4.8.0 milestone Dec 10, 2025
Copilot AI added a commit that referenced this pull request Dec 21, 2025
🎨 #3802 【小程序】修复 WxMaExpressOrderCargo 几个字段类型以支持小数值
9c9b8eb
@binarywang
binarywang deleted the copilot/fix-wxmaexpressordercargo-variables branch March 10, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@binarywang binarywang Awaiting requested review from binarywang

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@binarywang binarywang

Copilot code review Copilot

Labels

None yet

Projects

None yet

Milestone

4.8.0

Development

Successfully merging this pull request may close these issues.

WxMaExpressOrderCargo 类中变量类型问题

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@binarywang
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.