| | |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.core.pojo.VerifyResult; |
| | | import com.matrix.core.tools.*; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.app.dto.ServiceOrderListDto; |
| | | import com.matrix.system.app.vo.ServiceOrderListVo; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.system.hive.plugin.util.MoneyUtil; |
| | | import com.matrix.system.hive.pojo.MyBeauticianCount; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.shopXcx.mqTask.MQTaskRouting; |
| | | import com.matrix.system.wechart.templateMsg.UniformMsgParam; |
| | |
| | | */ |
| | | @Override |
| | | public VerifyResult checkArrears(SysProjServices sysProjServices) { |
| | | //检测欠款 |
| | | /* for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) { |
| | | |
| | | // 检测欠款 |
| | | for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) { |
| | | SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId()); |
| | | |
| | | |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(sysProjUse.getProjId()); |
| | | SysOrderItem orderItem = sysOrderItemService.findById(sysProjUse.getOrderItemId()); |
| | | SysOrderItem item = sysOrderItemService.findById(sysProjUse.getOrderItemId()); |
| | | SysOrder orderItem = sysOrderService.findById(item.getOrderId()); |
| | | if ("购买".equals(sysProjUse.getSource())) { |
| | | // 如果用户有欠款,服务单总价不能超过已付金额 |
| | | if (orderItem!=null && orderItem.getArrears() > 0) { |
| | |
| | | double money = MoneyUtil.sub((bj - orderItem.getArrears()), (yxfje + bcxfje)); |
| | | // 如果 已付金额 - (已消费金额+本次消费金额)<0 则不能再消费 |
| | | if (money < 0) { |
| | | return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 订单编号[ " + sysOrderService.findById(orderItem.getOrderId()).getOrderNo() + " ] "); |
| | | return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 订单编号[ " + orderItem.getOrderNo() + " ] "); |
| | | } |
| | | |
| | | |
| | | } |
| | | } else if ("赠送".equals(sysProjUse.getSource())) { |
| | | if (orderItem!=null &&orderItem.getArrears() > 0) { |
| | | return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 不能消费赠送项目,订单编号[ " + sysOrderService.findById(orderItem.getOrderId()).getOrderNo() + " ] "); |
| | | return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 不能消费赠送项目,订单编号[ " + orderItem.getOrderNo() + " ] "); |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | return new VerifyResult(false); |
| | | } |
| | | |
| | |
| | | double sum = stores.stream().mapToDouble(item2 -> item2.getStoreTotal()).sum(); |
| | | Double needAmount = MoneyUtil.div(item.getAmount(), Double.valueOf(shoppingGoods.getVolume())); |
| | | if (sum < needAmount) { |
| | | throw new GlobleException("出库失败:【" + shoppingGoods.getName() + "库存不足】"); |
| | | throw new GlobleException("出库失败:【" + shoppingGoods.getName()+"-"+shoppingGoods.getCode()+ "库存不足】"); |
| | | } |
| | | //循环获取所有批次产品,并扣减库存 |
| | | for (SysStoreInfo storeInfo : stores) { |