Merge branch 'dev' into feat/clearLogisticChannelName

pull/8040/head
Gauthier LO 2024-06-05 14:25:43 +02:00 committed by GitHub
commit a48458baeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 48 additions and 21 deletions

View File

@ -12,7 +12,7 @@ public class GetFulfillmentRequestBody extends ShopifyRequestBody {
public GetFulfillmentRequestBody(String sitePrefix, String platformOrderId, String shopToken) { public GetFulfillmentRequestBody(String sitePrefix, String platformOrderId, String shopToken) {
super(sitePrefix, shopToken); super(sitePrefix, shopToken);
this.platformOrderId = platformOrderId; this.platformOrderId = platformOrderId.split("_")[0];
} }
public GetFulfillmentRequestBody(PlatformOrderShopSync platformOrderShopSync) { public GetFulfillmentRequestBody(PlatformOrderShopSync platformOrderShopSync) {

View File

@ -16,10 +16,7 @@ import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -83,7 +80,7 @@ public class ShopifySyncJob implements Job {
GetFulfillmentRequest getFulfillmentRequest = new GetFulfillmentRequest(body); GetFulfillmentRequest getFulfillmentRequest = new GetFulfillmentRequest(body);
String responseStr = getFulfillmentRequest.rawSend().getBody(); String responseStr = getFulfillmentRequest.rawSend().getBody();
FulfillmentOrdersResponse response = mapper.readValue(responseStr, FulfillmentOrdersResponse.class); FulfillmentOrdersResponse response = mapper.readValue(responseStr, FulfillmentOrdersResponse.class);
fulfillmentOrders.add(response.getFulfillmentOrders().get(0)); fulfillmentOrders.addAll(response.getFulfillmentOrders());
success = true; success = true;
} catch (RuntimeException e) { } catch (RuntimeException e) {
log.error("Error communicating with ShopifyAPI", e); log.error("Error communicating with ShopifyAPI", e);
@ -109,6 +106,7 @@ public class ShopifySyncJob implements Job {
} }
log.info("{} fulfillment creation requests to be sent to ShopifyAPI", createFulfillmentRequests.size()); log.info("{} fulfillment creation requests to be sent to ShopifyAPI", createFulfillmentRequests.size());
Set<String> syncedPlatformOrderIds = new HashSet<>();
List<CompletableFuture<Boolean>> fulfillmentCreationFutures = createFulfillmentRequests.stream() List<CompletableFuture<Boolean>> fulfillmentCreationFutures = createFulfillmentRequests.stream()
.map(changeOrderRequestBody -> CompletableFuture.supplyAsync(() -> { .map(changeOrderRequestBody -> CompletableFuture.supplyAsync(() -> {
boolean success = false; boolean success = false;
@ -117,6 +115,9 @@ public class ShopifySyncJob implements Job {
String responseStr = createFulfillmentRequest.rawSend().getBody(); String responseStr = createFulfillmentRequest.rawSend().getBody();
FulfillmentCreationResponse response = mapper.readValue(responseStr, FulfillmentCreationResponse.class); FulfillmentCreationResponse response = mapper.readValue(responseStr, FulfillmentCreationResponse.class);
success = response.getFulfillment().isSuccess(); success = response.getFulfillment().isSuccess();
if (success) {
syncedPlatformOrderIds.add(response.getFulfillment().getOrderId());
}
} catch (RuntimeException e) { } catch (RuntimeException e) {
log.error("Error communicating with ShopifyAPI", e); log.error("Error communicating with ShopifyAPI", e);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
@ -128,5 +129,10 @@ public class ShopifySyncJob implements Job {
results = fulfillmentCreationFutures.stream().map(CompletableFuture::join).collect(Collectors.toList()); results = fulfillmentCreationFutures.stream().map(CompletableFuture::join).collect(Collectors.toList());
nbSuccesses = results.stream().filter(b -> b).count(); nbSuccesses = results.stream().filter(b -> b).count();
log.info("{}/{} fulfillment creation requests have succeeded.", nbSuccesses, createFulfillmentRequests.size()); log.info("{}/{} fulfillment creation requests have succeeded.", nbSuccesses, createFulfillmentRequests.size());
if (!syncedPlatformOrderIds.isEmpty()) {
platformOrderService.updateShopifySynced(syncedPlatformOrderIds);
log.info("Those orders have been marked as shopify synced : {} ", syncedPlatformOrderIds);
}
} }
} }

View File

@ -18,8 +18,8 @@ import java.util.Date;
/** /**
* @Description: * @Description:
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2024-01-25 * @Date: 2024-05-30
* @Version: V1.8 * @Version: V1.9
*/ */
@ApiModel(value = "platform_order对象", description = "平台订单表") @ApiModel(value = "platform_order对象", description = "平台订单表")
@Data @Data
@ -252,4 +252,11 @@ public class PlatformOrder implements Serializable {
@Excel(name = "个人税号", width = 15) @Excel(name = "个人税号", width = 15)
@ApiModelProperty(value = "个人税号") @ApiModelProperty(value = "个人税号")
private java.lang.String taxNumber; private java.lang.String taxNumber;
/**
* Shopify(1=0=)
*/
@Excel(name = "Shopify平台已同步(1=已同步0=未同步)", width = 15, dicCode = "yn")
@Dict(dicCode = "yn")
@ApiModelProperty(value = "Shopify平台已同步(1=已同步0=未同步)")
private java.lang.String shopifySynced;
} }

View File

@ -13,6 +13,7 @@ import org.jeecg.modules.business.vo.clientPlatformOrder.section.OrderQuantity;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -231,4 +232,5 @@ public interface PlatformOrderMapper extends BaseMapper<PlatformOrder> {
List<String> findReadyAbnormalOrders(@Param("skus") List<String> skus, @Param("shops") List<String> shops); List<String> findReadyAbnormalOrders(@Param("skus") List<String> skus, @Param("shops") List<String> shops);
List<String> findReadyAbnormalOrdersWithSkus(@Param("skus") List<String> skus); List<String> findReadyAbnormalOrdersWithSkus(@Param("skus") List<String> skus);
void updateShopifySynced(@Param("platformOrderIds") Collection<String> platformOrderIds);
} }

View File

@ -463,6 +463,7 @@
#{shop} #{shop}
</foreach> </foreach>
AND ready_for_shopify_sync = 1 AND ready_for_shopify_sync = 1
AND shopify_synced = 0
AND erp_status = 3 AND erp_status = 3
ORDER BY shipping_time; ORDER BY shipping_time;
</select> </select>
@ -1064,4 +1065,13 @@
AND poc.erp_status &lt;&gt; 5 AND poc.erp_status &lt;&gt; 5
AND poc.warehouse_name = '法国巴黎仓库-唯客路'; AND poc.warehouse_name = '法国巴黎仓库-唯客路';
</select> </select>
<update id="updateShopifySynced">
UPDATE platform_order
SET shopify_synced = 1
WHERE platform_order_id IN
<foreach collection="platformOrderIds" separator="," open="(" close=")" index="index" item="platformOrderId">
#{platformOrderId}
</foreach>
</update>
</mapper> </mapper>

View File

@ -255,4 +255,5 @@ public interface IPlatformOrderService extends IService<PlatformOrder> {
List<String> findReadyAbnormalOrders(List<String> skus, List<String> shops); List<String> findReadyAbnormalOrders(List<String> skus, List<String> shops);
List<String> findReadyAbnormalOrdersWithSkus(List<String> skus); List<String> findReadyAbnormalOrdersWithSkus(List<String> skus);
void updateShopifySynced(Collection<String> platformOrderIds);
} }

View File

@ -519,5 +519,9 @@ public class PlatformOrderServiceImpl extends ServiceImpl<PlatformOrderMapper, P
@Override @Override
public List<String> findReadyAbnormalOrdersWithSkus(List<String> skus) { public List<String> findReadyAbnormalOrdersWithSkus(List<String> skus) {
return platformOrderMap.findReadyAbnormalOrdersWithSkus(skus); return platformOrderMap.findReadyAbnormalOrdersWithSkus(skus);
@Override
public void updateShopifySynced(Collection<String> platformOrderIds) {
platformOrderMap.updateShopifySynced(platformOrderIds);
} }
} }

View File

@ -1,17 +1,14 @@
${AnsiColor.BRIGHT_BLUE} ${AnsiColor.BRIGHT_BLUE}
(_) | | | | _ _ _ _____ ______ ______
_ ___ ___ ___ __ _ ______| |__ ___ ___ | |_ | || || (_____) /\ /\ (_____ (_____ \
| |/ _ \/ _ \/ __/ _` |______| '_ \ / _ \ / _ \| __| | || || | _ / \ / \ _____) )____) )
| | __/ __/ (_| (_| | | |_) | (_) | (_) | |_ | ||_|| | | | / /\ \ / /\ \| ____/ ____/
| |\___|\___|\___\__, | |_.__/ \___/ \___/ \__| | |___| |_| |_| |__| | | |__| | | | |
_/ | __/ | \______(_____)______| |______|_| |_|
|__/ |___/
${AnsiColor.BRIGHT_GREEN} ${AnsiColor.BRIGHT_GREEN}
Jeecg Boot Version: 3.6.3 WIA APP Version: 2.2.0
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version} Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
产品官网: www.jeecg.com Website: www.wia-sourcing.com
版权所属: 北京国炬信息技术有限公司
公司官网: www.guojusoft.com
${AnsiColor.BLACK} ${AnsiColor.BLACK}

View File

@ -2,9 +2,9 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.jeecgframework.boot</groupId> <groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-parent</artifactId> <artifactId>jeecg-boot-parent</artifactId>
<version>3.6.3</version> <version>2.2.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>JEECG BOOT ${project.version}</name> <name>WIA APP ${project.version}</name>
<developers> <developers>
<developer> <developer>