Commit e3c663d5 by 徐康

问题修复

parent 4f36a8af
......@@ -93,6 +93,7 @@ import com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest;
import com.freemud.application.sdk.api.storecenter.response.GetListByCodesResponse;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.freemud.application.sdk.api.util.Md5Util;
import com.freemud.sdk.api.assortment.message.config.MessageOfficialRefundPushMqConfig;
import com.freemud.sdk.api.assortment.message.entity.MpTemplateMsg;
import com.freemud.sdk.api.assortment.message.entity.MpTemplateMsgDataValue;
......@@ -127,16 +128,21 @@ import ma.glasnost.orika.impl.DefaultMapperFactory;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.client.HttpClient;
import org.joda.time.DateTime;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......@@ -2541,6 +2547,20 @@ public class MCCafeOrderServiceImpl implements MCCafeOrderService {
}
McCafePushOrderDto mcCafePushOrderDto = convert2McCafePushOrderInfo(orderInfoReqs);
AppLogUtil.infoLog("订单推送入参: "+JSON.toJSONString(mcCafePushOrderDto),null,null);
String sign = getMcdOpenApiSign("",JSON.toJSONString(mcCafePushOrderDto),"",System.currentTimeMillis()+"","");
// RestTemplate client = new RestTemplate();
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(mediaType);
// headers.setContentType(mediaType);
// headers.setContentType(mediaType);
// headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);
// Gson gson = new Gson();
// String json = gson.toJson(map);
// HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
// ResponseEntity<String> responseEntity = client.exchange(url, HttpMethod.POST, requestEntity, String.class);
McCafePushOrderResponseDto responseDto = mcCafePushOrderClient.mcCafePushOrder(mcCafePushOrderDto);
PushMccafeOrder pushMccafeOrder = new PushMccafeOrder();
pushMccafeOrder.setOrderCode(orderInfoReqs.getOrderCode());
......@@ -2610,9 +2630,15 @@ public class MCCafeOrderServiceImpl implements MCCafeOrderService {
mcCafePushOrderDto.setStoreName(orderInfoReqs.getStoreName());
mcCafePushOrderDto.setBusinessDate(DateUtil.convert2String(new Date(Long.valueOf(orderInfoReqs.getCreateTime())), "yyyy-MM-dd"));
mcCafePushOrderDto.setTablewareInfo(Integer.valueOf(1).equals(orderExtInfoDto.getNeedTableware())?"01":"02");
if(orderInfoReqs.getOriginalAmount().intValue() >= orderInfoReqs.getActualPayAmount().intValue()) {
mcCafePushOrderDto.setTotalAmount(orderInfoReqs.getOriginalAmount().intValue());
mcCafePushOrderDto.setDiscountTotalAmount(orderInfoReqs.getOriginalAmount().subtract(orderInfoReqs.getActualPayAmount()).intValue());
mcCafePushOrderDto.setRealTotalAmount(orderInfoReqs.getActualPayAmount().intValue());
} else {
mcCafePushOrderDto.setTotalAmount(orderInfoReqs.getActualPayAmount().intValue());
mcCafePushOrderDto.setDiscountTotalAmount(0);
mcCafePushOrderDto.setRealTotalAmount(orderInfoReqs.getActualPayAmount().intValue());
}
Optional<OrderCostResp> optionalOrderCostResp = orderInfoReqs.getOrderCostDetailList().stream().filter(
o -> CostTypeEnum.DELIVERY_AMOUNT.getCode().equals(o.getCostType())).findFirst();
if(optionalOrderCostResp.isPresent()) {
......@@ -2896,6 +2922,12 @@ public class MCCafeOrderServiceImpl implements MCCafeOrderService {
}
}
public String getMcdOpenApiSign(String appId, String body, String merchantId, String timestamp, String key) throws UnsupportedEncodingException, NoSuchAlgorithmException {
String signStr = String.format("AppId=%s&Body=%s&MerchantId=%s&Timestamp=%s&key=%s", appId, body, merchantId, timestamp, key);
String sign = Md5Util.encoderToMd5(signStr).toUpperCase();
return sign;
}
public static void main(String[] args) {
System.out.println(DateUtil.convert2String(new Date(1631519403066l), "yyyy-MM-dd HH:mm:ss"));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment