| | |
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.HashMap;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | public List<CommonOrderVO> listGroupOrderNoByUid(long start, int count, Long uid, Integer state,
|
| | | Integer type, String orderNo, String startTime,String endTime) throws CommonOrderException{
|
| | | return commonOrderMapper.listGroupOrderNoByUid(start, count, uid, state, type, orderNo, startTime, endTime);
|
| | | Integer type,Integer orderState, String orderNo, String startTime,String endTime, |
| | | Integer dateType) throws CommonOrderException{
|
| | | return commonOrderMapper.listGroupOrderNoByUid(start, count, uid, state, type, orderState,
|
| | | orderNo, startTime, endTime, dateType);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countGroupOrderNoByUid(Long uid,Integer state, Integer type, String orderNo,
|
| | | String startTime,String endTime) throws CommonOrderException{
|
| | | return commonOrderMapper.countGroupOrderNoByUid(uid, state, type, orderNo, startTime, endTime);
|
| | | public long countGroupOrderNoByUid(Long uid,Integer state, Integer type, Integer orderState, |
| | | String orderNo, String startTime,String endTime, Integer dateType) throws CommonOrderException{
|
| | | return commonOrderMapper.countGroupOrderNoByUid(uid, state, type, orderState, orderNo,
|
| | | startTime, endTime, dateType);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonOrderVO> getOrderByUid (Long page, Long uid, Integer state, Integer type,
|
| | | String orderNo, String startTime, String endTime) throws CommonOrderException {
|
| | | public List<CommonOrderVO> getOrderByUid (Integer page, Long uid, Integer state, Integer type,
|
| | | Integer orderState, String orderNo, String startTime, String endTime, Integer dateType) throws CommonOrderException {
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<CommonOrderVO> listOrder = listGroupOrderNoByUid((page - 1) * pageSize, pageSize, uid,
|
| | | state, type, orderNo, startTime, endTime);
|
| | | state, type, orderState, orderNo, startTime, endTime, dateType);
|
| | |
|
| | | // 订单信息为空
|
| | | if (listOrder == null || listOrder.size() == 0) {
|
| | |
| | | if (listGoods ==null || listGoods.size() == 0) {
|
| | | return listOrder;
|
| | | }
|
| | | |
| | | // 数据加工重新组织
|
| | | listDataFactory(listOrder, listGoods);
|
| | | |
| | | return listOrder;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public Map<String, BigDecimal> countOrderByHongBaoType(Long uid, Integer day) {
|
| | | return commonOrderMapper.countOrderByHongBaoType(uid, day);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countOrder(Long uid,Integer type, Integer day) {
|
| | | return commonOrderMapper.countBonusOrder(uid, type, day);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal countOrderMoney(Long uid, Integer type, Integer day) {
|
| | | return commonOrderMapper.countBonusOrderMoney(uid, type, day);
|
| | | }
|
| | | |
| | | @Override
|
| | | public Map<String, BigDecimal> countByUidAndOrderState(Long uid, Integer type, String startTime,
|
| | | String endTime, Integer day) {
|
| | | return commonOrderMapper.countByUidAndOrderState(uid, type, startTime, endTime, day);
|
| | | }
|
| | | |
| | | public void listDataFactory (List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods ) {
|
| | |
|
| | | /* 组合商品信息 */
|
| | | for (CommonOrderVO commonOrder: listGoods) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | commonGoodsVO.setActualCount(commonOrder.getTotalCount());
|
| | | commonGoodsVO.setActualPay(commonOrder.getTotalSettlement());
|
| | | Integer hongBaoType = order.getHongBaoType();
|
| | | // 邀请订单信息保护
|
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType) {
|
| | | Map<String, String> titleMap = new HashMap<String, String>();
|
| | | titleMap.put("content", "为保障用户隐私,商品信息已隐藏!");
|
| | | titleMap.put("fontColor", "#888888");
|
| | | titleMap.put("bottomColor", "#E9E9E9");
|
| | | commonGoodsVO.setTitle(null);
|
| | | commonGoodsVO.setGoodsTitle(titleMap);
|
| | | }
|
| | | |
| | | |
| | | commonGoodsVO.setActualCount(commonOrder.getTotalCount() + "件");
|
| | | String settlement = commonOrder.getTotalSettlement().setScale(2, BigDecimal.ROUND_DOWN).toString();
|
| | | commonGoodsVO.setActualPay("实付款:¥" + settlement);
|
| | |
|
| | | listOrderGoods.add(commonGoodsVO);
|
| | | |
| | | Integer orderType = commonOrder.getOrderType();
|
| | | if (orderType == null) {
|
| | | String shopType = commonGoodsVO.getShopType();
|
| | | if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) {
|
| | | commonOrder.setOrderType(1);
|
| | | } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) {
|
| | | commonOrder.setOrderType(2);
|
| | | } |
| | | }
|
| | |
|
| | | break;
|
| | | }
|
| | |
| | |
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | order.setDownTime(format.format(thirdCreateTime));
|
| | | order.setDownTime("下单时间:" + format.format(thirdCreateTime));
|
| | | }
|
| | |
|
| | | Date settleTime = order.getSettleTime();
|
| | | if (settleTime != null) {
|
| | | order.setReceiveTime(format.format(settleTime));
|
| | | order.setReceiveTime("收货时间:" + format.format(settleTime));
|
| | | }
|
| | | |
| | | Date accountTime = order.getAccountTime();
|
| | | if (accountTime != null) {
|
| | | order.setGetTime(formatday.format(accountTime));
|
| | | }
|
| | | |
| | | Date preAccountTime = order.getPreAccountTime();
|
| | | if (preAccountTime != null) {
|
| | | order.setPreGetTime(formatday.format(preAccountTime));
|
| | | }
|
| | | |
| | |
|
| | | /* 订单状态 转换处理*/
|
| | | String orderStateContent = "";
|
| | | Map<String, String> orderStateMap = new HashMap<String, String>();
|
| | | |
| | | Integer hongBaoState = order.getHongBaoState();
|
| | |
|
| | | Integer orderState = order.getState();
|
| | | if (CommonOrder.STATE_FK == orderState ) {
|
| | |
| | | } else if (CommonOrder.STATE_JS == orderState) {
|
| | | orderStateContent = "已收货";
|
| | | } else if (CommonOrder.STATE_SX == orderState) {
|
| | | orderStateContent = "已退款";
|
| | | orderStateContent = "未付款/已退款";
|
| | | } else if (CommonOrder.STATE_WQ == orderState) {
|
| | | orderStateContent = "已维权";
|
| | |
|
| | |
| | | List<TaoBaoWeiQuanOrder> listWQ =
|
| | | taoBaoWeiQuanOrderMapper.selectListByOrderIdAndState(order.getOrderNo(), "维权成功");
|
| | |
|
| | | boolean isPart = true;
|
| | | boolean isPart = false;// 默认失效
|
| | | |
| | | if (listWQ != null && listWQ.size() > 0) {
|
| | | BigDecimal fanTotalMoney = new BigDecimal(0);
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder: listWQ) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if (fanTotalMoney.compareTo(order.getHongBao()) >= 0) {
|
| | | isPart = false;
|
| | | if (fanTotalMoney.compareTo(order.getHongBao()) < 0) {
|
| | | isPart = true;
|
| | | }
|
| | | }
|
| | |
|
| | | if (isPart) {
|
| | | order.setHongBaoState(HongBaoV2.STATE_BUFENSHIXIAO); // 部分失效
|
| | | hongBaoState = HongBaoV2.STATE_BUFENSHIXIAO; // 部分失效
|
| | | } else {
|
| | | order.setHongBaoState(HongBaoV2.STATE_SHIXIAO); // 全部失效
|
| | | hongBaoState = HongBaoV2.STATE_SHIXIAO; // 全部失效
|
| | | }
|
| | | }
|
| | | orderStateMap.put("content", orderStateContent);
|
| | |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) {
|
| | | // 自购
|
| | | hongbaoInfo = "返利";
|
| | | order.setHongBaoType(1); |
| | | order.setOrderOrigin("1");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_FANLI);
|
| | | } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
|
| | | // 分享
|
| | | hongbaoInfo = "奖金";
|
| | | order.setHongBaoType(2); |
| | | order.setOrderOrigin("2");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_SHARE);
|
| | | } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_ERJI == hongBaoType) {
|
| | | // 邀请
|
| | | hongbaoInfo = "奖金";
|
| | | order.setHongBaoType(3); |
| | | order.setOrderOrigin("3");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_INVITE);
|
| | | }
|
| | |
|
| | |
|
| | | String hongBaoDate = null;
|
| | | String hongBaoState_Str = "";
|
| | | String hongbaoInfoFontColor = "#E5005C";
|
| | | |
| | | /* 红包状态 转换 */
|
| | | String stateContent = "";
|
| | | Map<String, String> accountState = new HashMap<String, String>();
|
| | | Integer hongBaoState = order.getHongBaoState();
|
| | | String stateFontColor = "#E5005C";
|
| | | Integer orderHongBaoState = null;
|
| | | |
| | | if (HongBaoV2.STATE_KELINGQU == hongBaoState || HongBaoV2.STATE_BUKELINGQU == hongBaoState) {
|
| | | orderHongBaoState = 1;
|
| | | stateContent = "未到账";
|
| | | hongBaoState_Str = "预估";
|
| | | hongbaoInfoFontColor = "#888888";
|
| | | |
| | | Date preAccountTime = order.getPreAccountTime();
|
| | | if (preAccountTime != null) {
|
| | | hongBaoDate = "预计到账时间:" + formatday.format(preAccountTime);
|
| | | }
|
| | | |
| | |
|
| | | } else if (HongBaoV2.STATE_YILINGQU == hongBaoState) {
|
| | | orderHongBaoState = 3;
|
| | | stateContent = "已到账";
|
| | | |
| | | Date accountTime = order.getAccountTime();
|
| | | if (accountTime != null) {
|
| | | hongBaoDate = "到账时间:" + formatday.format(accountTime);
|
| | | }
|
| | | |
| | | } else if (HongBaoV2.STATE_BUFENSHIXIAO == hongBaoState) {
|
| | | stateContent = "部分失效"; |
| | | stateContent = "部分失效"; |
| | | orderHongBaoState = 3;
|
| | | Date accountTime = order.getAccountTime();
|
| | | if (accountTime != null) {
|
| | | hongBaoDate = "到账时间:" + formatday.format(accountTime);
|
| | | }
|
| | | |
| | | } else if (HongBaoV2.STATE_SHIXIAO == hongBaoState) {
|
| | | stateContent = "已失效"; |
| | | orderHongBaoState = 4;
|
| | | stateContent = "已失效"; |
| | | hongbaoInfoFontColor = "#888888";
|
| | | }
|
| | | accountState.put("content", stateContent);
|
| | | accountState.put("fontColor", "#E5005C");
|
| | | order.setAccountState(accountState);
|
| | | order.setHongBaoState(orderHongBaoState);
|
| | | order.setHongBaoDate(hongBaoDate);
|
| | |
|
| | | |
| | | if ("奖金".equals(hongbaoInfo) && hongBaoState_Str.trim().length() > 0) {
|
| | | hongbaoInfo = hongBaoState_Str + hongbaoInfo;
|
| | | }
|
| | | Map<String, String> stateMap = new HashMap<String, String>();
|
| | | stateMap.put("content", stateContent);
|
| | | stateMap.put("fontColor", stateFontColor);
|
| | | order.setAccountState(stateMap);
|
| | | |
| | | hongbaoInfo = hongBaoState_Str + hongbaoInfo;
|
| | | |
| | | BigDecimal hongBao = order.getHongBao();
|
| | | if (hongBao == null) {
|
| | | hongBao = new BigDecimal(0);
|
| | | }
|
| | | Map<String, String> hongBaoMap = new HashMap<String, String>();
|
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao);
|
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor);
|
| | | order.setHongBaoInfo(hongBaoMap);
|
| | | |
| | | |
| | | }
|
| | | |
| | | |
| | | return listOrder;
|
| | | }
|
| | | |
| | | } |
| | |
|
| | | @Override
|
| | | public Map<String, BigDecimal> countOrderByHongBaoType(Long uid, Integer day) {
|
| | | return commonOrderMapper.countOrderByHongBaoType(uid, day);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countOrder(Long uid, Integer isToday) {
|
| | | return commonOrderMapper.countOrder(uid, isToday);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal countOrderMoney(Long uid, Integer isToday) {
|
| | | return commonOrderMapper.countOrderMoney(uid, isToday);
|
| | | }
|
| | | |
| | | @Override
|
| | | public Map<String, BigDecimal> countByUidAndOrderState(Long uid, Integer type, String startTime,String endTime) {
|
| | | return commonOrderMapper.countByUidAndOrderState(uid, type, startTime, endTime);
|
| | | }
|
| | | public List<CommonOrder> listBySourceTypeAndOrderId(int sourceType, String orderId) {
|
| | | |
| | | |
| | | |
| | | return null;
|
| | | } |
| | | }
|