|
@@ -400,8 +400,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
Goods goods = new Goods(orderGoods.getGoodsName(), uprice.toString(),
|
|
|
orderGoods.getGoodsRate().multiply(orderGoods.getMarketPrice()).setScale(2, BigDecimal.ROUND_HALF_UP).toString(),
|
|
|
orderGoods.getNumber().toString(),
|
|
|
- orderGoods.getRetailPrice().multiply(new BigDecimal(orderGoods.getNumber()))
|
|
|
- .setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
+ orderGoods.getActualPaymentAmount().toString());
|
|
|
goodsList.add(goods);
|
|
|
}
|
|
|
|
|
@@ -494,7 +493,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
if (Dict.payFlag.item_cash.getItem().equals(order.getPayFlag())) {
|
|
|
order.setPayStatus(Integer.parseInt(Dict.payStatus.item_4.getItem()));
|
|
|
}else{
|
|
|
- order.setPayStatus(Integer.parseInt(Dict.payStatus.item_3.getItem()));
|
|
|
+ order.setPayStatus(Integer.parseInt(Dict.payStatus.item_4.getItem()));
|
|
|
OrderRefundEntity mallOrderRefund = orderRefundDao.queryObjectByOrderId(order.getId());
|
|
|
OrderRefundEntity orderRefund = new OrderRefundEntity();
|
|
|
orderRefund.setRefundId(result.getRefund_id());
|
|
@@ -521,7 +520,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderRefundDao.save(orderRefund);//退款记录
|
|
|
}
|
|
|
}
|
|
|
- orderDao.update(order);//修改为退款中
|
|
|
+ orderDao.update(order);//
|
|
|
// TODO: 2019/6/13 定时任务查询退款成功后释放库存、优惠券
|
|
|
/*// 判断是否有优惠券
|
|
|
UserCouponEntity couponVo = userCouponDao.queryByOrderId(order.getId());
|
|
@@ -590,7 +589,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
}
|
|
|
// 更新库存
|
|
|
updateStock(order, "管理后台订单退款");*/
|
|
|
-// updateStock(order, "管理后台订单退款");
|
|
|
+ updateStock(order, "收银端退款");
|
|
|
|
|
|
// queryStorePromRealUpdateIsScan(order);
|
|
|
}
|
|
@@ -1679,7 +1678,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map offlineRetailSubmit(Map param, SysUserEntity user) {
|
|
|
+ public synchronized Map offlineRetailSubmit(Map param, SysUserEntity user) {
|
|
|
// 解析订单数据 List
|
|
|
List<LinkedHashMap> goodsList = (List<LinkedHashMap>) param.get("goodsList");
|
|
|
// 解析用户信息 LinkedHashMap
|
|
@@ -1803,8 +1802,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
|
|
|
if(goodsDto.get("retailPrice") instanceof Double){
|
|
|
- goodsEntity.setRetailPrice(new BigDecimal((Double)goodsDto.get("retailPrice"))); // 单价
|
|
|
-
|
|
|
+ goodsEntity.setRetailPrice(new BigDecimal((Double)goodsDto.get("retailPrice"))); // 单价
|
|
|
}else if(goodsDto.get("retailPrice") instanceof Integer){
|
|
|
goodsEntity.setRetailPrice(new BigDecimal((Integer)goodsDto.get("retailPrice")));
|
|
|
}else if(goodsDto.get("retailPrice") instanceof Float){
|
|
@@ -1839,16 +1837,15 @@ public class OrderServiceImpl implements OrderService {
|
|
|
}
|
|
|
totalTax = totalTax.add(tax).setScale(2,BigDecimal.ROUND_HALF_DOWN); // 计算总的税额
|
|
|
|
|
|
- if(goodsDto.get("actualPaymentAmount") instanceof Double){
|
|
|
- goodsEntity.setStoreRetailPrice(new BigDecimal((Double)goodsDto.get("actualPaymentAmount")));
|
|
|
- }else if(goodsDto.get("actualPaymentAmount") instanceof Integer){
|
|
|
- goodsEntity.setStoreRetailPrice(new BigDecimal((Integer)goodsDto.get("actualPaymentAmount")));
|
|
|
- }else if(goodsDto.get("actualPaymentAmount") instanceof Float){
|
|
|
- goodsEntity.setStoreRetailPrice(new BigDecimal((Float)goodsDto.get("actualPaymentAmount")));
|
|
|
+ if(goodsDto.get("retailPrice") instanceof Double){
|
|
|
+ goodsEntity.setStoreRetailPrice(new BigDecimal((Double)goodsDto.get("retailPrice"))); // 单价
|
|
|
+ }else if(goodsDto.get("retailPrice") instanceof Integer){
|
|
|
+ goodsEntity.setStoreRetailPrice(new BigDecimal((Integer)goodsDto.get("retailPrice")));
|
|
|
+ }else if(goodsDto.get("retailPrice") instanceof Float){
|
|
|
+ goodsEntity.setStoreRetailPrice(new BigDecimal((Float)goodsDto.get("retailPrice")));
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
// goodsEntity.setStoreRetailPrice(productInfo.getRetailPrice());
|
|
|
// 借用这个字段来存储购买数
|
|
|
goodsEntity.setGoodsNumber(sellVolume);
|
|
@@ -1964,14 +1961,14 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
// 判断是微信的支付码还是支付宝的支付码
|
|
|
if (parCode.startsWith("28")) {
|
|
|
- // 支付宝支付
|
|
|
- AliPay(user, parCode , order, processRecordEntity, orderWXPayRecordCurrent, store);
|
|
|
+ // 支付宝支付
|
|
|
+ AliPay(user, parCode , order, processRecordEntity, orderWXPayRecordCurrent, store);
|
|
|
|
|
|
}else{
|
|
|
// 微信支付
|
|
|
try {
|
|
|
wxPay(user, parCode, resultObj, order, processRecordEntity, orderWXPayRecordCurrent, store);
|
|
|
- } catch (ParseException e) {
|
|
|
+ } catch (Exception e) {
|
|
|
throw e;
|
|
|
}
|
|
|
|
|
@@ -1992,10 +1989,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderProcessRecordDao.save(processRecordEntity);
|
|
|
|
|
|
|
|
|
- // 生成取票码
|
|
|
- PickUpCodeEntity pickUpCodeEntity = new PickUpCodeEntity();
|
|
|
- pickUpCodeEntity.setOrderSn(order.getOrder_sn());
|
|
|
- pickUpCodeService.save(pickUpCodeEntity);
|
|
|
+
|
|
|
|
|
|
// 生成销售记录
|
|
|
SaleRecordEntity saleRecordEntity = new SaleRecordEntity();
|
|
@@ -2046,6 +2040,11 @@ public class OrderServiceImpl implements OrderService {
|
|
|
consumptionRecords.setCreateTime(new Date());
|
|
|
memberConsumptionRecordsDao.save(consumptionRecords);
|
|
|
|
|
|
+ // 生成取票码
|
|
|
+ PickUpCodeEntity pickUpCodeEntity = new PickUpCodeEntity();
|
|
|
+ pickUpCodeEntity.setOrderSn(order.getOrder_sn());
|
|
|
+ pickUpCodeService.save(pickUpCodeEntity);
|
|
|
+
|
|
|
resultObj.put("code",pickUpCodeEntity.getPickUpCodeSn()); // 系统中累加
|
|
|
|
|
|
resultObj.put("time",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
@@ -2054,17 +2053,14 @@ public class OrderServiceImpl implements OrderService {
|
|
|
// 通知WebSocket
|
|
|
WebSocketServer.sendMessage(sessionId,order.getOrder_sn(),order.getStore_id()
|
|
|
+"");
|
|
|
+
|
|
|
+ return resultObj;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
resultObj.put("errno", 400);
|
|
|
resultObj.put("errmsg", "订单异常------"+e.getMessage());
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return resultObj;
|
|
|
}
|
|
|
|
|
|
// private BigDecimal getDisCountAmout(List<GoodsEntity> goodsEntities) {
|
|
@@ -2283,7 +2279,6 @@ public class OrderServiceImpl implements OrderService {
|
|
|
// 修改订单状态
|
|
|
//当支付成功时,修改订单,并把其他支付记录撤销
|
|
|
if (WechatUtil.WXTradeState.SUCCESS.getCode().equals(wechatMicropayApiResult.getTrade_state())) {
|
|
|
-
|
|
|
//查询当前订单所有的支付记录
|
|
|
List<OrderWXPayRecordEntity> orderWXPayRecordEntitys =
|
|
|
orderWXPayRecordService.getRecordsByOutTradeNo(order.getOrder_sn());
|
|
@@ -2340,7 +2335,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if(times >= 20){
|
|
|
- throw new RuntimeException("超过30s未支付,订单下单失败");
|
|
|
+ throw new RuntimeException("超过20s未支付,订单下单失败");
|
|
|
}
|
|
|
times++;
|
|
|
}
|