| | |
| | | import nonapi.io.github.classgraph.json.Id; |
| | | import org.apache.poi.sl.image.ImageHeaderEMF; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | if(Objects.isNull(category)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"åæ°é
ç½®é误,请è系管çå"); |
| | | } |
| | | orders.setPayAccount(orders.getEstimatedAccount()); |
| | | Long tcje = Long.valueOf(new BigDecimal(orders.getPayAccount().toString()).multiply(orders.getPlatformRata()).intValue()); |
| | | orders.setReceiveAccount(orders.getPayAccount() - tcje); |
| | | //ç¨é¤è®¢å |
| | | if(Constants.equalsInteger(orders.getType(),Constants.TWO)){ |
| | | orders.setPayAccount(orders.getEstimatedAccount()); |
| | | Long tcje = Long.valueOf(new BigDecimal(orders.getPayAccount().toString()).multiply(orders.getPlatformRata()).intValue()); |
| | | orders.setReceiveAccount(orders.getPayAccount() - tcje); |
| | | orders.setStatus(Constants.ordersStatus.waitPay.getKey()); |
| | | orders.setOutTradeNo(UUID.randomUUID().toString().replace("-","")); |
| | | //å¤èµ·æ¯ä»ä¸å¡ |
| | |
| | | } |
| | | orders.setOriginPriceNum1(orders.getPriceNum1()); |
| | | orders.setOriginPriceNum2(orders.getPriceNum2()); |
| | | orders.setOriginEstimatedAccount(orders.getOriginEstimatedAccount()); |
| | | orders.setOriginEstimatedAccount(orders.getEstimatedAccount()); |
| | | orders.setConfirmOtherFee(0l); |
| | | ordersMapper.insert(orders); |
| | | |
| | |
| | | |
| | | //å建æä½æ¥å¿ |
| | | Constants.OrdersLog ordersLog = Constants.OrdersLog.UPLOAD; |
| | | String orderTypeInfo = "ç¨å·¥å"; |
| | | String orderTypeInfo = Constants.getOrderInfo(orders);/*"ç¨å·¥å"; |
| | | if(!Constants.equalsInteger(orders.getType(),Constants.ZERO)){ |
| | | orderTypeInfo = Constants.equalsInteger(orders.getType(),Constants.ONE)?"ç¨è½¦å":"éé¤å"; |
| | | }else{ |
| | |
| | | }else{ |
| | | orderTypeInfo = orderTypeInfo + (Constants.equalsInteger(orders.getWorkType(),Constants.ONE)?"-忣工":"-å
è£
å·¥"); |
| | | } |
| | | } |
| | | }*/ |
| | | String logInfo = ordersLog.getInfo() |
| | | .replace("{param}",orderTypeInfo); |
| | | this.saveOrderLog(orders,ordersLog, |
| | |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Integer priceNum2 = orders.getPriceNum2(); |
| | | if( (Constants.equalsInteger(orders.getType(),Constants.ZERO) |
| | | && Constants.equalsInteger(orders.getWorkType(),Constants.TWO) && |
| | | ( Constants.equalsInteger(orders.getCarType(),Constants.ZERO) |
| | |
| | | orders.setTotalDays(DateUtil.daysBetweenDates(orders.getEndDate(),orders.getStartDate())+1); |
| | | if(Constants.equalsInteger(orders.getType(),Constants.ZERO)){ |
| | | if(Constants.equalsInteger(orders.getWorkType(),Constants.TWO) |
| | | && ( Objects.isNull(orders.getCarType()) ) ){ |
| | | && ( Objects.isNull(orders.getCarType()) ) ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | }else if(Constants.equalsInteger(orders.getType(),Constants.ONE)){ |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Long sumPrice = 0L; |
| | | // List<CateringDTO> cateringDTOList = new ArrayList<>(); |
| | | for (CateringDTO cateringDTO:orders.getCateringDTOList()) { |
| | | if(Objects.isNull(cateringDTO) |
| | | || StringUtils.isEmpty(cateringDTO.getName()) |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"ç¨é¤æ åæ°æ®é误ï¼è¯·å·æ°éè¯"); |
| | | } |
| | | sumPrice = sumPrice + (cateringDTO.getPrice() * cateringDTO.getNum()) ; |
| | | |
| | | } |
| | | if(new BigDecimal(sumPrice.toString()).compareTo(orders.getPrice())!=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å价计ç®é误"); |
| | | } |
| | | |
| | | |
| | | orders.setWayInfo(JSONObject.toJSONString(orders.getCateringDTOList())); |
| | | } |
| | | if(!orders.getEstimatedAccount().equals(this.getTotal(orders))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"éé¢è®¡ç®é误!"); |
| | | } |
| | | orders.setPriceNum2(priceNum2); |
| | | } |
| | | |
| | | |
| | |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | orders.setOriginPriceNum1(orders.getPriceNum1()); |
| | | orders.setOriginPriceNum2(orders.getPriceNum2()); |
| | | orders.setOriginEstimatedAccount(orders.getOriginEstimatedAccount()); |
| | | orders.setConfirmOtherFee(0l); |
| | | orders.setConfirmOtherFee(0L); |
| | | ordersMapper.updateById(orders); |
| | | } |
| | | |
| | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(cateringDTOList)){ |
| | | for (CateringDTO cateringDTO:cateringDTOList) { |
| | | if(StringUtils.isEmpty(orders.getOrderContent())){ |
| | | orders.setOrderContent(cateringDTO.getName()+cateringDTO.getPrice()+" é"+cateringDTO.getNum()+"份"); |
| | | orders.setOrderContent(cateringDTO.getName()+(new BigDecimal(cateringDTO.getPrice().toString()).divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP))+" é"+cateringDTO.getNum()+"份"); |
| | | }else{ |
| | | orders.setOrderContent(orders.getOrderContent()+" | "+cateringDTO.getName()+cateringDTO.getPrice()+" é"+cateringDTO.getNum()+"份"); |
| | | orders.setOrderContent(orders.getOrderContent()+" | "+cateringDTO.getName()+(new BigDecimal(cateringDTO.getPrice().toString()).divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP))+" é"+cateringDTO.getNum()+"份"); |
| | | } |
| | | } |
| | | } |
| | |
| | | //æ¥è¯¢ç¨æ·æ¯å¦æå¯¹åºèº«ä»½ |
| | | if(Constants.equalsInteger(orders.getType(),Constants.ZERO)){ |
| | | if(!Constants.equalsInteger(member.getWorkerIdentity(),Constants.TWO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ¨è¿æªæ³¨å该æå¡ï¼è¯·åå¾ä¸ªäººä¿¡æ¯ä¸æäº¤ç³è¯·ã"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ¨è¿æªæ³¨å该æå¡ï¼è¯·åå¾\"æç\"é¡µé¢æäº¤ç³è¯·"); |
| | | } |
| | | }else if(Constants.equalsInteger(orders.getType(),Constants.ONE)){ |
| | | if(!Constants.equalsInteger(member.getDriverIdentity(),Constants.TWO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ¨è¿æªæ³¨å该æå¡ï¼è¯·åå¾ä¸ªäººä¿¡æ¯ä¸æäº¤ç³è¯·ã"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ¨è¿æªæ³¨å该æå¡ï¼è¯·åå¾\"æç\"é¡µé¢æäº¤ç³è¯·"); |
| | | } |
| | | }else{ |
| | | if(!Constants.equalsInteger(member.getChefIdentity(),Constants.TWO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ¨è¿æªæ³¨å该æå¡ï¼è¯·åå¾ä¸ªäººä¿¡æ¯ä¸æäº¤ç³è¯·ã"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ¨è¿æªæ³¨å该æå¡ï¼è¯·åå¾\"æç\"é¡µé¢æäº¤ç³è¯·"); |
| | | } |
| | | } |
| | | |
| | |
| | | if(Constants.equalsInteger(orders.getIsUpdate(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订åä¿®æ¹å¾
ç¡®è®¤ï¼æ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | | if(orders.getStartDate().getTime()>System.currentTimeMillis()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"è®¢åæªå°å¼å§æ¶é´æ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | | orders.setUpdateTime(new Date()); |
| | | orders.setStatus(Constants.ordersStatus.doing.getKey()); |
| | | orders.setWorkStartTime(new Date()); |
| | |
| | | model.setPriceNum1(orders.getTotalDays()); |
| | | } |
| | | Long total = this.getTotal(orders); |
| | | Long tcje = Long.valueOf(new BigDecimal(total.toString()).multiply(model.getPlatformRata()).intValue()); |
| | | Long reciveTotal = total - tcje; |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getStartDate,model.getStartDate()) |
| | | .set(Orders::getEndDate,model.getEndDate()) |
| | |
| | | .set(Orders::getUpdateTime,new Date()) |
| | | .set(Orders::getEstimatedAccount,total) |
| | | .set(Orders::getOriginEstimatedAccount,total) |
| | | .set(Orders::getReceiveAccount,reciveTotal) |
| | | .eq(Orders::getId,orders.getId()) |
| | | ); |
| | | //å建æä½æ¥å¿ |
| | |
| | | public Long getTotal(Orders orders){ |
| | | if(Objects.isNull(orders) |
| | | ||Objects.isNull(orders.getPrice()) |
| | | ||Objects.isNull(orders.getPriceNum1())){ |
| | | ||Objects.isNull(orders.getPriceNum1()) |
| | | ||Objects.isNull(orders.getType()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | BigDecimal bigDecimalPrice = BigDecimal.ZERO; |
| | | if( |
| | | (Constants.equalsInteger(orders.getType(),Constants.ZERO) |
| | | && Constants.equalsInteger(orders.getWorkType(),Constants.ZERO )) |
| | | (Constants.equalsInteger(orders.getType(),Constants.ZERO) && Constants.equalsInteger(orders.getWorkType(),Constants.ZERO )) |
| | | || (Constants.equalsInteger(orders.getType(),Constants.ZERO) && Objects.nonNull(orders.getCarType()) && Constants.equalsInteger(orders.getWorkType(),Constants.TWO ) && Constants.equalsInteger(orders.getCarType(),Constants.TWO)) |
| | | || Constants.equalsInteger(orders.getType(),Constants.ONE) |
| | | || Constants.equalsInteger(orders.getType(),Constants.TWO) |
| | | ){ |
| | | orders.setPriceNum2(Constants.ONE); |
| | | bigDecimalPrice = orders.getPrice().multiply(new BigDecimal(orders.getPriceNum1().toString())); |
| | | }else{ |
| | | if(Objects.isNull(orders.getPriceNum2())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | bigDecimalPrice = orders.getPrice().multiply(new BigDecimal(orders.getPriceNum1().toString())).multiply(new BigDecimal(orders.getPriceNum2().toString())); |
| | | } |
| | | BigDecimal bigDecimalPrice = orders.getPrice(). |
| | | multiply(new BigDecimal(orders.getPriceNum1().toString())) |
| | | .multiply(new BigDecimal(orders.getPriceNum2().toString())); |
| | | if(Objects.nonNull(orders.getConfirmOtherFee())){ |
| | | bigDecimalPrice = bigDecimalPrice.add(new BigDecimal(orders.getConfirmOtherFee().toString())); |
| | | } |
| | | return bigDecimalPrice.divide(new BigDecimal("1"),0,BigDecimal.ROUND_HALF_UP).longValue();//orders.getPrice() * orders.getPriceNum1() * orders.getPriceNum2(); |
| | | } |
| | | |
| | |
| | | } |
| | | orders.setPriceNum1(confirmUpdOrderDTO.getPriceNum1()); |
| | | orders.setPriceNum2(confirmUpdOrderDTO.getPriceNum2()); |
| | | orders.setConfirmOtherFee(confirmUpdOrderDTO.getConfirmOtherFee()); |
| | | Long totalFee = this.getTotal(orders);//éæ°è®¡ç®è´¹ç¨ |
| | | Long payFee = totalFee+Constants.formatLongNum(confirmUpdOrderDTO.getConfirmOtherFee());//éæ°è®¡ç®è´¹ç¨ |
| | | BigDecimal recFee = new BigDecimal(payFee).multiply((new BigDecimal(1).subtract(Constants.formatBigDecimal(orders.getPlatformRata())))).setScale(0, RoundingMode.HALF_UP) ; |
| | | Long payFee = totalFee;//éæ°è®¡ç®è´¹ç¨ |
| | | Long tcje = Long.valueOf(new BigDecimal(orders.getPayAccount().toString()).multiply(orders.getPlatformRata()).intValue()); |
| | | Long reciveTotal = payFee - tcje; |
| | | //BigDecimal recFee = new BigDecimal(payFee).multiply((new BigDecimal(1).subtract(Constants.formatBigDecimal(orders.getPlatformRata())))).setScale(0, RoundingMode.HALF_UP) ; |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getPriceNum1,confirmUpdOrderDTO.getPriceNum1()) |
| | | .set(Orders::getPriceNum2,confirmUpdOrderDTO.getPriceNum2()) |
| | |
| | | .set(Orders::getEstimatedAccount,totalFee) |
| | | .set(Orders::getStatus,Constants.ordersStatus.feeconfirm.getKey()) |
| | | .set(Orders::getPayAccount,payFee) |
| | | .set(Orders::getReceiveAccount,recFee.longValue()) |
| | | .set(Orders::getReceiveAccount,reciveTotal) |
| | | .set(Orders::getUpdateTime,new Date()) |
| | | .set(Orders::getConfirmFeeTime,new Date()) |
| | | .eq(Orders::getId,orders.getId()) |
| | | ); |
| | | //è®°å½åæä¿®æ¹çæ¥å¿ |
| | | Constants.OrdersLog ordersLog = Constants.OrdersLog.FEE_CONFIRM; |
| | | this.saveOrderLog(orders,ordersLog, |
| | | ordersLog.getInfo(),confirmUpdOrderDTO.getMember().getId(),null); |
| | | |
| | | //微信éç¥ |
| | | Member member = memberMapper.selectById(orders.getReleaseMemberId()); |
| | | if(Objects.nonNull(member)&& org.apache.commons.lang3.StringUtils.isNotBlank(member.getOpenid())){ |
| | | sendWxMessage.waitPayMessage(member.getOpenid(),orders); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | .eq(Orders::getReleaseMemberId,orders.getReleaseMemberId())); |
| | | //æ¥è¯¢åæ¶æ¬¡æ° |
| | | if(totalCancelTimes<=cancelTimes){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"仿¥è®¢å主å¨åæ¶æ¬¡æ°å·²è¶
åº"+totalCancelTimes+"次,æ æ³åæ¶è®¢å,å¦éå¤ç请è系客æ"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"仿¥è®¢å主å¨åæ¶æ¬¡æ°å·²è¶
åº"+totalCancelTimes+"次,æ æ³åæ¶è®¢å"); |
| | | } |
| | | |
| | | Integer cancelTimeHour = Integer.valueOf(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RELEASE_CANCEL_TIME).getCode()); |
| | | Long hours = DateUtil.getBetweenHours(new Date(),orders.getStartDate()); |
| | | if(hours < cancelTimeHour){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"è·ç¦»è®¢åå¼å§æ¶é´ä¸è¶³"+cancelTimeHour+"å°æ¶,æ æ³åæ¶è®¢åï¼å¦éå¤ç请è系客æ"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"è·ç¦»è®¢åå¼å§æ¶é´ä¸è¶³"+cancelTimeHour+"å°æ¶,æ æ³åæ¶è®¢å"); |
| | | } |
| | | |
| | | if(Constants.equalsInteger(orders.getType(),Constants.TWO)){ |
| | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(members)){ |
| | | List<String> openIdList = members.stream().map(i->i.getOpenid()).collect(Collectors.toList()); |
| | | //åé微信éç¥ |
| | | orders.setCancelTime(new Date()); |
| | | sendWxMessage.cancelMessage(openIdList,orders,Constants.ONE); |
| | | } |
| | | |
| | |
| | | .eq(OrderLog::getMemberId,member.getId())); |
| | | //æ¥è¯¢åæ¶æ¬¡æ° |
| | | if(totalCancelTimes<=cancelTimes){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"仿¥è®¢å主å¨åæ¶æ¬¡æ°å·²è¶
åº"+totalCancelTimes+"次,æ æ³åæ¶è®¢å,å¦éå¤ç请è系客æ"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"仿¥è®¢å主å¨åæ¶æ¬¡æ°å·²è¶
åº"+totalCancelTimes+"次,æ æ³åæ¶è®¢å"); |
| | | } |
| | | |
| | | Integer cancelTimeHour = Integer.valueOf(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RECEIVE_CANCEL_TIME).getCode()); |
| | | Long hours = DateUtil.getBetweenHours(new Date(),orders.getStartDate()); |
| | | if(hours < cancelTimeHour){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"è·ç¦»è®¢åå¼å§æ¶é´ä¸è¶³"+cancelTimeHour+"å°æ¶,æ æ³åæ¶è®¢åï¼å¦éå¤ç请è系客æ"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"è·ç¦»è®¢åå¼å§æ¶é´ä¸è¶³"+cancelTimeHour+"å°æ¶,æ æ³åæ¶è®¢å"); |
| | | } |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getUpdateTime,new Date()) |
| | | .set(Orders::getCancelTime,new Date()) |
| | | .set(Orders::getStatus,Constants.ordersStatus.wait.getKey()) |
| | | .set(Orders::getAcceptMemberId,null) |
| | | .set(Orders::getAcceptType,null) |
| | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(members)){ |
| | | List<String> openIdList = members.stream().map(i->i.getOpenid()).collect(Collectors.toList()); |
| | | //åé微信éç¥ |
| | | orders.setCancelTime(new Date()); |
| | | sendWxMessage.cancelMessage(openIdList,orders,Constants.TWO); |
| | | } |
| | | //çä¿¡éç¥ |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.doing.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订åç¶æå·²æµè½¬,æ æ³è¿è¡åæ¶"); |
| | | if(Constants.equalsInteger(orders.getType(),Constants.orderType.scd.getKey())){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.doing.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订åç¶æå·²æµè½¬,æ æ³è¿è¡åæ¶"); |
| | | } |
| | | }else{ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.feeconfirm.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订åç¶æå·²æµè½¬,æ æ³è¿è¡åæ¶"); |
| | | } |
| | | } |
| | | |
| | | if(!Constants.equalsInteger(orders.getReleaseMemberId(),doneOrderDTO.getMember().getId())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鿍çè®¢åæ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | |
| | | if(!Constants.equalsInteger(orders.getType(),Constants.TWO)){ |
| | | orders.setPayAccount(doneOrderDTO.getAmount()); |
| | | //ææéé¢ |
| | | Long tcje = (new BigDecimal(orders.getPayAccount().toString()).multiply(Constants.formatBigDecimal(orders.getPlatformRata())).setScale(0,RoundingMode.HALF_UP).longValue()); |
| | | // Long tcje = (new BigDecimal(orders.getPayAccount().toString()).multiply(Constants.formatBigDecimal(orders.getPlatformRata())).setScale(0,RoundingMode.HALF_UP).longValue()); |
| | | Long tcje = Long.valueOf(new BigDecimal(orders.getPayAccount().toString()).multiply(orders.getPlatformRata()).intValue()); |
| | | orders.setReceiveAccount(orders.getPayAccount() - tcje); |
| | | orders.setOutTradeNo(UUID.randomUUID().toString().replace("-","")); |
| | | ordersMapper.updateById(orders); |
| | |
| | | } |
| | | |
| | | if(!((( Constants.equalsInteger(orders.getType(),Constants.TWO) && Constants.equalsInteger(orders.getStatus(),Constants.ZERO) ) |
| | | || ( !Constants.equalsInteger(orders.getType(),Constants.TWO) && Constants.equalsInteger(orders.getStatus(),Constants.THREE) )) |
| | | || ( !Constants.equalsInteger(orders.getType(),Constants.TWO) && Constants.equalsInteger(orders.getStatus(),Constants.FIVE) )) |
| | | && Constants.equalsInteger(orders.getPayStatus(),Constants.ZERO) )){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订åç¶æå·²æµè½¬"); |
| | | } |
| | | Member payMember = memberMapper.selectById(reusePayDTO.getMember().getId()); |
| | | if(Objects.isNull(payMember)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ç¨æ·ä¿¡æ¯å¼å¸¸"); |
| | | } |
| | | |
| | | OrderReleaseVO orderReleaseVO = new OrderReleaseVO(); |
| | | if(!Constants.equalsInteger(orders.getType(),Constants.TWO)){ |
| | | orders.setPayAccount(reusePayDTO.getAmount()); |
| | | //ææéé¢ |
| | | Long tcje = Long.valueOf(new BigDecimal(orders.getPayAccount().toString()).multiply(orders.getPlatformRata()).intValue()); |
| | | orders.setReceiveAccount(orders.getPayAccount() - tcje); |
| | | orders.setOutTradeNo(UUID.randomUUID().toString().replace("-","")); |
| | | ordersMapper.updateById(orders); |
| | | } |
| | | orders.setOutTradeNo(UUID.randomUUID().toString().replace("-","")); |
| | | ordersMapper.updateById(orders); |
| | | //å¤èµ·æ¯ä»ä¸å¡ |
| | | Object object = this.getWxPayResponse(orders,orders.getMember().getOpenid()); |
| | | Object object = this.getWxPayResponse(orders,payMember.getOpenid()); |
| | | orderReleaseVO.setObject(object); |
| | | orderReleaseVO.setId(orders.getId()); |
| | | return orderReleaseVO; |
| | |
| | | List<String> openIdList = members.stream().map(i->i.getOpenid()).collect(Collectors.toList()); |
| | | orders.setCancelTime(new Date()); |
| | | //åé微信éç¥ |
| | | orders.setCancelTime(new Date()); |
| | | sendWxMessage.cancelMessage(openIdList,orders,Constants.ZERO); |
| | | } |
| | | //çä¿¡éç¥ååæ¹ |
| | |
| | | } |
| | | }else{ |
| | | //éç¨é¤ç±»è®¢å |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.THREE)){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.FIVE)){ |
| | | return ("å¤çæå!"); |
| | | }else{ |
| | | //å¤çæ¯ä»å®æé»è¾ |
| | |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | Orders model = pageWrap.getModel(); |
| | | if(Objects.isNull(model) |
| | | || Objects.isNull(model.getQueryLat()) |
| | | || Objects.isNull(model.getQueryLgt()) |
| | | || Objects.isNull(model.getQueryMyOrderType()) |
| | | || Objects.isNull(model.getQueryMyOrderType()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | |
| | | .select("c2.name",Orders::getTransportTypeName) |
| | | .leftJoin(" category c1 on t.category_id = c1.id ") |
| | | .leftJoin(" category c2 on t.TRANSPORT_TYPE_ID = c2.id ") |
| | | .select(" case when T.LGT IS NULL OR T.LAT IS NULL THEN 0 " + |
| | | " when t.TYPE = 0 then CONVERT( ST_Distance_Sphere ( POINT ( t.LGT, t.LAT ), POINT ( "+workerLgt+", "+workerLat+" )) /1000,DECIMAL(15,2)) " + |
| | | " when t.TYPE = 1 then CONVERT( ST_Distance_Sphere ( POINT ( t.LGT, t.LAT ), POINT ( "+driverLgt+", "+driverLat+" )) /1000,DECIMAL(15,2)) " + |
| | | " else CONVERT( ST_Distance_Sphere ( POINT ( t.LGT, t.LAT ), POINT ( "+chefLgt+", "+chefLat+" )) /1000,DECIMAL(15,2)) end " , Orders::getDistance) |
| | | .eq(Objects.nonNull(model.getType()),Orders::getType,model.getType()); |
| | | .eq(Objects.nonNull(model.getType()),Orders::getType,model.getType()) |
| | | .eq(Objects.nonNull(model.getCommentStatus()),Orders::getCommentStatus,model.getCommentStatus());; |
| | | if(!(Objects.isNull(model.getQueryLat())||Objects.isNull(model.getQueryLgt()))){ |
| | | queryWrapper.select(" case when T.LGT IS NULL OR T.LAT IS NULL THEN 0 " + |
| | | " when t.TYPE = 0 then CONVERT( ST_Distance_Sphere ( POINT ( t.LGT, t.LAT ), POINT ( "+workerLgt+", "+workerLat+" )) /1000,DECIMAL(15,2)) " + |
| | | " when t.TYPE = 1 then CONVERT( ST_Distance_Sphere ( POINT ( t.LGT, t.LAT ), POINT ( "+driverLgt+", "+driverLat+" )) /1000,DECIMAL(15,2)) " + |
| | | " else CONVERT( ST_Distance_Sphere ( POINT ( t.LGT, t.LAT ), POINT ( "+chefLgt+", "+chefLat+" )) /1000,DECIMAL(15,2)) end " , Orders::getDistance); |
| | | } |
| | | if(Objects.nonNull(model.getQueryMyOrderType())){ |
| | | if(Constants.equalsInteger(model.getQueryMyOrderType(),Constants.ZERO)){ |
| | | //ååæ¹ æç订å |
| | | queryWrapper.eq(Orders::getReleaseMemberId,model.getMember().getId()); |
| | | queryWrapper.eq(Objects.nonNull(model.getStatus()),Orders::getStatus,model.getStatus()); |
| | | queryWrapper.eq(Objects.nonNull(model.getStatus())&&!Constants.equalsInteger(model.getStatus(),Constants.ordersStatus.waitPay.getKey()),Orders::getStatus,model.getStatus()); |
| | | queryWrapper.in(Objects.nonNull(model.getStatus())&&Constants.equalsInteger(model.getStatus(),Constants.ordersStatus.waitPay.getKey()),Orders::getStatus,model.getStatus(),Constants.ordersStatus.feeconfirm.getKey()); |
| | | queryWrapper.orderByDesc(Orders::getCreateTime); |
| | | }else if(Constants.equalsInteger(model.getQueryMyOrderType(),Constants.ONE)){ |
| | | //æ¥åæ¹ æç订å |
| | | queryWrapper.eq(Orders::getAcceptMemberId,model.getMember().getId()); |
| | | queryWrapper.eq(Objects.nonNull(model.getStatus()),Orders::getStatus,model.getStatus()); |
| | | // queryWrapper.in(Objects.nonNull(model.getStatus())&&Constants.equalsInteger(model.getStatus(),Constants.ordersStatus.waitPay.getKey()),Orders::getStatus,model.getStatus(),Constants.ordersStatus.feeconfirm.getKey()); |
| | | queryWrapper.orderByDesc(Orders::getAcceptTime); |
| | | }else{ |
| | | //æ¥è¯¢ç¨æ·çæ¥åæé |
| | | //æ¥è¯¢ç¨æ·çæ¥åæé æ¥å大å
|
| | | ReceiveWeight receiveWeight = receiveWeightMapper.selectOne(new QueryWrapper<ReceiveWeight>().lambda().eq(ReceiveWeight::getDeleted,Constants.ZERO).apply(" RECEIVE_MIN < "+model.getMember().getReceiveNum()+" and RECEIVE_MAX > " + model.getMember().getReceiveNum()).last(" limit 1 ")); |
| | | if(Objects.nonNull(receiveWeight)){ |
| | | queryWrapper.apply(" DATE_ADD(t.CREATE_TIME, INTERVAL "+receiveWeight.getDelayTime()+" MINUTE) < now() "); |
| | |
| | | IPage<Orders> iPage = ordersMapper.selectJoinPage(page,Orders.class,queryWrapper); |
| | | for (Orders orders:iPage.getRecords()) { |
| | | this.getPriceUnit(orders); |
| | | if(Constants.equalsInteger(model.getQueryMyOrderType(),Constants.ZERO)||Constants.equalsInteger(model.getQueryMyOrderType(),Constants.ONE)){ |
| | | orders.setStatusName( |
| | | Constants.equalsInteger(model.getQueryMyOrderType(),Constants.ZERO)?Constants.ordersStatus.getName(orders.getStatus()): |
| | | Constants.ordersStatus.getInfo(orders.getStatus()) |
| | | ); |
| | | } |
| | | } |
| | | // if(Objects.nonNull(model.getQueryMyOrderType())&&Constants.equalsInteger(model.getQueryMyOrderType(),Constants.TWO)){ |
| | | // if(Constants.equalsInteger(model.getMember().getUseIdentity(),Constants.ONE)){ |
| | | // model.getMember().setWorkerIdentityModel( |
| | | // identityInfoMapper.selectOne(new QueryWrapper<IdentityInfo>().lambda() |
| | | // .eq(IdentityInfo::getMemberId,model.getMember().getId()) |
| | | // .eq(IdentityInfo::getType,Constants.ZERO) |
| | | // .eq(IdentityInfo::getAuditStatus,Constants.TWO) |
| | | // .last("limit 1") |
| | | // ) |
| | | // ); |
| | | // model.getMember().setDriverIdentityModel( |
| | | // identityInfoMapper.selectOne(new QueryWrapper<IdentityInfo>().lambda() |
| | | // .eq(IdentityInfo::getMemberId,model.getMember().getId()) |
| | | // .eq(IdentityInfo::getType,Constants.ONE) |
| | | // .eq(IdentityInfo::getAuditStatus,Constants.TWO) |
| | | // .last("limit 1") |
| | | // ) |
| | | // ); |
| | | // model.getMember().setChefIdentityModel( |
| | | // identityInfoMapper.selectOne(new QueryWrapper<IdentityInfo>().lambda() |
| | | // .eq(IdentityInfo::getMemberId,model.getMember().getId()) |
| | | // .eq(IdentityInfo::getType,Constants.TWO) |
| | | // .eq(IdentityInfo::getAuditStatus,Constants.TWO) |
| | | // .last("limit 1") |
| | | // ) |
| | | // ); |
| | | // } |
| | | // for (Orders orders:iPage.getRecords()) { |
| | | // this.getDistance(model.getMember(),orders); |
| | | // } |
| | | // } |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | |
| | | orders.setStatusName(Constants.ordersStatus.getName(orders.getStatus())); |
| | | orders.setCancelStatus(Constants.ZERO); |
| | | if(Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.accept.getKey())&&Constants.equalsInteger(orders.getIsUpdate(),Constants.ONE)){ |
| | | orders.setConfirmCountdown(DateUtil.getXMinuteAfterDate(orders.getIsUpdateTime(),60).getTime() - System.currentTimeMillis()); |
| | | String autoConfirmTime = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.AUTO_CONFIRM).getCode(); |
| | | orders.setConfirmCountdown(DateUtil.getXMinuteAfterDate(orders.getIsUpdateTime(),Integer.valueOf(autoConfirmTime)).getTime() - System.currentTimeMillis()); |
| | | if(orders.getConfirmCountdown()<=Constants.ZERO){ |
| | | orders.setConfirmCountdown(0L); |
| | | } |
| | | } |
| | | |
| | | if(Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.waitPay.getKey())){ |
| | | orders.setCancelCountdown(DateUtil.getXMinuteAfterDate(orders.getCreateTime(),15).getTime() - System.currentTimeMillis()); |
| | | if(orders.getCancelCountdown()<=Constants.ZERO){ |
| | | orders.setCancelCountdown(0L); |
| | | } |
| | | } |
| | | this.getPriceUnit(orders); |
| | | orders.setCanStart(Constants.ZERO); |
| | | if(orders.getStatus() <= Constants.ordersStatus.accept.getKey()){ |
| | | if(Constants.equalsInteger(orders.getReleaseMemberId(),member.getId())){ |
| | | if(Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.accept.getKey())&&orders.getStartDate().getTime() <= System.currentTimeMillis()){ |
| | | orders.setCanStart(Constants.ONE); |
| | | } |
| | | //夿æ¯å¦å¯ä¿®æ¹ å·²åæ¶æ¬¡æ° ä¸ æ¶é´éå¶ |
| | | Integer totalCancelTimes = Integer.valueOf(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RELEASE_CANCEL_TIMES).getCode()); |
| | | Long cancelTimes = ordersMapper.selectCount(new QueryWrapper<Orders>().lambda() |
| | |
| | | BigDecimal lat = orders.getLat(); |
| | | BigDecimal lgt = orders.getLgt(); |
| | | //æ¥è¯¢èå´å
çä¼å |
| | | List<Member> memberList = memberMapper.getList(lgt,lat,orders.getType()); |
| | | List<Member> memberList = memberMapper.getList(lgt,lat,orders.getType(),orders.getReleaseMemberId()); |
| | | // memberMapper.selectList(new MPJLambdaWrapper<Member>() |
| | | // .select(Member::getId,Member::getScore) |
| | | // .select(" ifnull((select r.level from receive_weight r where r.RECEIVE_MAX > RECEIVE_NUM and RECEIVE_NUM > r.RECEIVE_MIN limit 1 ),0) " ,Member::getLevel) |
| | |
| | | Member releaseMember = memberMapper.selectById(orders.getReleaseMemberId()); |
| | | //èªå¨æ´¾å |
| | | Orders model = ordersMapper.selectById(orders.getId()); |
| | | if(!Constants.equalsInteger(model.getStatus(),Constants.ONE) || Constants.equalsInteger(model.getId(),model.getReleaseMemberId())){ |
| | | if(!Constants.equalsInteger(model.getStatus(),Constants.ONE) || Constants.equalsInteger(releaseMember.getId(),model.getReleaseMemberId())){ |
| | | //å¦æè®¢åå·²å é¤ å¹¶ä¸éå叿¹ |
| | | continue; |
| | | } |
| | |
| | | public void autoConfirm(){ |
| | | String autoConfirmTime = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.AUTO_CONFIRM).getCode(); |
| | | List<Orders> ordersList = ordersMapper.selectList(new QueryWrapper<Orders>().lambda() |
| | | .eq(Orders::getStatus,Constants.ordersStatus.accept).eq(Orders::getIsUpdate,Constants.ONE) |
| | | .eq(Orders::getStatus,Constants.ordersStatus.accept.getKey()) |
| | | .eq(Orders::getIsUpdate,Constants.ONE) |
| | | .apply(" DATE_ADD(IS_UPDATE_TIME, INTERVAL "+autoConfirmTime+" MINUTE) < now() ") |
| | | .last("limit 100") |
| | | ); |
| | |
| | | //è®°å½åæä¿®æ¹çæ¥å¿ |
| | | Constants.OrdersLog ordersLog = Constants.OrdersLog.AUTO_AGREE; |
| | | this.saveOrderLog(orders,ordersLog, |
| | | ordersLog.getInfo(),null,null); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //èªå¨åæ¶ è®¢åæªæ¯ä» |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void autoCancelWaitPay(){ |
| | | List<Orders> ordersList = ordersMapper.selectList(new QueryWrapper<Orders>().lambda() |
| | | .eq(Orders::getStatus,Constants.ordersStatus.waitPay) |
| | | .apply(" DATE_ADD(CREATE_TIME, INTERVAL 15 MINUTE) < now() ") |
| | | .last("limit 100") |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ordersList)){ |
| | | for (Orders orders:ordersList) { |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getStatus,Constants.ordersStatus.cancel.getKey()) |
| | | .set(Orders::getUpdateTime,DateUtil.getCurrDateTime()) |
| | | .set(Orders::getCancelTime,DateUtil.getCurrDateTime()) |
| | | .set(Orders::getCancelType,Constants.TWO) |
| | | .eq(Orders::getId,orders.getId()) |
| | | ); |
| | | //è®°å½åæä¿®æ¹çæ¥å¿ |
| | | Constants.OrdersLog ordersLog = Constants.OrdersLog.SYSTEM_CANCEL; |
| | | this.saveOrderLog(orders,ordersLog, |
| | | ordersLog.getInfo(),orders.getAcceptMemberId(),null); |
| | | } |
| | | } |