e63fbe2f 刘嘉

菠萝派接口- 订单下载接口数据格式化

1 个父辈 7e1707c7
......@@ -34,7 +34,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.xml.bind.ValidationException;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -79,7 +81,7 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
List<Orders> ordersList = pineappleDao.getOrdersList(params);
GetOrderResponse response = new GetOrderResponse();
response.setNumTotalOrder(ordersList.size());
response.setOrders(null);
response.setOrders(findOrders(ordersList));
response.setCode(PineAppleConst.SUCCESS_CODE);
return response;
}
......@@ -121,9 +123,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
orderResponse.setTradeStatus(orderStatusEnum.getCode());
orderResponse.setTradeStatusDescription(orderStatusEnum.getMsg());
orderResponse.setPlatOrderNo(orders.getOrderSn());
orderResponse.setTradeStatus(orders.getOrderState().toString());
orderResponse.setTradeStatusDescription(orders.getRemark());
orderResponse.setTradeTime(orders.getCreateTime());
orderResponse.setTradeTime(this.buildDefaultSimpleDateFormat().format(orders.getCreateTime()));
orderResponse.setCountry("中国");
orderResponse.setProvince(orders.getRegionName1());
orderResponse.setCity(orders.getRegionName2());
......@@ -131,11 +132,28 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
orderResponse.setAddress(orders.getAddressInfo());
orderResponse.setPhone(orders.getMobile());
orderResponse.setMobile(orders.getMobile());
orderResponse.setPostFee(orders.getMoneyLogistics().toString());
orderResponse.setGoodsFee(orders.getMoneyProduct().toString());
orderResponse.setTotalMoney(orders.getMoneyOrder().toString());
orderResponse.setPayTime(orders.getPayTime());
orderResponse.setPostFee(this.convertAndCheckFreight(orders.getMoneyLogistics()));
orderResponse.setGoodsFee(this.convertAndCheckFreight(orders.getMoneyProduct()));
orderResponse.setTotalMoney(this.convertAndCheckFreight(orders.getMoneyOrder()));
orderResponse.setPayTime(this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));
orderResponse.setShouldPayType("银行收款");
orderResponse.setTown("");
orderResponse.setTaxAmount("");
orderResponse.setCommissionValue("");
orderResponse.setTariffAmount("");
orderResponse.setAddedValueAmount("");
orderResponse.setConsumptionDutyAmount("");
orderResponse.setSendStyle("");
orderResponse.setQq("");
orderResponse.setEmail("");
orderResponse.setInvoiceTitle("");
orderResponse.setTaxPayerIdent("");
orderResponse.setCodServiceFee("");
orderResponse.setCurrencyCode("");
orderResponse.setIdCard("");
orderResponse.setIdCardTrueName("");
orderResponse.setWhseCode("");
orderResponse.setIsHwgFlag("");
return orderResponse;
}
......@@ -152,8 +170,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
orderGoodResponse.setTradeGoodsName(ordersProduct.getProductName());
orderGoodResponse.setTradeGoodsSpec(ordersProduct.getSpecInfo());
orderGoodResponse.setGoodsCount(String.valueOf(ordersProduct.getNumber()));
orderGoodResponse.setPrice(String.valueOf(ordersProduct.getMoneyPrice()));
orderGoodResponse.setDiscountMoney(String.valueOf(ordersProduct.getMoneyActSingle()));
orderGoodResponse.setPrice(this.convertAndCheckFreight(ordersProduct.getMoneyPrice()));
orderGoodResponse.setDiscountMoney(this.convertAndCheckFreight(ordersProduct.getMoneyActSingle()));
orderGoodResponse.setTaxAmount("");
orderGoodResponse.setRefundStatus("");
orderGoodResponse.setStatus("");
orderGoodResponse.setRemark("");
return null;
}
......@@ -166,6 +188,15 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
return orderStatusEnum;
}
private SimpleDateFormat buildDefaultSimpleDateFormat() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf;
}
private String convertAndCheckFreight(BigDecimal money) {
return money.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
}
@Override
public String getHandleMethodName() {
return "Differ.JH.Business.GetOrder";
......