Authored by mali

Merge branch 'dev'

Conflicts:
	order/src/main/java/com/yohoufo/order/service/proxy/ProductProxyService.java
... ... @@ -9,6 +9,9 @@ import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohoufo.order.model.response.OrderListInfo;
import com.yohoufo.order.service.IBuyerOrderService;
import com.yohoufo.order.service.impl.SellerOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -19,7 +22,7 @@ import java.util.Objects;
@RestController
public class BuyerOrderController {
private final Logger LOG = LoggerFactory.getLogger(BuyerOrderController.class);
@Autowired
IBuyerOrderService buyerOrderService;
... ... @@ -119,12 +122,17 @@ public class BuyerOrderController {
@ResponseBody
public ApiResponse cancel(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.cancel in, orderCode is {}, uid is {}", orderCode, uid);
OrderRequest orderRequest = OrderRequest.builder()
.uid(uid)
.orderCode(orderCode)
.build();
buyerOrderService.cancel(orderRequest);
LOG.info("method ufo.buyer.cancel out, orderCode is {}, uid is {}", orderCode, uid);
return new ApiResponse.ApiResponseBuilder().code(200).message("取消成功").build();
}
... ... @@ -139,12 +147,16 @@ public class BuyerOrderController {
@ResponseBody
public ApiResponse confirm(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.confirm in, orderCode is {}, uid is {}", orderCode, uid);
OrderRequest orderRequest = OrderRequest.builder()
.uid(uid)
.orderCode(orderCode)
.build();
buyerOrderService.confirm(orderRequest);
LOG.info("method ufo.buyer.confirm out, orderCode is {}, uid is {}", orderCode, uid);
return new ApiResponse.ApiResponseBuilder().code(200).message("确认收货成功").build();
}
}
... ...
... ... @@ -126,11 +126,11 @@ public class AssetsService {
}
Integer key = (Integer)tmpMap.get("tradeType");
if(TradeType.goods_income.getCode()==key){
sum_goods_income.add((BigDecimal)tmpMap.get("allAmount"));
sum_goods_income = sum_goods_income.add((BigDecimal)tmpMap.get("allAmount"));
}
if(TradeType.compensateIncome.getCode()==key){
compensate_income.add((BigDecimal)tmpMap.get("allAmount"));
compensate_income = compensate_income.add((BigDecimal)tmpMap.get("allAmount"));
}
}
... ... @@ -145,11 +145,11 @@ public class AssetsService {
}
Integer key = (Integer)tmpMap.get("tradeType");
if(TradeType.goods_income.getCode()==key){
sum_goods_income.subtract((BigDecimal)tmpMap.get("allAmount"));
sum_goods_income = sum_goods_income.subtract((BigDecimal)tmpMap.get("allAmount"));
}
if(TradeType.compensateIncome.getCode()==key){
compensate_income.subtract((BigDecimal)tmpMap.get("allAmount"));
compensate_income = compensate_income.subtract((BigDecimal)tmpMap.get("allAmount"));
}
}
... ... @@ -157,11 +157,11 @@ public class AssetsService {
//TODO 内存中计算total
summary.setGoods_income(sum_goods_income);
summary.setGoodsIncome(String.valueOf(sum_goods_income));
summary.setGoodsIncome(sum_goods_income.setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString());
summary.setCompensate_income(compensate_income);
summary.setCompensateIncome(String.valueOf(compensate_income));
summary.setCompensateIncome(compensate_income.setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString());
summary.setTotal_income(sum_goods_income.add(compensate_income));
summary.setTotalIncome(String.valueOf(compensate_income));
summary.setTotalIncome(compensate_income.setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString());
return summary;
}
});
... ...
... ... @@ -75,6 +75,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
* @param orderRequest
*/
public void cancel(OrderRequest orderRequest){
logger.info("com.yohoufo.order.service.impl.BuyerOrderServiceImpl.cancel(OrderRequest) in param is {}", orderRequest);
// 状态 ![待付款] 不合法
checkStatusAndRequest(orderRequest, OrderStatus.WAITING_PAY);
... ...
... ... @@ -58,7 +58,8 @@ public class ProductProxyService {
public boolean returnStorage(Integer skup){
ApiResponse resp = ufoServiceCaller.call(RETURN_STORAGE, skup, 1);
ApiResponse resp = ufoServiceCaller.call(RETURN_STORAGE, ApiResponse.class, skup, 1);
return (resp == null || resp.getData()==null) ? false : (boolean)resp.getData();
}
... ...