Merge remote-tracking branch 'origin/master'

20230922-ljl-fixBug
daixiaogang 1 year ago
commit e5c0df0b2f

@ -5,7 +5,7 @@ curl --location --request POST 'localhost:8080/base/cloud/spi' \
--data-raw '{
"appId":"7264840234423027259",
"authId":"4463798",
"method":"getProductInfoByProductId",
"method":"testSpi",
"data":"{\"productIds\":[682805686164],\"pageSize\":\"20\"}"
}'

@ -1,47 +1,45 @@
package com.ms.api;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.ItemDTO;
import com.ms.api.tool.DsJsonRequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
@ExtensionService("testSpi")
@Slf4j
public class TestSpiService extends SPIBaseService implements ExtensionServiceHandler<ItemDTO, JSONObject> {
@Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate;
public class TestSpiService implements ExtensionServiceHandler<ItemDTO, Ret> {
@Override
public BaseResponse<JSONObject> handle(BaseRequest<ItemDTO> req) {
initHandle(req);
getAuthCode();
String res = null;
HashMap<String, Object> params = new HashMap<>();
params.put("platformItemId", 1);
params.put("sourceItemId", 33);
params.put("authCode", authCode);
try {
res = dsJsonRequestTemplate.execute("/micro_move/add_platform_item_to_source_item_relation", params);
log.info(res);
} catch (Exception e) {
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {
String resourceFileName = "/getProductCatTree.txt"; // 注意路径的开头是一个斜杠
String lines = null;
try (InputStream is = InputStream.class.getResourceAsStream(resourceFileName);
BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
lines = lines + line;
}
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
return R.ok(JSON.parseObject(res));
Map<String, Object> result = new HashMap<>();
result.put("line", lines);
return R.ok(Ret.success(result));
}
}

@ -679,11 +679,13 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
return new HashMap<>();
}
StringBuilder where = new StringBuilder();
if (ObjectUtil.isNotEmpty(filter.getPurchaseStartTime())) {
where.append(String.format(" and purchase_order_start_time >= '%s'", DateUtil.formatDateTime(filter.getPurchaseStartTime())));
}
if (ObjectUtil.isNotEmpty(filter.getPurchaseEndTime())) {
where.append(String.format(" and purchase_order_start_time <= '%s'", DateUtil.formatDateTime(filter.getPurchaseEndTime())));
if (ObjectUtil.isNotEmpty(filter)) {
if (ObjectUtil.isNotEmpty(filter.getPurchaseStartTime())) {
where.append(String.format(" and purchase_order_start_time >= '%s'", DateUtil.formatDateTime(filter.getPurchaseStartTime())));
}
if (ObjectUtil.isNotEmpty(filter.getPurchaseEndTime())) {
where.append(String.format(" and purchase_order_start_time <= '%s'", DateUtil.formatDateTime(filter.getPurchaseEndTime())));
}
}
List<PurchaseOrderBO> purchaseOrders = purchaseOrderMapper.selectPurchaseOrders(shopIds, orderIds, StatusConst.normal, where.toString());
if (ObjectUtil.isEmpty(purchaseOrders)) {

@ -30,7 +30,7 @@ import java.util.regex.Pattern;
*/
@ExtensionService("getProductInfoByProductId")
@Slf4j
public class getProductInfoByProductId extends SPIBaseService implements ExtensionServiceHandler<GetProductInfoRequestDTO, Ret> {
public class GetProductInfoByProductId extends SPIBaseService implements ExtensionServiceHandler<GetProductInfoRequestDTO, Ret> {
@Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate;

@ -87,7 +87,7 @@ public class RsyncDdOrdersAndPurchaseOrdersService extends SPIBaseService implem
}
}
Map<String, List<RsyncDdOrdersAndPurchaseOrderDTO>> retMap = new HashMap();
Map<String, List<RsyncDdOrdersAndPurchaseOrderDTO>> purchaseOrderListMap = new HashMap();
if (!StringUtils.isEmpty(orderIdsStr)) {
List<String> shopIds = new ArrayList<>();
shopIds.add(shopId.toString());
@ -113,17 +113,19 @@ public class RsyncDdOrdersAndPurchaseOrdersService extends SPIBaseService implem
}
}
retOrder.setItems(itemList);
if (retMap.containsKey(orderId)) {
retMap.get(orderId).add(retOrder);
if (purchaseOrderListMap.containsKey(orderId)) {
purchaseOrderListMap.get(orderId).add(retOrder);
} else {
List<RsyncDdOrdersAndPurchaseOrderDTO> newList = new ArrayList<>();
newList.add(retOrder);
retMap.put(orderId, newList);
purchaseOrderListMap.put(orderId, newList);
}
}
}
}
Map retMap = new HashMap();
retMap.put("rsyncPurchaseOrderInfo", purchaseOrderListMap);
return R.ok(Ret.success(retMap));
} catch (Exception e) {
log.error("同步分销采购单失败,原因:" + e.getMessage());

@ -402,7 +402,7 @@
<include refid="Base_Column_List" />
from op_order
where order_id in
<foreach collection="orderIds" item="orderId" index="index" open="(" close=")" separator=",">
<foreach collection="list" item="orderId" index="index" open="(" close=")" separator=",">
#{orderId}
</foreach>
</select>

Loading…
Cancel
Save