Authored by chenchao

spli buttont value 4 every order

... ... @@ -17,6 +17,7 @@ import org.slf4j.Logger;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
... ... @@ -57,11 +58,14 @@ public abstract class AbsOrderViewService {
getLogger().warn("in formatButtons error buyerOrder {} buttons {}", buyerOrder, buttons, ex);
}
}
//must clone deeply ,or one application process share the same objects
List<ButtonShowBo> buttonsClone = new ArrayList<>(buttons.size());
for(ButtonShowBo buttonShowBo : buttons){
buttonShowBo.setConfirmTips(formatconfirmTips(bpcr, orderStatusCode, buttonShowBo.getConfirmTips()));
ButtonShowBo copy = buttonShowBo.deepClone();
copy.setConfirmTips(formatconfirmTips(bpcr, orderStatusCode, copy.getConfirmTips()));
buttonsClone.add(copy);
}
return buttons;
return buttonsClone;
}
String formatconfirmTips(BuyerPenaltyCalResult bpcr,int orderStatusCode, String temp){
... ...
package com.yohoufo.order.bo;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.order.BaseTest;
import org.junit.Test;
import java.util.List;
/**
* Created by chao.chen on 2019/1/18.
*/
public class ButtonShowBoTest extends BaseTest {
@Test
public void testClone(){
List<ButtonShowBo> buttonShowBos = OrderStatus.HAS_PAYED.getListButtons(TabType.BUY);
for (ButtonShowBo bsb : buttonShowBos){
ButtonShowBo cbsb = bsb.deepClone();
System.out.println("bsb hashcode :"+ System.identityHashCode(bsb) + " toString:" + bsb
+ "\n cbsb hashcode:" + System.identityHashCode(cbsb) + ",toString :" + cbsb +"\n");
}
}
}
... ...