| | |
| | | package com.gs.xiaomi; |
| | | |
| | | import cn.hutool.crypto.digest.DigestUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.gs.xiaomi.dto.BCS101Request; |
| | |
| | | import com.gs.xiaomi.entity.DeliveryMain; |
| | | import com.gs.xiaomi.entity.SnListItem; |
| | | import com.gs.xiaomi.service.BCS101ApiService; |
| | | import com.gs.xiaomi.service.BCS101Service; |
| | | import com.gs.xiaomi.service.DeliveryMainService; |
| | | import com.gs.xiaomi.service.SnListItemService; |
| | | import com.gs.xiaomi.service.Xm104Service; |
| | |
| | | |
| | | @Autowired |
| | | private SnListItemService snListItemService; |
| | | |
| | | @Autowired |
| | | private BCS101Service bcs101Service; |
| | | |
| | | @Test |
| | | void contextLoads() throws Exception { |
| | |
| | | |
| | | // 转换DTO为Entity,并设置关联信息 |
| | | List<SnListItem> entityList = SnListItemConverter.toEntityList( |
| | | snList, |
| | | s.getId(), // deliveryMainId - 送货单主表ID |
| | | s.getZzasn() // zzasn - 送货单号 |
| | | snList, |
| | | s.getId(), // deliveryMainId - 送货单主表ID |
| | | s.getZzasn() // zzasn - 送货单号 |
| | | ); |
| | | |
| | | // 先删除该送货单已有的SN数据(避免重复) |
| | | snListItemService.lambdaUpdate() |
| | | .eq(SnListItem::getZzasn, s.getZzasn()) |
| | | .remove(); |
| | | .eq(SnListItem::getZzasn, s.getZzasn()) |
| | | .remove(); |
| | | |
| | | // 批量保存到数据库 |
| | | boolean saved = snListItemService.saveBatch(entityList); |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 测试BCS101数据同步 - 使用BCS101Service |
| | | * @param asn 送货单号 |
| | | * @throws Exception 异常 |
| | | */ |
| | | @Test |
| | | void testGetBCS101() throws Exception { |
| | | // 直接调用BCS101Service进行数据同步 |
| | | bcs101Service.syncBCS101DataByAsn("9316702418"); |
| | | } |
| | | } |