| | |
| | | package com.yeshi.fanli.util.factory.shop;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.shop.BanLiShopOrderGoodsVO;
|
| | | import com.yeshi.fanli.vo.shop.BanLiShopOrderVO;
|
| | |
|
| | | public class BanLiShopOrderGoodsVOFactory {
|
| | |
|
| | | public static BanLiShopOrderVO create(BanLiShopOrder order) {
|
| | | BanLiShopOrderGoodsVO goodsVO = new BanLiShopOrderGoodsVO();
|
| | | goodsVO.setGoodsName(order.getOrderGoods().getGoodsName());
|
| | | if (order.getHongBaoPayment() != null && order.getMoneyPayment() != null) {
|
| | | goodsVO.setPayWay("现金+红包");
|
| | | goodsVO.setHongBao("¥" + order.getHongBaoPayment());
|
| | | goodsVO.setMoney("¥" + order.getMoneyPayment());
|
| | | } else if (order.getHongBaoPayment() != null) {
|
| | | goodsVO.setPayWay("仅红包");
|
| | | goodsVO.setHongBao("¥" + order.getHongBaoPayment());
|
| | | } else if (order.getMoneyPayment() != null) {
|
| | | goodsVO.setPayWay("仅现金");
|
| | | goodsVO.setMoney("¥" + order.getMoneyPayment());
|
| | | }
|
| | | goodsVO.setPicture(order.getOrderGoods().getPicture());
|
| | |
|
| | | BanLiShopOrderVO vo = new BanLiShopOrderVO();
|
| | |
|
| | | if (order.getChargeAccountType() != null) {
|
| | | vo.setChargeAccount(order.getChargeAccountType().getName() + order.getChargeAccount());
|
| | | }
|
| | |
|
| | | if (order.getSuccessTime() != null)
|
| | | vo.setChargeTime(TimeUtil.getGernalTime(order.getSuccessTime().getTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | |
|
| | | vo.setGoods(goodsVO);
|
| | | vo.setOrderId(order.getOrderNo());
|
| | | vo.setOrderTime(TimeUtil.getGernalTime(order.getCreateTime().getTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | | // 需要确定订单状态输出
|
| | | if (order.getState() == BanLiShopOrder.STATE_INVALID || order.getState() == BanLiShopOrder.STATE_NO_PAY) {
|
| | | vo.setState("未付款");
|
| | | vo.setStateColor("#e5005c");
|
| | | } else if (order.getState() == BanLiShopOrder.STATE_PART_PAY) {
|
| | | vo.setState("未实付");
|
| | | vo.setStateColor("#e5005c");
|
| | | } else if (order.getState() == BanLiShopOrder.STATE_SUCCESS) {
|
| | | vo.setState("充值成功");
|
| | | vo.setStateColor("#2FB102");
|
| | | } else if (order.getState() == BanLiShopOrder.STATE_REJECT
|
| | | || order.getState() == BanLiShopOrder.STATE_REJECT_REFUND_FAIL
|
| | | || order.getState() == BanLiShopOrder.STATE_REJECT_REFUND_PART_SUCCESS
|
| | | || order.getState() == BanLiShopOrder.STATE_REJECT_REFUND_SUCCESS) {// 拒绝了
|
| | | vo.setState("充值失败");
|
| | | vo.setStateColor("#e5005c");
|
| | | } else if (order.getState() == BanLiShopOrder.STATE_PAID) {
|
| | | vo.setState("审核中");
|
| | | vo.setStateColor("#777777");
|
| | | }
|
| | | vo.setStateDesc("实付款 ¥" + getPaidMoney(order));
|
| | |
|
| | | return vo;
|
| | | }
|
| | |
|
| | | private static String getPaidMoney(BanLiShopOrder order) {
|
| | | if (order.getMoneyPaymentState() == null || order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_NOPAY
|
| | | || order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_REFUND) {
|
| | | return "0.00";
|
| | | } else
|
| | | return order.getMoneyPayment().setScale(2).toString();
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.util.factory.shop; |
| | | |
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import com.yeshi.fanli.vo.shop.BanLiShopOrderGoodsVO; |
| | | import com.yeshi.fanli.vo.shop.BanLiShopOrderVO; |
| | | |
| | | public class BanLiShopOrderGoodsVOFactory { |
| | | |
| | | public static BanLiShopOrderVO create(BanLiShopOrder order) { |
| | | BanLiShopOrderGoodsVO goodsVO = new BanLiShopOrderGoodsVO(); |
| | | goodsVO.setGoodsName(order.getOrderGoods().getGoodsName()); |
| | | if (order.getHongBaoPayment() != null && order.getMoneyPayment() != null) { |
| | | goodsVO.setPayWay("现金+红包"); |
| | | goodsVO.setHongBao("¥" + order.getHongBaoPayment()); |
| | | goodsVO.setMoney("¥" + order.getMoneyPayment()); |
| | | } else if (order.getHongBaoPayment() != null) { |
| | | goodsVO.setPayWay("仅红包"); |
| | | goodsVO.setHongBao("¥" + order.getHongBaoPayment()); |
| | | } else if (order.getMoneyPayment() != null) { |
| | | goodsVO.setPayWay("仅现金"); |
| | | goodsVO.setMoney("¥" + order.getMoneyPayment()); |
| | | } |
| | | goodsVO.setPicture(order.getOrderGoods().getPicture()); |
| | | |
| | | BanLiShopOrderVO vo = new BanLiShopOrderVO(); |
| | | |
| | | if (order.getChargeAccountType() != null) { |
| | | vo.setChargeAccount(order.getChargeAccountType().getName() + order.getChargeAccount()); |
| | | } |
| | | |
| | | if (order.getSuccessTime() != null) |
| | | vo.setChargeTime(TimeUtil.getGernalTime(order.getSuccessTime().getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | vo.setGoods(goodsVO); |
| | | vo.setOrderId(order.getOrderNo()); |
| | | vo.setOrderTime(TimeUtil.getGernalTime(order.getCreateTime().getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | // 需要确定订单状态输出 |
| | | if (order.getState() == BanLiShopOrder.STATE_INVALID || order.getState() == BanLiShopOrder.STATE_NO_PAY) { |
| | | vo.setState("未付款"); |
| | | vo.setStateColor("#e5005c"); |
| | | } else if (order.getState() == BanLiShopOrder.STATE_PART_PAY) { |
| | | vo.setState("未实付"); |
| | | vo.setStateColor("#e5005c"); |
| | | } else if (order.getState() == BanLiShopOrder.STATE_SUCCESS) { |
| | | vo.setState("充值成功"); |
| | | vo.setStateColor("#2FB102"); |
| | | } else if (order.getState() == BanLiShopOrder.STATE_REJECT |
| | | || order.getState() == BanLiShopOrder.STATE_REJECT_REFUND_FAIL |
| | | || order.getState() == BanLiShopOrder.STATE_REJECT_REFUND_PART_SUCCESS |
| | | || order.getState() == BanLiShopOrder.STATE_REJECT_REFUND_SUCCESS) {// 拒绝了 |
| | | vo.setState("充值失败"); |
| | | vo.setStateColor("#e5005c"); |
| | | } else if (order.getState() == BanLiShopOrder.STATE_PAID) { |
| | | vo.setState("审核中"); |
| | | vo.setStateColor("#777777"); |
| | | } |
| | | vo.setStateDesc("实付款 ¥" + getPaidMoney(order)); |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | private static String getPaidMoney(BanLiShopOrder order) { |
| | | if (order.getMoneyPaymentState() == null || order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_NOPAY |
| | | || order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_REFUND) { |
| | | return "0.00"; |
| | | } else |
| | | return order.getMoneyPayment().setScale(2).toString(); |
| | | } |
| | | |
| | | } |