Commit 968f6e69 by 刘鹏

fix: IM模块 确认订单,收款问题修复

parent 4dc68055
...@@ -10,7 +10,7 @@ ext { ...@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03", "m-fm" : "0.0.30.03",
"m-user" : "0.0.61.31", "m-user" : "0.0.61.31",
"m-home" : "0.0.22.61", "m-home" : "0.0.22.61",
"m-im" : "0.0.19.00", "m-im" : "0.0.19.01",
"m-dynamic" : "0.0.7.22", "m-dynamic" : "0.0.7.22",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
...@@ -93,7 +93,7 @@ ext { ...@@ -93,7 +93,7 @@ ext {
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.31", "m-user" : "0.0.61.31",
"m-home" : "0.0.22.61", "m-home" : "0.0.22.61",
"m-im" : "0.0.19.00", "m-im" : "0.0.19.01",
"m-dynamic" : "0.0.7.22", "m-dynamic" : "0.0.7.22",
"m-article" : "0.0.0.6", "m-article" : "0.0.0.6",
......
...@@ -11,22 +11,18 @@ public class CustomAttachReceivedMoney extends CustomAttachment { ...@@ -11,22 +11,18 @@ public class CustomAttachReceivedMoney extends CustomAttachment {
private static final String KEY_TITLE="title"; private static final String KEY_TITLE="title";
private static final String KEY_NUM = "num"; private static final String KEY_NUM = "num";
private static final String KEY_ORPAY = "orPay"; private static final String KEY_ORPAY = "orPay";
private static final String ISNEWORDER = "isNewOrder";
private static final String KEY_ORDERID="orderid"; private static final String KEY_ORDERID="orderid";
private String num = "";//订单金额 private String num = "";//订单金额
private String title = "";//订单标题题 private String title = "";//订单标题题
private int orPay;//支付状态 0未支付1已支付 private int orPay;//支付状态 0未支付1已支付
private String orderid = "";//订单id private String orderid = "";//订单id
private Boolean isNewOrder = false;//是否是新订单
public CustomAttachReceivedMoney() { public CustomAttachReceivedMoney() {
super(CustomAttachmentType.RECEIVEDMONEY); super(CustomAttachmentType.RECEIVEDMONEY);
} }
public CustomAttachReceivedMoney(String num, String title, int orPay, String orderId) {
super(CustomAttachmentType.RECEIVEDMONEY);
this.num = num;
this.title = title;
this.orPay = orPay;
this.orderid = orderId;
}
@Override @Override
protected void parseData(JSONObject data) { protected void parseData(JSONObject data) {
...@@ -34,6 +30,7 @@ public class CustomAttachReceivedMoney extends CustomAttachment { ...@@ -34,6 +30,7 @@ public class CustomAttachReceivedMoney extends CustomAttachment {
this.title=data.getString(KEY_TITLE); this.title=data.getString(KEY_TITLE);
this.num=data.getString(KEY_NUM); this.num=data.getString(KEY_NUM);
this.orPay=data.getInteger(KEY_ORPAY); this.orPay=data.getInteger(KEY_ORPAY);
this.isNewOrder=data.getBoolean(ISNEWORDER);
} }
@Override @Override
...@@ -43,6 +40,7 @@ public class CustomAttachReceivedMoney extends CustomAttachment { ...@@ -43,6 +40,7 @@ public class CustomAttachReceivedMoney extends CustomAttachment {
data.put(KEY_TITLE,title); data.put(KEY_TITLE,title);
data.put(KEY_NUM,num); data.put(KEY_NUM,num);
data.put(KEY_ORPAY,orPay); data.put(KEY_ORPAY,orPay);
data.put(ISNEWORDER,isNewOrder);
return data; return data;
} }
...@@ -76,4 +74,13 @@ public class CustomAttachReceivedMoney extends CustomAttachment { ...@@ -76,4 +74,13 @@ public class CustomAttachReceivedMoney extends CustomAttachment {
public void setOrderId(String orderId) { public void setOrderId(String orderId) {
this.orderid = orderId; this.orderid = orderId;
} }
public Boolean getNewOrder() {
return isNewOrder;
}
public void setNewOrder(Boolean newOrder) {
isNewOrder = newOrder;
}
} }
...@@ -123,7 +123,7 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase { ...@@ -123,7 +123,7 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase {
//确认接口 //确认接口
ToastUtil.toastShort(context, "发送中..."); ToastUtil.toastShort(context, "发送中...");
String str = new Gson().toJson(new OrderStatusBean(serviceId != null ? serviceId : orderId, String.valueOf(flag))); String str = new Gson().toJson(new OrderStatusBean(serviceId != null ? serviceId : orderId, "3"));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str); RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str);
Disposable subscribe = ImRetrofitApi.Companion.getImRetrofitApi().standardOrderServiceOperation(body) Disposable subscribe = ImRetrofitApi.Companion.getImRetrofitApi().standardOrderServiceOperation(body)
...@@ -201,7 +201,7 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase { ...@@ -201,7 +201,7 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase {
message.setLocalExtension(map); message.setLocalExtension(map);
NIMClient.getService(MsgService.class).updateIMMessage(message); NIMClient.getService(MsgService.class).updateIMMessage(message);
//同时更新历史同订单未确认的消息状态 //同时更新历史同订单未确认的消息状态
NIMClient.getService(MsgService.class).queryMessageList(message.getFromAccount(), SessionTypeEnum.P2P, 0, 100).setCallback(new RequestCallback<List<IMMessage>>() { NIMClient.getService(MsgService.class).queryMessageList(message.getSessionId(), SessionTypeEnum.P2P, 0, 100).setCallback(new RequestCallback<List<IMMessage>>() {
@Override @Override
public void onSuccess(List<IMMessage> param) { public void onSuccess(List<IMMessage> param) {
if (param != null && param.size() > 0) { if (param != null && param.size() > 0) {
...@@ -212,11 +212,20 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase { ...@@ -212,11 +212,20 @@ public class MsgViewHolderConfirmOrder extends MsgViewHolderBase {
if (customAttachConsultSubScript.orderId.equals(orderId)) { if (customAttachConsultSubScript.orderId.equals(orderId)) {
//修改历史消息状态为已失效 //修改历史消息状态为已失效
Map map1 = msg.getLocalExtension(); Map map1 = msg.getLocalExtension();
if (map1 == null) { if (map1==null){
map1 = new HashMap(); map1 = new HashMap();
map1.put("isExpired", true); map1.put("isExpired",true);
msg.setLocalExtension(map1); msg.setLocalExtension(map1);
NIMClient.getService(MsgService.class).updateIMMessage(msg); NIMClient.getService(MsgService.class).updateIMMessage(msg);
//通知ui刷新
getMsgAdapter().updateItemAtLocalExtension(msg);
}else{
map1 = new HashMap();
map1.put("isExpired",true);
msg.setLocalExtension(map1);
NIMClient.getService(MsgService.class).updateIMMessage(msg);
//通知ui刷新
getMsgAdapter().updateItemAtLocalExtension(msg);
} }
} }
} }
......
...@@ -193,7 +193,7 @@ public class MsgViewHolderOrderAlreadyDone extends MsgViewHolderBase { ...@@ -193,7 +193,7 @@ public class MsgViewHolderOrderAlreadyDone extends MsgViewHolderBase {
message.setLocalExtension(map); message.setLocalExtension(map);
NIMClient.getService(MsgService.class).updateIMMessage(message); NIMClient.getService(MsgService.class).updateIMMessage(message);
//同时更新历史同订单未确认的消息状态 //同时更新历史同订单未确认的消息状态
NIMClient.getService(MsgService.class).queryMessageList(message.getFromAccount(), SessionTypeEnum.P2P, 0, 100).setCallback(new RequestCallback<List<IMMessage>>() { NIMClient.getService(MsgService.class).queryMessageList(message.getSessionId(), SessionTypeEnum.P2P, 0, 100).setCallback(new RequestCallback<List<IMMessage>>() {
@Override @Override
public void onSuccess(List<IMMessage> param) { public void onSuccess(List<IMMessage> param) {
if (param != null && param.size() > 0) { if (param != null && param.size() > 0) {
...@@ -204,11 +204,20 @@ public class MsgViewHolderOrderAlreadyDone extends MsgViewHolderBase { ...@@ -204,11 +204,20 @@ public class MsgViewHolderOrderAlreadyDone extends MsgViewHolderBase {
if (customAttachConsultSubScript.orderId.equals(orderId)) { if (customAttachConsultSubScript.orderId.equals(orderId)) {
//修改历史消息状态为已失效 //修改历史消息状态为已失效
Map map1 = msg.getLocalExtension(); Map map1 = msg.getLocalExtension();
if (map1 == null) { if (map1==null){
map1 = new HashMap(); map1 = new HashMap();
map1.put("isExpired", true); map1.put("isExpired",true);
msg.setLocalExtension(map1); msg.setLocalExtension(map1);
NIMClient.getService(MsgService.class).updateIMMessage(msg); NIMClient.getService(MsgService.class).updateIMMessage(msg);
//通知ui刷新
getMsgAdapter().updateItemAtLocalExtension(msg);
}else{
map1 = new HashMap();
map1.put("isExpired",true);
msg.setLocalExtension(map1);
NIMClient.getService(MsgService.class).updateIMMessage(msg);
//通知ui刷新
getMsgAdapter().updateItemAtLocalExtension(msg);
} }
} }
} }
......
...@@ -8,6 +8,7 @@ import com.ydl.webview.H5Params; ...@@ -8,6 +8,7 @@ import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity; import com.ydl.webview.NewH5Activity;
import com.ydl.ydlcommon.base.config.HttpConfig; import com.ydl.ydlcommon.base.config.HttpConfig;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.session.extension.CustomAttachReceivedMoney; import com.yidianling.im.session.extension.CustomAttachReceivedMoney;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter; import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase; import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
...@@ -24,9 +25,10 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase { ...@@ -24,9 +25,10 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase {
private String title;//订单标题题 private String title;//订单标题题
private int orPay;//支付状态 0未支付1已支付 private int orPay;//支付状态 0未支付1已支付
private String orderid;//订单id private String orderid;//订单id
private Boolean isNewOrder;//是否是新订单
private View message_received; private View message_received;
private TextView tit,content; private TextView tit, content;
private ImageView img; private ImageView img;
public MsgViewHolderReceivedMoney(BaseMultiItemFetchLoadAdapter adapter) { public MsgViewHolderReceivedMoney(BaseMultiItemFetchLoadAdapter adapter) {
...@@ -41,7 +43,7 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase { ...@@ -41,7 +43,7 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase {
@Override @Override
protected void inflateContentView() { protected void inflateContentView() {
message_received=findViewById(R.id.message_received); message_received = findViewById(R.id.message_received);
tit = findViewById(R.id.packet_title); tit = findViewById(R.id.packet_title);
content = findViewById(R.id.text_content); content = findViewById(R.id.text_content);
img = findViewById(R.id.packte_im); img = findViewById(R.id.packte_im);
...@@ -49,20 +51,21 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase { ...@@ -49,20 +51,21 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase {
@Override @Override
protected void bindContentView() { protected void bindContentView() {
CustomAttachReceivedMoney customAttachReceivedMoney= (CustomAttachReceivedMoney) message.getAttachment(); CustomAttachReceivedMoney customAttachReceivedMoney = (CustomAttachReceivedMoney) message.getAttachment();
orderid=customAttachReceivedMoney.getOrderId(); orderid = customAttachReceivedMoney.getOrderId();
num = customAttachReceivedMoney.getNum(); num = customAttachReceivedMoney.getNum();
title = customAttachReceivedMoney.getTitle(); title = customAttachReceivedMoney.getTitle();
orPay = customAttachReceivedMoney.getOrPay(); orPay = customAttachReceivedMoney.getOrPay();
num = customAttachReceivedMoney.getNum(); num = customAttachReceivedMoney.getNum();
isNewOrder = customAttachReceivedMoney.getNewOrder();
if (title!=null)tit.setText(title); if (title != null) tit.setText(title);
if (orPay == 1) { if (orPay == 1) {
//支付成功 //支付成功
if (num!=null)content.setText("您支付了"+num+"元"); if (num != null) content.setText("您支付了" + num + "元");
img.setImageDrawable(view.getResources().getDrawable(R.mipmap.im_zhifu)); img.setImageDrawable(view.getResources().getDrawable(R.mipmap.im_zhifu));
}else{ } else {
if (num!=null)content.setText("您需要支付"+num+"元"); if (num != null) content.setText("您需要支付" + num + "元");
img.setImageDrawable(view.getResources().getDrawable(R.mipmap.im_weifu)); img.setImageDrawable(view.getResources().getDrawable(R.mipmap.im_weifu));
} }
...@@ -72,7 +75,13 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase { ...@@ -72,7 +75,13 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase {
@Override @Override
protected void onItemClick() { protected void onItemClick() {
if (isReceivedMessage()) { if (isReceivedMessage()) {
NewH5Activity.start(view.getContext(), new H5Params(HttpConfig.Companion.getH5_URL() + "receipt/order?oid=" + orderid, null)); if (isNewOrder) {
H5Params orderParams = new H5Params(
ImConstants.Companion.getORDER_DETAIL() + (orderid.isEmpty() ? "" : orderid), null);
NewH5Activity.start(context, orderParams);
} else {
NewH5Activity.start(view.getContext(), new H5Params(HttpConfig.Companion.getH5_URL() + "receipt/order?oid=" + orderid, null));
}
} }
} }
......
...@@ -247,4 +247,15 @@ public class MsgAdapter extends BaseMultiItemFetchLoadAdapter<IMMessage, BaseVie ...@@ -247,4 +247,15 @@ public class MsgAdapter extends BaseMultiItemFetchLoadAdapter<IMMessage, BaseVie
public Container getContainer() { public Container getContainer() {
return container; return container;
} }
//刷新某条消息的扩展字段
public void updateItemAtLocalExtension(IMMessage imMessage){
for (int i = getData().size()-1;i >0;i--) {
if (getData().get(i).isTheSame(imMessage)) {
getData().get(i).setLocalExtension(imMessage.getLocalExtension());
notifyItemChanged(i);
return;
}
}
}
} }
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