概述
/**
* 尚未发货
*
* @param oid
* @param parameters
* @param model
* @param principal
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping("listOrderReadySendByOid")
public ActionResult listOrderReadySendByOid(@RequestParam("oid") Integer oid, @RequestParam Map<String, String> parameters, Map<String, Object> model, Principal principal) {
try {
Map<String, Object> map = new HashMap<String, Object>();
List<EsComOrderDetails> detailsAjaxByOid = esComOrderDetailsService.listEsComOrderDetailsByOid(oid);// 订单详情列表
List<EsComOrderSendDetails> sendDetailsByOid = esComOrderSendDetailsService.listOrderSendDetailsByOid(oid);// 已发货列表
int b = detailsAjaxByOid.size();
for (int i = 0; i < b; i++) {
int a = Integer.parseInt(detailsAjaxByOid.get(i).getAmount());
for (int k = 0; k < a - 1; k++) {
detailsAjaxByOid.add(detailsAjaxByOid.get(i));
}
}
for (int j = 0; j < sendDetailsByOid.size(); j++) {
for (int i = 0; i < detailsAjaxByOid.size(); i++) {
if (detailsAjaxByOid.size() > 0) {
String orderDetailEN = detailsAjaxByOid.get(i).getEquipmentNo();
String orderSendDetailEN = sendDetailsByOid.get(j).getFequipmentNo();
if (StringUtils.equals(orderDetailEN, orderSendDetailEN)) {
detailsAjaxByOid.remove(detailsAjaxByOid.get(i));
}
}
}
if (detailsAjaxByOid.size() == 0) {
break;
}
}
if (detailsAjaxByOid.size() > 0) {
Set<EsComOrderDetails> uniqueSet = new HashSet(detailsAjaxByOid);
for (EsComOrderDetails esComOrderDetails : uniqueSet) {
esComOrderDetails.setUnit(Collections.frequency(detailsAjaxByOid, esComOrderDetails) + "");
}
for (EsComOrderDetails esComOrderDetails : detailsAjaxByOid) {
String Freserv1 = esComOrderDetails.getFreserv1();
if (StringUtils.equals(Freserv1, "1")) {
esComOrderDetails.setFreserv1("正常");
} else if (StringUtils.equals(Freserv1, "2")) {
esComOrderDetails.setFreserv1("缺货");
}
}
HashSet set = new HashSet(detailsAjaxByOid);
detailsAjaxByOid.clear();
detailsAjaxByOid.addAll(set);
map.put("listOrderReadySendDetails", detailsAjaxByOid);
}
return ActionResult.Succeed(map);
} catch (Exception e) {
logger.warn("查询出现问题!", e);
return ActionResult.Failed(e);
}
}
最后
以上就是外向大树为你收集整理的List集合去重,记录重复个数,保留重复项为一条数据的全部内容,希望文章能够帮你解决List集合去重,记录重复个数,保留重复项为一条数据所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复