| | |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import com.matrix.component.rabbitmq.RabiitMqTemplate; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | |
| | | import com.matrix.system.hive.pojo.ShoppingCarItem; |
| | | import com.matrix.system.hive.pojo.ShoppingCarItemsVo; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.shopXcx.mqTask.MQTaskRouting; |
| | | import com.matrix.system.wechart.templateMsg.UniformMsgParam; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private SysInstoreInfoService sysInstoreInfoService; |
| | | |
| | | |
| | | @Value("${evn}") |
| | | private String evn; |
| | | |
| | | @Autowired |
| | | private RabiitMqTemplate rabiitMqTemplate; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | order.setStatu(Dictionary.ORDER_STATU_YQX); |
| | | order.setArrears(0D); |
| | | |
| | | //发送微信公众号提醒 |
| | | UniformMsgParam uniformMsgParam=new UniformMsgParam(order.getCompanyId(),UniformMsgParam.GZH_DDQX); |
| | | uniformMsgParam.put("orderId",order.getId()); |
| | | rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString()); |
| | | |
| | | return sysOrderDao.update(order); |
| | | |
| | | } else { |
| | |
| | | achieveNewService.removeByModel(achieveNew); |
| | | // 取消订单 |
| | | order.setStatu(Dictionary.ORDER_STATU_YQX); |
| | | |
| | | |
| | | return sysOrderDao.update(order); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | if(moneyCardUse.getGiftMoney() >= flow.getAmount().doubleValue()) { |
| | | double surplus = MoneyUtil.sub(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue()); |
| | | moneyCardUse.setGiftMoney(surplus); |
| | | |
| | | moneyCardUseFlow.setGiftMoney(0D - flow.getAmount().doubleValue()); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | |
| | | if(moneyCardUse.getRealMoney() >= flow.getAmount().doubleValue()) { |
| | | double surplus = MoneyUtil.sub(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue()); |
| | | moneyCardUse.setRealMoney(surplus); |
| | | |
| | | moneyCardUseFlow.setTotal(0 - flow.getAmount().doubleValue()); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | } |
| | | |
| | | if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_NO_N)) { |
| | | //余额为0时充值卡变为无效 |
| | | if(moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)){ |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); |
| | | } |
| | | } |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId()); |
| | | if (shoppingGoods != null) { |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime()); |
| | | moneyCardUse.setFailTime(invalidTime); |
| | | } |
| | | // 更新充值卡信息 |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | //设置卡项使用流水 |
| | | moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); |
| | | moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo()); |
| | |
| | | moneyCardUseFlow.setOperationId(user.getSuId()); |
| | | moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney()+moneyCardUse.getRealMoney()); |
| | | moneyCardUseFlowDao.insert(moneyCardUseFlow); |
| | | |
| | | // 达到使用次数后自动清空余额 |
| | | if (!moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y) |
| | | && moneyCardUse.getLastCount() <= 0) { |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setLastCount(0); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); |
| | | } |
| | | if (moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)) { |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); |
| | | } |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId()); |
| | | if (shoppingGoods != null) { |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime()); |
| | | moneyCardUse.setFailTime(invalidTime); |
| | | } |
| | | // 更新充值卡信息 |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | } |
| | | |
| | | /** |