test(controller): 添加通过身份证号拉取用户信息的测试用例

添加测试用例验证CabinetController中通过身份证号拉取用户信息的功能
```

```msg
refactor(approval): 优化退货审批服务的商品更新逻辑

将审批商品表的批量更新操作从审批通过方法移动到更合适的位置,避免重复更新
移除审批商品数量重置为0的不必要操作
This commit is contained in:
dzq 2025-06-20 08:41:26 +08:00
parent f2eef230da
commit 2ca926771c
2 changed files with 12 additions and 6 deletions

View File

@ -4,6 +4,8 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.agileboot.common.constant.OpenApiConstants; import com.agileboot.common.constant.OpenApiConstants;
import com.agileboot.common.core.dto.ResponseDTO; import com.agileboot.common.core.dto.ResponseDTO;
import com.agileboot.domain.ab98.api.Ab98ApiUtil;
import com.agileboot.domain.ab98.api.Ab98UserDto;
import com.agileboot.domain.shop.payment.SignUtils; import com.agileboot.domain.shop.payment.SignUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.Test; import org.junit.Test;
@ -44,4 +46,11 @@ public class CabinetControllerTest {
// 5. 验证响应 // 5. 验证响应
System.out.println("Response: " + res); System.out.println("Response: " + res);
} }
@Test
public void testPullUserInfoByIdnum() {
String IdNum = "452526196206215829";
Ab98UserDto ab98UserDto = Ab98ApiUtil.pullUserInfoByIdnum("wxshop", "34164e41f0c6694be6bbbba0dc50c14a", IdNum);
log.info("ab98UserDto:{}", JSONUtil.toJsonStr(ab98UserDto));
}
} }

View File

@ -425,6 +425,9 @@ public class ReturnApprovalApplicationService {
model.setStatus(4); // 2表示审核通过状态 model.setStatus(4); // 2表示审核通过状态
model.updateById(); model.updateById();
// 批量更新审批商品表
approvalGoodsList.forEach(ApprovalGoodsEntity::updateById);
// 批量插入审批商品格口关联表 // 批量插入审批商品格口关联表
approvalGoodsCellService.saveBatch(addApprovalGoodsCellList); approvalGoodsCellService.saveBatch(addApprovalGoodsCellList);
} }
@ -450,9 +453,6 @@ public class ReturnApprovalApplicationService {
if (approvalGoodsList == null || approvalGoodsList.isEmpty()) { if (approvalGoodsList == null || approvalGoodsList.isEmpty()) {
throw new RuntimeException("未找到关联的订单商品"); throw new RuntimeException("未找到关联的订单商品");
} }
approvalGoodsList.forEach(approvalGoods -> {
approvalGoods.setApprovalQuantity(0);
});
List<ApprovalGoodsCellEntity> approvalGoodsCellEntities = approvalGoodsCellService.selectByApprovalId(model.getApprovalId()); List<ApprovalGoodsCellEntity> approvalGoodsCellEntities = approvalGoodsCellService.selectByApprovalId(model.getApprovalId());
@ -521,9 +521,6 @@ public class ReturnApprovalApplicationService {
// 批量更新格口库存 // 批量更新格口库存
cabinetCellList.forEach(CabinetCellEntity::updateById); cabinetCellList.forEach(CabinetCellEntity::updateById);
// 批量更新审批商品表
approvalGoodsList.forEach(ApprovalGoodsEntity::updateById);
} }