| | |
| | | import com.wechat.pay.java.service.partnerpayments.jsapi.model.Payer; |
| | | import com.wechat.pay.java.service.partnerpayments.jsapi.model.PrepayRequest; |
| | | import com.wechat.pay.java.service.partnerpayments.jsapi.model.PrepayWithRequestPaymentResponse; |
| | | import com.wechat.pay.java.service.refund.model.RefundNotification; |
| | | import jodd.util.StringUtil; |
| | | import lombok.With; |
| | | import nonapi.io.github.classgraph.json.Id; |
| | | import org.apache.poi.sl.image.ImageHeaderEMF; |
| | | import org.checkerframework.checker.units.qual.A; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 订单信息记录Service实现 |
| | |
| | | private IdentityInfoMapper identityInfoMapper; |
| | | |
| | | @Autowired |
| | | private WithdrawalOrdersMapper withdrawalOrdersMapper; |
| | | |
| | | @Autowired |
| | | private WxMiniUtilService wxMiniUtilService; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String,Object> redisTemplate; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | |
| | | } |
| | | //用餐订单 |
| | | if(Constants.equalsInteger(orders.getType(),Constants.TWO)){ |
| | | orders.setStatus(Constants.ZERO); |
| | | orders.setStatus(Constants.ordersStatus.waitPay.getKey()); |
| | | //唤起支付业务 |
| | | objects = this.getWxPayResponse(orders,orders.getMember().getOpenid()); |
| | | }else{ |
| | | orders.setStatus(Constants.ONE); |
| | | orders.setStatus(Constants.ordersStatus.wait.getKey()); |
| | | } |
| | | ordersMapper.insert(orders); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(orders.getMultifileList())){ |
| | |
| | | if(Objects.isNull(orders)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | orders.setStatusName(Constants.ordersStatus.getName(orders.getStatus())); |
| | | //附件信息 |
| | | List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjId,orders.getId()) |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO).eq(Multifile::getObjType,Constants.ONE).orderByAsc(Multifile::getId)); |
| | |
| | | queryWrapper.eq(Objects.nonNull(model.getType()),Orders::getType, model.getType()); |
| | | queryWrapper.eq(Objects.nonNull(model.getStatus()),Orders::getStatus, model.getStatus()); |
| | | queryWrapper.eq(Objects.nonNull(model.getAcceptType()),Orders::getAcceptType, model.getAcceptType()); |
| | | queryWrapper.like(org.apache.commons.lang3.StringUtils.isNotBlank(model.getReleaseName()),"m1.name", model.getReleaseName()); |
| | | queryWrapper.apply(org.apache.commons.lang3.StringUtils.isNotBlank(model.getAcceptName())," i.LINK_NAME like '%"+model.getAcceptName()+"%' or i.company_name like '%"+model.getAcceptName()+"%' "); |
| | | queryWrapper.apply(org.apache.commons.lang3.StringUtils.isNotBlank(model.getReleaseName()),"m1.name", model.getReleaseName()); |
| | | queryWrapper.apply(org.apache.commons.lang3.StringUtils.isNotBlank(model.getAcceptName()),"( i.LINK_NAME like '%"+model.getAcceptName()+"%' or i.company_name like '%"+model.getAcceptName()+"%' or i.TELEPHONE like '%"+model.getAcceptName()+"%' ) "); |
| | | IPage<Orders> iPage = ordersMapper.selectJoinPage(page,Orders.class,queryWrapper); |
| | | for (Orders orders:iPage.getRecords()) { |
| | | this.getOrderContent(orders); |
| | | orders.setStatusName(Constants.ordersStatus.getName(orders.getStatus())); |
| | | orders.setEstimatedAccountYuan(Objects.nonNull(orders.getEstimatedAccount())&&orders.getEstimatedAccount()>0?orders.getEstimatedAccount()/100:0L); |
| | | orders.setPayAccountYuan(Objects.nonNull(orders.getPayAccount())&&orders.getPayAccount()>0?orders.getPayAccount()/100:0L); |
| | | } |
| | | return PageData.from(iPage); |
| | | } |
| | |
| | | if(Constants.equalsInteger(orders.getType(),Constants.ZERO)){ |
| | | orders.setOrderContent(Constants.workType.getName(orders.getWorkType()) +" | " + orders.getCategoryName()); |
| | | if(Constants.equalsInteger(orders.getWorkType(),Constants.ZERO)){ |
| | | orders.setOrderContent(orders.getOrderContent()+" | " +orders.getPriceNum1()+"斤"); |
| | | if(Objects.nonNull(orders.getPriceNum1())){ |
| | | orders.setOrderContent(orders.getOrderContent()+" | " +orders.getPriceNum1()+"斤"); |
| | | } |
| | | }else if(Constants.equalsInteger(orders.getWorkType(),Constants.ONE)){ |
| | | orders.setOrderContent(orders.getOrderContent()+" | " +orders.getPriceNum2()+"人"); |
| | | if(Objects.nonNull(orders.getPriceNum2())) { |
| | | orders.setOrderContent(orders.getOrderContent() + " | " + orders.getPriceNum2() + "人"); |
| | | } |
| | | }else{ |
| | | if(Constants.equalsInteger(orders.getCarType(),Constants.ZERO)||Constants.equalsInteger(orders.getCarType(),Constants.ONE)){ |
| | | orders.setOrderContent(orders.getOrderContent()+" | " +orders.getPriceNum2()+"人"); |
| | | if(Objects.nonNull(orders.getPriceNum2())) { |
| | | orders.setOrderContent(orders.getOrderContent() + " | " + orders.getPriceNum2() + "人"); |
| | | } |
| | | }else{ |
| | | orders.setOrderContent(orders.getOrderContent()+" | " +orders.getPriceNum1()+"斤"); |
| | | if(Objects.nonNull(orders.getPriceNum1())) { |
| | | orders.setOrderContent(orders.getOrderContent() + " | " + orders.getPriceNum1() + "斤"); |
| | | } |
| | | } |
| | | } |
| | | }else if(Constants.equalsInteger(orders.getType(),Constants.ONE)){ |
| | | orders.setOrderContent( orders.getCategoryName() + " | " + orders.getTransportTypeName() +" | " + orders.getTransportNum() +"斤"); |
| | | if(org.apache.commons.lang3.StringUtils.isNotBlank(orders.getCategoryName())){ |
| | | orders.setOrderContent( orders.getCategoryName() + |
| | | (StringUtils.isEmpty(orders.getTransportTypeName())?"":" | " + orders.getTransportTypeName() ) + |
| | | (Objects.isNull(orders.getTransportNum())?null:" | " + orders.getTransportNum() +"斤")); |
| | | } |
| | | |
| | | if(Constants.equalsInteger(orders.getCarType(),Constants.ZERO)){ |
| | | orders.setOrderContent(orders.getOrderContent()+" | 用车" +orders.getPriceNum2()+"天"); |
| | | if(Objects.nonNull(orders.getPriceNum2())) { |
| | | orders.setOrderContent(orders.getOrderContent() + " | 用车" + orders.getPriceNum2() + "天"); |
| | | } |
| | | }else{ |
| | | orders.setOrderContent(orders.getOrderContent()+" | 用车" +orders.getPriceNum2()+"次"); |
| | | if(Objects.nonNull(orders.getPriceNum2())) { |
| | | orders.setOrderContent(orders.getOrderContent() + " | 用车" + orders.getPriceNum2() + "次"); |
| | | } |
| | | } |
| | | }else{ |
| | | if(org.apache.commons.lang3.StringUtils.isNotBlank(orders.getWayInfo())){ |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ONE)){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.wait.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行该操作"); |
| | | } |
| | | if(Constants.equalsInteger(orders.getReleaseMemberId(),member.getId())){ |
| | |
| | | orders.setAcceptType(Constants.ZERO); |
| | | orders.setAcceptTime(new Date()); |
| | | orders.setAcceptMemberId(member.getId()); |
| | | orders.setStatus(Constants.TWO); |
| | | orders.setStatus(Constants.ordersStatus.accept.getKey()); |
| | | ordersMapper.updateById(orders); |
| | | //更新接单量 |
| | | memberMapper.update(new UpdateWrapper<Member>().lambda().set(Member::getPublishNum," (publish_num + 1 )").eq(Member::getId,member.getId())); |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.TWO)){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.accept.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行该操作"); |
| | | } |
| | | if(Constants.equalsInteger(orders.getReleaseMemberId(),member.getId())){ |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单修改待确认,无法进行该操作"); |
| | | } |
| | | orders.setUpdateTime(new Date()); |
| | | orders.setStatus(Constants.THREE); |
| | | orders.setStatus(Constants.ordersStatus.doing.getKey()); |
| | | orders.setWorkStartTime(new Date()); |
| | | ordersMapper.updateById(orders); |
| | | |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.TWO)){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.accept.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行该操作"); |
| | | } |
| | | if(Constants.equalsInteger(orders.getReleaseMemberId(),updOrderDataDTO.getMember().getId())){ |
| | |
| | | .set(Orders::getEndDate,updOrderDataDTO.getEndDate()) |
| | | .set(Orders::getTotalDays,updOrderDataDTO.getTotalDays()) |
| | | .set(Orders::getIsUpdate,Constants.ONE) |
| | | .set(Orders::getIsUpdateTime,"now()") |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .set(Orders::getEstimatedAccount,total) |
| | | .eq(Orders::getId,orders.getId()) |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.TWO)){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.accept.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行该操作"); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getIsUpdate(),Constants.ONE)){ |
| | |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getIsUpdate,Constants.TWO) |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .set(Orders::getStatus,Constants.ONE) |
| | | .set(Orders::getStatus,Constants.ordersStatus.wait.getKey()) |
| | | .set(Orders::getAcceptMemberId,null) |
| | | .set(Orders::getAcceptType,null) |
| | | .eq(Orders::getId,orders.getId()) |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!(Constants.equalsInteger(orders.getStatus(),Constants.ONE) |
| | | ||Constants.equalsInteger(orders.getStatus(),Constants.ZERO) |
| | | || Constants.equalsInteger(orders.getStatus(),Constants.TWO))){ |
| | | if(!(Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.wait.getKey()) |
| | | ||Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.waitPay.getKey()) |
| | | || Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.accept.getKey()))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行取消"); |
| | | } |
| | | if(Constants.equalsInteger(orders.getReleaseMemberId(),member.getId())){ |
| | |
| | | withdrawalOrders.setCreateTime(new Date()); |
| | | withdrawalOrders.setMemberId(orders.getReleaseMemberId()); |
| | | withdrawalOrders.setAmount(orders.getPayAccount()); |
| | | withdrawalOrders.setWxExternalNo("refund_"+orders.getCode()); |
| | | withdrawalOrders.setStatus(Constants.ONE); |
| | | withdrawalOrders.setStatus(Constants.ZERO); |
| | | withdrawalOrders.setDoneTime(new Date()); |
| | | withdrawalOrders.setType(Constants.ONE); |
| | | withdrawalOrders.setObjId(orders.getId()); |
| | | wxMiniUtilService.wxRefund(withdrawalOrders,orders); |
| | | } |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getStatus,99) |
| | | .set(Orders::getStatus,Constants.ordersStatus.cancel.getKey()) |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .set(Orders::getCancelTime,"now()") |
| | | .set(Orders::getCancelType,Constants.ZERO) |
| | |
| | | Integer totalCancelTimes = Integer.valueOf(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RELEASE_CANCEL_TIMES).getCode()); |
| | | Long cancelTimes = ordersMapper.selectCount(new QueryWrapper<Orders>().lambda() |
| | | .apply(" DATE(cancel_time) = DATE(NOW()) ") |
| | | .eq(Orders::getStatus,99) |
| | | .eq(Orders::getStatus,Constants.ordersStatus.cancel.getKey()) |
| | | .eq(Orders::getReleaseMemberId,orders.getReleaseMemberId())); |
| | | //查询取消次数 |
| | | if(totalCancelTimes<=cancelTimes){ |
| | |
| | | wxMiniUtilService.wxRefund(withdrawalOrders,orders); |
| | | } |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getStatus,99) |
| | | .set(Orders::getStatus,Constants.ordersStatus.cancel.getKey()) |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .set(Orders::getCancelTime,"now()") |
| | | .set(Orders::getCancelType,Constants.ONE) |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.TWO)){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.accept.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行取消"); |
| | | } |
| | | if(Constants.equalsInteger(orders.getAcceptMemberId(),member.getId())){ |
| | |
| | | } |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .set(Orders::getStatus,Constants.ONE) |
| | | .set(Orders::getStatus,Constants.ordersStatus.wait.getKey()) |
| | | .set(Orders::getAcceptMemberId,null) |
| | | .set(Orders::getAcceptType,null) |
| | | .eq(Orders::getId,orders.getId()) |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.THREE)){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.doing.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行取消"); |
| | | } |
| | | if(Constants.equalsInteger(orders.getReleaseMemberId(),doneOrderDTO.getMember().getId())){ |
| | |
| | | //唤起支付业务 |
| | | object = this.getWxPayResponse(orders,orders.getMember().getOpenid()); |
| | | }else{ |
| | | orders.setStatus(Constants.FOUR); |
| | | orders.setStatus(Constants.ordersStatus.done.getKey()); |
| | | //日志存储 |
| | | Constants.OrdersLog ordersLog = Constants.OrdersLog.DONE; |
| | | this.saveOrderLog(orders,ordersLog, |
| | |
| | | if(Objects.isNull(orders)||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!(Constants.equalsInteger(orders.getStatus(),Constants.ONE)||Constants.equalsInteger(orders.getStatus(),Constants.TWO) |
| | | ||Constants.equalsInteger(orders.getStatus(),Constants.THREE))){ |
| | | if(!(Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.wait.getKey())||Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.accept.getKey()) |
| | | ||Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.doing.getKey())||Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.waitPay.getKey()))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行取消"); |
| | | } |
| | | //如果已支付 则需要进行退款 |
| | |
| | | } |
| | | |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getStatus,99) |
| | | .set(Orders::getStatus,Constants.ordersStatus.cancel.getKey()) |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .set(Orders::getCancelTime,"now()") |
| | | .set(Orders::getCancelType,Constants.TWO) |
| | |
| | | ||Constants.equalsInteger(orders.getDeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.FOUR)){ |
| | | if(!Constants.equalsInteger(orders.getStatus(),Constants.ordersStatus.done.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"订单状态已流转,无法进行评价"); |
| | | } |
| | | if(Constants.equalsInteger(orders.getCommentStatus(),Constants.ONE)){ |
| | |
| | | //处理支付完成逻辑 |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .set(Orders::getStatus,Constants.ONE) |
| | | .set(Orders::getStatus,Constants.ordersStatus.wait) |
| | | .set(Orders::getPayStatus,Constants.ONE) |
| | | .set(Orders::getWxExternalNo,paymentNo) |
| | | .eq(Orders::getId,orders.getId()) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public synchronized String getNextCode(Integer type){ |
| | | // String prefix = "YG"; |
| | | // if(!Constants.equalsInteger(type,Constants.ZERO)){ |
| | | // prefix = (Constants.equalsInteger(type,Constants.ONE)?"YC-":"SC-"); |
| | | // } |
| | | // prefix = DateUtil.getDate(new Date(),"yyyyMMdd") +"-"; |
| | | // Integer countNum = RedisUtil.getObject(redisTemplate, Constants.RedisKeys.ORDER_CODE, Integer.class); |
| | | // countNum = Constants.formatIntegerNum(countNum)+1; |
| | | // //更新缓存 |
| | | // RedisUtil.addObject(redisTemplate,Constants.RedisKeys.ORDER_CODE,countNum); |
| | | // String nextIndex =Integer.toString( countNum ); |
| | | // return prefix + org.apache.commons.lang3.StringUtils.leftPad(nextIndex,3,"0"); |
| | | return null; |
| | | String prefix = "YG"; |
| | | if(!Constants.equalsInteger(type,Constants.ZERO)){ |
| | | prefix = (Constants.equalsInteger(type,Constants.ONE)?"YH-":"DC-"); |
| | | } |
| | | prefix = DateUtil.getDate(new Date(),"yyyyMMddHHmmss") +"-"; |
| | | |
| | | Integer countNum = (Integer) redisTemplate.opsForValue().get(Constants.RedisKeys.ORDER_CODE);//RedisUtil.getObject(redisTemplate, Constants.RedisKeys.ORDER_CODE, Integer.class); |
| | | countNum = Constants.formatIntegerNum(countNum)+1; |
| | | //更新缓存 |
| | | redisTemplate.opsForValue().set(Constants.RedisKeys.ORDER_CODE,countNum); |
| | | String nextIndex =Integer.toString( countNum ); |
| | | return prefix + org.apache.commons.lang3.StringUtils.leftPad(nextIndex,3,"0"); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void refundCallback(RefundNotification refundNotification){ |
| | | WithdrawalOrders withdrawalOrders = withdrawalOrdersMapper.selectById(refundNotification.getOutRefundNo()); |
| | | if(Objects.isNull(withdrawalOrders)||!Constants.equalsInteger(withdrawalOrders.getStatus(),Constants.ZERO)){ |
| | | return; |
| | | } |
| | | withdrawalOrders.setWxExternalNo(refundNotification.getTransactionId()); |
| | | withdrawalOrders.setUpdateTime(new Date()); |
| | | withdrawalOrders.setDoneTime(withdrawalOrders.getUpdateTime()); |
| | | if (!"SUCCESS".equals(refundNotification.getRefundStatus().name())) { |
| | | // 如果退款状态不正确,修改退款单状态 |
| | | withdrawalOrders.setStatus(Constants.TWO); |
| | | }else{ |
| | | withdrawalOrders.setStatus(Constants.ONE); |
| | | } |
| | | //更新退款单状态 |
| | | withdrawalOrdersMapper.updateById(withdrawalOrders); |
| | | } |
| | | |
| | | |
| | | |
| | | //todo 自动派单 |
| | | public void autoGrabOrders(){ |
| | | |
| | | |
| | | } |
| | | |
| | | //自动评价 订单完成7天后自动评价4星 |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void autoComment(){ |
| | | List<Orders> ordersList = ordersMapper.selectList(new QueryWrapper<Orders>().lambda() |
| | | .eq(Orders::getStatus,Constants.FOUR).eq(Orders::getCommentStatus,Constants.ZERO) |
| | | .apply(" DATE_ADD(finish_time, INTERVAL 7 DAY) < now() ") |
| | | .last("limit 100") |
| | | ); |
| | | |
| | | for (Orders orders:ordersList) { |
| | | ordersMapper.update(new UpdateWrapper<Orders>().lambda() |
| | | .set(Orders::getCommentStatus,Constants.ONE) |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .set(Orders::getCommentTime,"now()") |
| | | .set(Orders::getCommentLevel,Constants.FOUR) |
| | | .set(Orders::getCommentType,Constants.ZERO) |
| | | .eq(Orders::getId,orders.getId()) |
| | | ); |
| | | |
| | | memberMapper.update(new UpdateWrapper<Member>().lambda() |
| | | .set(Member::getScore," ( total_score +" + Constants.FOUR + " ) / (score_order_num + 1 )") |
| | | .set(Member::getTotalScore," total_score +" + Constants.FOUR) |
| | | .set(Member::getScoreOrderNum," score_order_num + 1 " ).eq(Member::getId,orders.getAcceptMemberId()) |
| | | ); |
| | | |
| | | //日志存储 |
| | | Constants.OrdersLog ordersLog = Constants.OrdersLog.AUTO_COMMENT; |
| | | this.saveOrderLog(orders,ordersLog, |
| | | ordersLog.getInfo(),orders.getAcceptMemberId(),null); |
| | | } |
| | | } |
| | | |
| | | |
| | | //自动确认 订单修改后若未处理 根据配置自动处理 |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | 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) |
| | | .apply(" DATE_ADD(IS_UPDATE_TIME, INTERVAL "+autoConfirmTime+" 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::getIsUpdate,Constants.TWO) |
| | | .set(Orders::getUpdateTime,"now()") |
| | | .eq(Orders::getId,orders.getId()) |
| | | ); |
| | | //记录同意修改的日志 |
| | | Constants.OrdersLog ordersLog = Constants.OrdersLog.AUTO_AGREE; |
| | | this.saveOrderLog(orders,ordersLog, |
| | | ordersLog.getInfo(),orders.getAcceptMemberId(),null); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |