Commit 93794d7c by 胡敬轩

爱马哥低碳活动 活动结束即可删除此代码

parent a1f4e4da
......@@ -28,6 +28,7 @@ import cn.freemud.service.thirdparty.SvcTransactionClient;
import cn.freemud.service.universal.factory.CreateOrderServiceFactory;
import cn.freemud.utils.RedisUtil;
import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSONObject;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
import com.freemud.api.assortment.datamanager.enums.IappIdType;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
......@@ -42,6 +43,7 @@ import com.freemud.application.sdk.api.ordercenter.enums.MarketTypeEnum;
import com.freemud.application.sdk.api.ordercenter.enums.NewOrderStatus;
import com.freemud.application.sdk.api.ordercenter.enums.PayChannelType;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderPayItemResp;
import com.freemud.application.sdk.api.service.EmailAlertService;
import com.freemud.sdk.api.assortment.order.util.LockUtils;
import com.google.gson.Gson;
import org.apache.commons.collections4.CollectionUtils;
......@@ -164,6 +166,8 @@ public class OrderAdapterServiceImpl {
private SvcTransactionClient svcTransactionClient;
@Autowired
private EcologyProgramApplicationClient ecologyProgramApplicationClient;
@Autowired
private EmailAlertService emailAlertService;
//获取下单实现对象
private OrderFactoryService getCreateOrderBean(AssortmentCustomerInfoVo assortmentCustomerInfoVo,CreateOrderVo createOrderVo){
......@@ -490,6 +494,7 @@ public class OrderAdapterServiceImpl {
*/
private void sendLowCarbonToWeixin(PaysuccessNoticeMessage message,OrderBeanV1 orderBean){
ApiLog.printLog("sendLowCarbonToWeixin",message,orderBean,null);
BaseResponse response = null;
try {
//先判断有没有微信支付
List<OrderPayItemResp> orderPayItem = orderBean.getOrderPayItem();
......@@ -512,10 +517,15 @@ public class OrderAdapterServiceImpl {
request.setOpenId(message.getOpenid());
request.setTransactionId(message.getThirdPartTradeNo());
request.setMiniAppId(orderBean.getAppId());
ecologyProgramApplicationClient.reportActivityBehaviors(request);
response = ecologyProgramApplicationClient.reportActivityBehaviors(request);
if (!Objects.equals(response.getCode(), "100")) {
emailAlertService.sendEmailAlert("低碳活动上报失败", String.format("request:%s \r\nresponse:%s \r\norderNo:%s", JSONObject.toJSONString(request), JSONObject.toJSONString(response), orderBean.getOid()));
ApiLog.printLog("sendLowCarbonToWeixin error "+orderBean.getOid(), message,request,response);
}
}
}catch (Exception e){
ErrorLog.printErrorLog("sendLowCarbonToWeixin ","/ecology/micro-program/low-carbon-action/activities/behaviors-report",orderBean,e);
emailAlertService.sendEmailAlert("低碳活动上报异常", String.format("request:%s \r\nresponse:%s \r\norderNo:%s", JSONObject.toJSONString(message), JSONObject.toJSONString(response),orderBean.getOid()));
ErrorLog.printErrorLog("sendLowCarbonToWeixin exception","/ecology/micro-program/low-carbon-action/activities/behaviors-report",orderBean,e);
}
}
private String getActivityId(String partnerId){
......@@ -534,7 +544,27 @@ public class OrderAdapterServiceImpl {
private boolean isGoodInActivity(String partnerId,List<ProductBeanV1> productList){
List<String> partnerList = Arrays.asList(weixinPayGoods.split(","));
if(CollectionUtils.isNotEmpty(partnerList) && CollectionUtils.isNotEmpty(productList)){
return productList.stream().anyMatch(productBeanV1 -> partnerList.contains(partnerId+"@"+(StringUtils.isBlank(productBeanV1.getSpecification())?productBeanV1.getProductId():productBeanV1.getSpecification())));
return productList.stream().anyMatch(productBeanV1 -> {
boolean mainProduct = partnerList.contains(partnerId+"@"+(StringUtils.isBlank(productBeanV1.getSpecification())?productBeanV1.getProductId():productBeanV1.getSpecification()));
if(mainProduct){
return true;
}
if(CollectionUtils.isNotEmpty(productBeanV1.getSendProduct())){
boolean sendProduct = productBeanV1.getSendProduct().stream().anyMatch(send->partnerList.contains(partnerId+"@"+(StringUtils.isBlank(send.getSpecification())?send.getProductId():send.getSpecification())));
if(sendProduct){
return true;
}
}
if(CollectionUtils.isNotEmpty(productBeanV1.getComboProduct())){
boolean comboProduct = productBeanV1.getComboProduct().stream().anyMatch(combo->partnerList.contains(partnerId+"@"+(StringUtils.isBlank(combo.getSpecification())?combo.getProductId():combo.getSpecification())));
if(comboProduct){
return true;
}
}
return false;
});
}
return false;
}
......
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