| | |
| | | import com.mzl.flower.mapper.system.UserWechatMapper; |
| | | import com.mzl.flower.mapper.warehouse.WarehouseLocationMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.service.ConfigParamService; |
| | | import com.mzl.flower.service.comment.FlowerCommentService; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.flower.FlowerService; |
| | |
| | | @Autowired |
| | | private FlowerCommentService flowerCommentService; |
| | | |
| | | @Autowired |
| | | private ConfigParamService configParamService; |
| | | |
| | | public void changeFlower2Cart(CartSaveDTO dto) { |
| | | String userId = SecurityUtils.getUserId(); |
| | |
| | | totalAmount = new BigDecimal(0); |
| | | } |
| | | totalAmount = totalAmount.add(p.getPacking()).add(transportFee); |
| | | if(totalAmount.doubleValue() <= 0){//假如总价小于等于0,则支付0.01元 |
| | | totalAmount = new BigDecimal("0.01"); |
| | | |
| | | // 判断最低金额如果小于配置的钱,则不能提交 |
| | | String paramGroup = "orderpay"; |
| | | String paramKey = "order_min_fee"; |
| | | String baseString = configParamService.getBaseString(paramGroup, paramKey); |
| | | if(StringUtils.isNotEmpty(baseString)){ |
| | | // 判断类型是否错误,可转换成BigDecimal |
| | | try { |
| | | BigDecimal minFee = new BigDecimal(baseString); |
| | | if(totalAmount.compareTo(minFee) < 0){ |
| | | throw new ValidationException("订单金额不能低于"+minFee+"元"); |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | log.error("订单金额配置有误,请检查配置", e); |
| | | throw new ValidationException("订单金额配置有误,请检查配置"); |
| | | } |
| | | } |
| | | // if(totalAmount.doubleValue() <= 0){//假如总价小于等于0,则支付0.01元 |
| | | // totalAmount = new BigDecimal("0.01"); |
| | | // } |
| | | order.setTotalAmount(totalAmount); |
| | | |
| | | order.setCustomer(address.getName()); |
| | |
| | | } |
| | | |
| | | public List<Order> autoReceive() { |
| | | int days = -5; //5天前的订单自动收货 |
| | | String paramGroup = "order"; |
| | | String paramKey = "order_auto_receive"; |
| | | String baseString = configParamService.getBaseString(paramGroup, paramKey); |
| | | int days = -Integer.parseInt(baseString); |
| | | // int days = -5; //5天前的订单自动收货 |
| | | LocalDateTime endTime = LocalDateTime.now().plusDays(days); |
| | | List<Order> ls = orderMapper.getOrderForAutoReceive(endTime); |
| | | if (ls == null || ls.size() == 0) { |