1 files added
23 files modified
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分布式ID生成器 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期,注意:这里将会替换原有的时间 |
| | | * @return true成功 false 失败 |
| | | */ |
| | | public boolean setIfAbsent(String key, Object value, long time) { |
| | | try { |
| | | if (time > 0) { |
| | | Boolean result = redisTemplate.opsForValue().setIfAbsent(key, value, time, TimeUnit.SECONDS); |
| | | return result; |
| | | } else { |
| | | return false; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | return false; |
| | | } |
| | | } |
| | | // ================================Map================================= |
| | | |
| | | /** |
| | |
| | | <#list queryColumns as column> |
| | | <#if column.queryType != 'BetWeen'> |
| | | <label class="el-form-item-label"><#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if></label> |
| | | <el-input v-model="query.${column.changeColumnName}" clearable placeholder="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-input v-model="query.${column.changeColumnName}" clearable placeholder="请输入" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | </#if> |
| | | </#list> |
| | | </#if> |
| | |
| | | <#if column.queryType = 'BetWeen'> |
| | | <date-range-picker |
| | | v-model="query.${column.changeColumnName}" |
| | | start-placeholder="${column.changeColumnName}Start" |
| | | end-placeholder="${column.changeColumnName}Start" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | class="date-item" |
| | | /> |
| | | </#if> |
| | |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-dialog :close-on-click-modal="true" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="600px"> |
| | | <el-form ref="form" :model="form" <#if isNotNullColumns??>:rules="rules"</#if> size="small" label-width="80px"> |
| | | <#if columns??> |
| | | <#list columns as column> |
| | | <#if column.formShow> |
| | | <el-form-item label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>"<#if column.istNotNull> prop="${column.changeColumnName}"</#if>> |
| | | <#if column.formType = 'Input'> |
| | | <el-input v-model="form.${column.changeColumnName}" style="width: 370px;" /> |
| | | <el-input v-model="form.${column.changeColumnName}" placeholder="请输入" style="width: 370px;" /> |
| | | <#elseif column.formType = 'Textarea'> |
| | | <el-input v-model="form.${column.changeColumnName}" :rows="3" type="textarea" style="width: 370px;" /> |
| | | <el-input v-model="form.${column.changeColumnName}" placeholder="请输入" :rows="3" type="textarea" style="width: 370px;" /> |
| | | <#elseif column.formType = 'Radio'> |
| | | <#if (column.dictName)?? && (column.dictName)!=""> |
| | | <el-radio v-model="form.${column.changeColumnName}" v-for="item in dict.${column.dictName}" :key="item.id" :label="item.value">{{ item.label }}</el-radio> |
| | |
| | | v-for="item in dict.${column.dictName}" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | placeholder="请选择" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | <#else> |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" max-height="600" border size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <#if columns??> |
| | | <#list columns as column> |
| | | <#if column.columnShow> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <#else> |
| | | <el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" /> |
| | | <el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" :show-overflow-tooltip="true" align="center" /> |
| | | </#if> |
| | | </#if> |
| | | </#list> |
| | |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import DateRangePicker from '@/components/DateRangePicker' |
| | | |
| | | |
| | | const defaultForm = { <#if columns??><#list columns as column>${column.changeColumnName}: null<#if column_has_next>, </#if></#list></#if> } |
| | | export default { |
| | | name: '${className}', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { DateRangePicker, pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | <#if hasDict> |
| | | dicts: [<#if hasDict??><#list dicts as dict>'${dict}'<#if dict_has_next>, </#if></#list></#if>], |
| | | </#if> |
| | | cruds() { |
| | | return CRUD({ title: '${apiAlias}', url: 'api/${changeClassName}', idField: '${pkChangeColName}', sort: '${pkChangeColName},desc', crudMethod: { ...crud${className} }}) |
| | | return CRUD({ |
| | | title: '${apiAlias}', |
| | | url: 'api/${changeClassName}', |
| | | idField: '${pkChangeColName}', |
| | | sort: '${pkChangeColName},desc', |
| | | crudMethod: { ...crud${className} }, |
| | | optShow: { |
| | | add: false, |
| | | edit: false, |
| | | del: true, |
| | | reset: true, |
| | | download: true |
| | | }, |
| | | }) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', '${changeClassName}:add'], |
| | | edit: ['admin', '${changeClassName}:edit'], |
| | | del: ['admin', '${changeClassName}:del'] |
| | | del: ['admin', '${changeClassName}:del'], |
| | | download: ['admin', '${changeClassName}:download'] |
| | | }, |
| | | rules: { |
| | | <#if isNotNullColumns??> |
| | |
| | | @ApiModelProperty(value = "收货地址") |
| | | private String receiverAddress; |
| | | |
| | | @ApiModelProperty(value = "订单状态: 1-待取货 2-配送中 3-已完成 4-商家取消 5-骑手取消 6-客户取消 7-系统取消") |
| | | @ApiModelProperty(value = "订单状态: 0-已接单 1-已到店 2-配送中 3-已完成 4-商家取消 5-骑手取消 6-客户取消 7-系统取消") |
| | | private String orderStatus; |
| | | |
| | | @ApiModelProperty(value = "接单时间") |
| | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "配送费详情Id") |
| | | private String deliveryFeeId; |
| | | |
| | | public void copy(RiderOrderRecord source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | |
| | | public static final String COL_ORDER_NUM = "order_num"; |
| | | } |
| | |
| | | @Setter |
| | | public class RiderSourceInfoHttp implements Serializable { |
| | | |
| | | private String success; |
| | | |
| | | private String code; |
| | | |
| | | private String message; |
| | |
| | | @ApiModelProperty(value = "钱包状态(0冻结,1正常)") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "骑手姓名") |
| | | private String cardName; |
| | | |
| | | @ApiModelProperty(value = "骑手身份证号") |
| | | private String cardNum; |
| | | |
| | | public void copy(RiderWalletInfo source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | |
| | | |
| | | @ApiModelProperty(value = "钱包状态(0冻结,1正常)") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "骑手姓名") |
| | | private String cardName; |
| | | |
| | | @ApiModelProperty(value = "骑手身份证号") |
| | | private String cardNum; |
| | | |
| | | private List<BigDecimal> amount; |
| | | |
| | | private List<Timestamp> createTime; |
| | | } |
New file |
| | |
| | | package com.oying.modules.rider.domain.vo; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.oying.base.BaseEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @description / |
| | | * @author pxb |
| | | * @date 2025-06-18 |
| | | **/ |
| | | @Getter |
| | | @Setter |
| | | public class OrderRiderOperationVo implements Serializable { |
| | | |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNum; |
| | | |
| | | @ApiModelProperty(value = "骑手操作类型 1-上报到店 2-上报已取商品") |
| | | private String operationType; |
| | | |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.dto.RiderIncomeDetailQueryCriteria; |
| | | import com.oying.modules.rider.service.RiderIncomeDetailService; |
| | | import com.oying.modules.rider.domain.RiderIncomeDetail; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @author pxb |
| | | * @date 2025-06-18 |
| | | **/ |
| | | * @author pxb |
| | | * @date 2025-06-18 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "骑手收入明细") |
| | | @Api(tags = "骑手:骑手收入明细") |
| | | @RequestMapping("/api/rider/riderIncomeDetail") |
| | | public class RiderIncomeDetailController { |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询骑手收入明细") |
| | | @PreAuthorize("@el.check('riderIncomeDetail:list')") |
| | | public ResponseEntity<PageResult<RiderIncomeDetail>> queryRiderIncomeDetail(RiderIncomeDetailQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryRiderIncomeDetail(RiderIncomeDetailQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(riderIncomeDetailService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(riderIncomeDetailService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增骑手收入明细") |
| | | @ApiOperation("新增骑手收入明细") |
| | | @PreAuthorize("@el.check('riderIncomeDetail:add')") |
| | | public ResponseEntity<Object> createRiderIncomeDetail(@Validated @RequestBody RiderIncomeDetail resources){ |
| | | public ResponseEntity<Object> createRiderIncomeDetail(@Validated @RequestBody RiderIncomeDetail resources) { |
| | | riderIncomeDetailService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改骑手收入明细") |
| | | @ApiOperation("修改骑手收入明细") |
| | | @PreAuthorize("@el.check('riderIncomeDetail:edit')") |
| | | public ResponseEntity<Object> updateRiderIncomeDetail(@Validated @RequestBody RiderIncomeDetail resources){ |
| | | public ResponseEntity<Object> updateRiderIncomeDetail(@Validated @RequestBody RiderIncomeDetail resources) { |
| | | riderIncomeDetailService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('riderIncomeDetail:del')") |
| | | public ResponseEntity<Object> deleteRiderIncomeDetail(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | riderIncomeDetailService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.RiderInfo; |
| | | import com.oying.modules.rider.service.RiderInfoService; |
| | | import com.oying.modules.rider.domain.dto.RiderInfoQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.util.List; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "三方骑手数据信息") |
| | | @Api(tags = "骑手:三方骑手数据信息") |
| | | @RequestMapping("/api/rider/riderInfo") |
| | | public class RiderInfoController { |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询三方骑手数据信息") |
| | | @PreAuthorize("@el.check('riderInfo:list')") |
| | | public ResponseEntity<PageResult<RiderInfo>> queryRiderInfo(RiderInfoQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryRiderInfo(RiderInfoQueryCriteria criteria){ |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(riderInfoService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(riderInfoService.queryAll(criteria,page)),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | @PreAuthorize("@el.check('riderInfo:add')") |
| | | public ResponseEntity<Object> createRiderInfo(@Validated @RequestBody RiderInfo resources){ |
| | | riderInfoService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | |
| | | @PreAuthorize("@el.check('riderInfo:edit')") |
| | | public ResponseEntity<Object> updateRiderInfo(@Validated @RequestBody RiderInfo resources){ |
| | | riderInfoService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('riderInfo:del')") |
| | | public ResponseEntity<Object> deleteRiderInfo(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | riderInfoService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.RiderOrderOperation; |
| | | import com.oying.modules.rider.service.RiderOrderOperationService; |
| | | import com.oying.modules.rider.domain.dto.RiderOrderOperationQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @author pxb |
| | | * @date 2025-06-18 |
| | | **/ |
| | | * @author pxb |
| | | * @date 2025-06-18 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "骑手订单操作日志") |
| | | @Api(tags = "骑手:骑手订单操作日志") |
| | | @RequestMapping("/api/rider/riderOrderOperation") |
| | | public class RiderOrderOperationController { |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询骑手订单操作日志") |
| | | @PreAuthorize("@el.check('riderOrderOperation:list')") |
| | | public ResponseEntity<PageResult<RiderOrderOperation>> queryRiderOrderOperation(RiderOrderOperationQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryRiderOrderOperation(RiderOrderOperationQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(riderOrderOperationService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(riderOrderOperationService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增骑手订单操作日志") |
| | | @ApiOperation("新增骑手订单操作日志") |
| | | @PreAuthorize("@el.check('riderOrderOperation:add')") |
| | | public ResponseEntity<Object> createRiderOrderOperation(@Validated @RequestBody RiderOrderOperation resources){ |
| | | public ResponseEntity<Object> createRiderOrderOperation(@Validated @RequestBody RiderOrderOperation resources) { |
| | | riderOrderOperationService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改骑手订单操作日志") |
| | | @ApiOperation("修改骑手订单操作日志") |
| | | @PreAuthorize("@el.check('riderOrderOperation:edit')") |
| | | public ResponseEntity<Object> updateRiderOrderOperation(@Validated @RequestBody RiderOrderOperation resources){ |
| | | public ResponseEntity<Object> updateRiderOrderOperation(@Validated @RequestBody RiderOrderOperation resources) { |
| | | riderOrderOperationService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('riderOrderOperation:del')") |
| | | public ResponseEntity<Object> deleteRiderOrderOperation(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | riderOrderOperationService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.RiderOrderRecord; |
| | | import com.oying.modules.rider.service.RiderOrderRecordService; |
| | | import com.oying.modules.rider.domain.dto.RiderOrderRecordQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.util.List; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "骑手订单信息") |
| | | @Api(tags = "骑手:骑手订单信息") |
| | | @RequestMapping("/api/rider/riderOrderRecord") |
| | | public class RiderOrderRecordController { |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询骑手订单信息") |
| | | @PreAuthorize("@el.check('riderOrderRecord:list')") |
| | | public ResponseEntity<PageResult<RiderOrderRecord>> queryRiderOrderRecord(RiderOrderRecordQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryRiderOrderRecord(RiderOrderRecordQueryCriteria criteria){ |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(riderOrderRecordService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(riderOrderRecordService.queryAll(criteria,page)),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | @PreAuthorize("@el.check('riderOrderRecord:add')") |
| | | public ResponseEntity<Object> createRiderOrderRecord(@Validated @RequestBody RiderOrderRecord resources){ |
| | | riderOrderRecordService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | |
| | | @PreAuthorize("@el.check('riderOrderRecord:edit')") |
| | | public ResponseEntity<Object> updateRiderOrderRecord(@Validated @RequestBody RiderOrderRecord resources){ |
| | | riderOrderRecordService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('riderOrderRecord:del')") |
| | | public ResponseEntity<Object> deleteRiderOrderRecord(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | riderOrderRecordService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.RiderOrderReminder; |
| | | import com.oying.modules.rider.service.RiderOrderReminderService; |
| | | import com.oying.modules.rider.domain.dto.RiderOrderReminderQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.util.List; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "骑手消息提示记录") |
| | | @Api(tags = "骑手:骑手消息提示记录") |
| | | @RequestMapping("/api/rider/riderOrderReminder") |
| | | public class RiderOrderReminderController { |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询骑手消息提示记录") |
| | | @PreAuthorize("@el.check('riderOrderReminder:list')") |
| | | public ResponseEntity<PageResult<RiderOrderReminder>> queryRiderOrderReminder(RiderOrderReminderQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryRiderOrderReminder(RiderOrderReminderQueryCriteria criteria){ |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(riderOrderReminderService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(riderOrderReminderService.queryAll(criteria,page)),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | @PreAuthorize("@el.check('riderOrderReminder:add')") |
| | | public ResponseEntity<Object> createRiderOrderReminder(@Validated @RequestBody RiderOrderReminder resources){ |
| | | riderOrderReminderService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | |
| | | @PreAuthorize("@el.check('riderOrderReminder:edit')") |
| | | public ResponseEntity<Object> updateRiderOrderReminder(@Validated @RequestBody RiderOrderReminder resources){ |
| | | riderOrderReminderService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('riderOrderReminder:del')") |
| | | public ResponseEntity<Object> deleteRiderOrderReminder(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | riderOrderReminderService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.RiderWalletInfo; |
| | | import com.oying.modules.rider.service.RiderWalletInfoService; |
| | | import com.oying.modules.rider.domain.dto.RiderWalletInfoQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.util.List; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "骑手钱包详情") |
| | | @Api(tags = "骑手:骑手钱包详情") |
| | | @RequestMapping("/api/rider/riderWalletInfo") |
| | | public class RiderWalletInfoController { |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询骑手钱包详情") |
| | | @PreAuthorize("@el.check('riderWalletInfo:list')") |
| | | public ResponseEntity<PageResult<RiderWalletInfo>> queryRiderWalletInfo(RiderWalletInfoQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryRiderWalletInfo(RiderWalletInfoQueryCriteria criteria){ |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(riderWalletInfoService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(riderWalletInfoService.queryAll(criteria,page)),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | @PreAuthorize("@el.check('riderWalletInfo:add')") |
| | | public ResponseEntity<Object> createRiderWalletInfo(@Validated @RequestBody RiderWalletInfo resources){ |
| | | riderWalletInfoService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | |
| | | @PreAuthorize("@el.check('riderWalletInfo:edit')") |
| | | public ResponseEntity<Object> updateRiderWalletInfo(@Validated @RequestBody RiderWalletInfo resources){ |
| | | riderWalletInfoService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('riderWalletInfo:del')") |
| | | public ResponseEntity<Object> deleteRiderWalletInfo(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | riderWalletInfoService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.RiderWithdrawalRecord; |
| | | import com.oying.modules.rider.service.RiderWithdrawalRecordService; |
| | | import com.oying.modules.rider.domain.dto.RiderWithdrawalRecordQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.util.List; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "骑手提现记录") |
| | | @Api(tags = "骑手:骑手提现记录") |
| | | @RequestMapping("/api/rider/riderWithdrawalRecord") |
| | | public class RiderWithdrawalRecordController { |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("查询骑手提现记录") |
| | | @PreAuthorize("@el.check('riderWithdrawalRecord:list')") |
| | | public ResponseEntity<PageResult<RiderWithdrawalRecord>> queryRiderWithdrawalRecord(RiderWithdrawalRecordQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryRiderWithdrawalRecord(RiderWithdrawalRecordQueryCriteria criteria){ |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(riderWithdrawalRecordService.queryAll(criteria,page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(riderWithdrawalRecordService.queryAll(criteria,page)),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | @PreAuthorize("@el.check('riderWithdrawalRecord:add')") |
| | | public ResponseEntity<Object> createRiderWithdrawalRecord(@Validated @RequestBody RiderWithdrawalRecord resources){ |
| | | riderWithdrawalRecordService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | |
| | | @PreAuthorize("@el.check('riderWithdrawalRecord:edit')") |
| | | public ResponseEntity<Object> updateRiderWithdrawalRecord(@Validated @RequestBody RiderWithdrawalRecord resources){ |
| | | riderWithdrawalRecordService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | |
| | | @PreAuthorize("@el.check('riderWithdrawalRecord:del')") |
| | | public ResponseEntity<Object> deleteRiderWithdrawalRecord(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { |
| | | riderWithdrawalRecordService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.dto.RiderIncomeDetailQueryCriteria; |
| | | import com.oying.modules.rider.domain.dto.RiderOrderRecordQueryCriteria; |
| | | import com.oying.modules.rider.domain.dto.RiderWithdrawalRecordQueryCriteria; |
| | | import com.oying.modules.rider.domain.vo.OrderRiderOperationVo; |
| | | import com.oying.modules.rider.service.*; |
| | | import com.oying.modules.rider.utils.Constants; |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "骑手微信小程序接口") |
| | | @Api(tags = "骑手小程序:骑手微信小程序接口") |
| | | @RequestMapping("/api/wx/rider") |
| | | public class WxRiderController { |
| | | |
| | |
| | | @GetMapping("getRiderSourceInfo/{riderId}") |
| | | @ApiOperation("查询第三方数据骑手信息") |
| | | @PreAuthorize("@el.check('riderInfo:list')") |
| | | public ResponseEntity<?> getRiderSourceInfo(@PathVariable String riderId) { |
| | | public ResponseEntity<?> getRiderSourceInfo(@PathVariable Long riderId) { |
| | | RiderInfo riderInfo = riderInfoService.getRiderSourceInfo(riderId); |
| | | return ResponseEntity.ok(R.success(riderInfo)); |
| | | } |
| | |
| | | return ResponseEntity.ok(R.success(riderOrderRecordPageResult)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("riderGrabOrder/{orderNum}") |
| | | @ApiOperation("骑手接单") |
| | | @PreAuthorize("@el.check('riderOrderRecord:list')") |
| | | public ResponseEntity<?> riderGrabOrder(@PathVariable String orderNum) { |
| | | // 订单号不能为空 |
| | | if (orderNum == null || orderNum.equals("")) { |
| | | return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空")); |
| | | } |
| | | R result = riderOrderRecordService.riderGrabOrder(orderNum); |
| | | return ResponseEntity.ok(result); |
| | | } |
| | | |
| | | @GetMapping("riderCancelOrder/{orderNum}") |
| | | @ApiOperation("骑手取消接单") |
| | | @PreAuthorize("@el.check('riderOrderRecord:list')") |
| | | public ResponseEntity<?> riderCancelOrder(@PathVariable String orderNum) { |
| | | // 订单号不能为空 |
| | | if (orderNum == null || orderNum.equals("")) { |
| | | return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空")); |
| | | } |
| | | R result = riderOrderRecordService.riderCancelOrder(orderNum); |
| | | return ResponseEntity.ok(R.success(result)); |
| | | } |
| | | |
| | | // @GetMapping("riderCancelOrder/{orderNum}") |
| | | // @ApiOperation("骑手订单已送达") |
| | | // @PreAuthorize("@el.check('riderOrderRecord:list')") |
| | | // public ResponseEntity<?> riderCancelOrder(@PathVariable String orderNum) { |
| | | // // 订单号不能为空 |
| | | // if (orderNum == null || orderNum.equals("")) { |
| | | // return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空")); |
| | | // } |
| | | // R result = riderOrderRecordService.riderCancelOrder(orderNum); |
| | | // return ResponseEntity.ok(R.success(result)); |
| | | // } |
| | | |
| | | @GetMapping("riderOperationOrder") |
| | | @ApiOperation("骑手上报到店") |
| | | @PreAuthorize("@el.check('riderOrderRecord:list')") |
| | | public ResponseEntity<?> riderOperationOrder(OrderRiderOperationVo orderRiderOperation) { |
| | | // 订单号不能为空 |
| | | if (orderRiderOperation.getOrderNum() == null || orderRiderOperation.getOrderNum().equals("")) { |
| | | return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空")); |
| | | } |
| | | R result = riderOrderRecordService.riderOperationOrder(orderRiderOperation); |
| | | return ResponseEntity.ok(R.success(result)); |
| | | } |
| | | |
| | | // @GetMapping("riderCancelOrder/{orderNum}") |
| | | // @ApiOperation("骑手已取餐") |
| | | // @PreAuthorize("@el.check('riderOrderRecord:list')") |
| | | // public ResponseEntity<?> riderCancelOrder(@PathVariable String orderNum) { |
| | | // // 订单号不能为空 |
| | | // if (orderNum == null || orderNum.equals("")) { |
| | | // return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空")); |
| | | // } |
| | | // R result = riderOrderRecordService.riderCancelOrder(orderNum); |
| | | // return ResponseEntity.ok(R.success(result)); |
| | | // } |
| | | |
| | | } |
| | |
| | | * @return RiderInfo |
| | | * @param riderId / |
| | | */ |
| | | RiderInfo getRiderSourceInfo(String riderId); |
| | | RiderInfo getRiderSourceInfo(Long riderId); |
| | | } |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.oying.modules.rider.domain.vo.OrderRiderOperationVo; |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.R; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * @description 服务接口 |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<RiderOrderRecord> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 骑手接单 |
| | | * @param orderNum |
| | | * @throws IOException / |
| | | */ |
| | | R riderGrabOrder(String orderNum); |
| | | |
| | | /** |
| | | * 骑手取消接单 |
| | | * @param orderNum |
| | | * @throws IOException / |
| | | */ |
| | | R riderCancelOrder(String orderNum); |
| | | |
| | | /** |
| | | * 修改骑手端订单状态 |
| | | * @param orderNum |
| | | * @throws IOException / |
| | | */ |
| | | void updateRiderOrderStatus(String orderNum, String orderStatus); |
| | | |
| | | /** |
| | | * 骑手订单状态修改 |
| | | * @param orderRiderOperation |
| | | * @throws IOException / |
| | | */ |
| | | R riderOperationOrder(OrderRiderOperationVo orderRiderOperation); |
| | | } |
| | |
| | | import com.oying.modules.rider.domain.RiderInfo; |
| | | import com.oying.modules.rider.domain.RiderSourceInfo; |
| | | import com.oying.modules.rider.domain.RiderSourceInfoHttp; |
| | | import com.oying.modules.rider.domain.RiderWalletInfo; |
| | | import com.oying.modules.rider.service.RiderWalletInfoService; |
| | | import com.oying.modules.rider.utils.Constants; |
| | | import com.oying.modules.rider.utils.RiderSourceHttpUtils; |
| | | import com.oying.utils.FileUtil; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | public class RiderInfoServiceImpl extends ServiceImpl<RiderInfoMapper, RiderInfo> implements RiderInfoService { |
| | | |
| | | private final RiderInfoMapper riderInfoMapper; |
| | | |
| | | private final RiderWalletInfoService riderWalletInfoService; |
| | | |
| | | @Override |
| | | public PageResult<RiderInfo> queryAll(RiderInfoQueryCriteria criteria, Page<Object> page) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void syncRiderSourceInfo(String sourcePlatform) { |
| | | Long riderId = SecurityUtils.getCurrentUserId(); |
| | | // 查询其他平台的数据 |
| | |
| | | newRiderInfo.setRiderId(riderId); |
| | | newRiderInfo.setSourcePlatform(sourcePlatform); |
| | | create(newRiderInfo); |
| | | // 创建骑手钱包信息 正常 |
| | | RiderWalletInfo riderWalletInfo = new RiderWalletInfo(); |
| | | riderWalletInfo.setRiderId(riderId); |
| | | riderWalletInfo.setAmount(new BigDecimal(0.00)); |
| | | riderWalletInfo.setAvailableBalance(new BigDecimal(0.00)); |
| | | riderWalletInfo.setPurchasingElectricityAmount(new BigDecimal(0.00)); |
| | | riderWalletInfo.setWithdrawTotal(new BigDecimal(0.00)); |
| | | riderWalletInfo.setIncomeTotal(new BigDecimal(0.00)); |
| | | riderWalletInfo.setFrozenAmount(new BigDecimal(0.00)); |
| | | riderWalletInfo.setRunTotal(Constants.ZERO); |
| | | riderWalletInfo.setCashWithdrawalTotal(Constants.ZERO); |
| | | riderWalletInfo.setPurchasingElectricityTotal(Constants.ZERO); |
| | | riderWalletInfo.setStatus(Constants.WALLET_STATUS_NORMAL); |
| | | riderWalletInfo.setPhone(infoHttpData.getPhone()); |
| | | riderWalletInfo.setCardName(infoHttpData.getCardName()); |
| | | riderWalletInfo.setCardNum(infoHttpData.getCardNum()); |
| | | riderWalletInfoService.create(riderWalletInfo); |
| | | } else { |
| | | // 是否相同平台 |
| | | if (sourcePlatform.equals(riderInfo.getSourcePlatform())) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public RiderInfo getRiderSourceInfo(String riderId) { |
| | | public RiderInfo getRiderSourceInfo(Long riderId) { |
| | | QueryWrapper<RiderInfo> riderInfoQueryWrapper = new QueryWrapper<>(); |
| | | riderInfoQueryWrapper.eq(RiderInfo.COL_RIDER_ID, riderId); |
| | | return riderInfoMapper.selectOne(riderInfoQueryWrapper); |
| | |
| | | package com.oying.modules.rider.service.impl; |
| | | |
| | | import cn.hutool.core.lang.UUID; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.modules.pc.store.domain.Store; |
| | | import com.oying.modules.pc.store.service.StoreService; |
| | | import com.oying.modules.rider.domain.RiderInfo; |
| | | import com.oying.modules.rider.domain.RiderOrderRecord; |
| | | import com.oying.utils.FileUtil; |
| | | import com.oying.modules.rider.domain.vo.OrderRiderOperationVo; |
| | | import com.oying.modules.rider.service.RiderInfoService; |
| | | import com.oying.modules.rider.utils.Constants; |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | | import com.oying.modules.sh.service.OrderService; |
| | | import com.oying.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.oying.modules.rider.mapper.RiderOrderRecordMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @description 服务实现 |
| | | * @author pxb |
| | | * @date 2025-07-01 |
| | | **/ |
| | | * @author pxb |
| | | * @description 服务实现 |
| | | * @date 2025-07-01 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class RiderOrderRecordServiceImpl extends ServiceImpl<RiderOrderRecordMapper, RiderOrderRecord> implements RiderOrderRecordService { |
| | | |
| | | private final RiderOrderRecordMapper riderOrderRecordMapper; |
| | | private final RedisUtils redisUtils; |
| | | private final OrderService orderService; |
| | | private final RiderInfoService riderInfoService; |
| | | private final StoreService storeService; |
| | | |
| | | @Override |
| | | public PageResult<RiderOrderRecord> queryAll(RiderOrderRecordQueryCriteria criteria, Page<Object> page){ |
| | | public PageResult<RiderOrderRecord> queryAll(RiderOrderRecordQueryCriteria criteria, Page<Object> page) { |
| | | return PageUtil.toPage(riderOrderRecordMapper.findAll(criteria, page)); |
| | | } |
| | | |
| | | @Override |
| | | public List<RiderOrderRecord> queryAll(RiderOrderRecordQueryCriteria criteria){ |
| | | public List<RiderOrderRecord> queryAll(RiderOrderRecordQueryCriteria criteria) { |
| | | return riderOrderRecordMapper.findAll(criteria); |
| | | } |
| | | |
| | |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRiderOrderStatus(String orderNum, String orderStatus) { |
| | | // 当前为接单 设置为待取货状态 1-待取货 2-配送中 3-已完成 4-商家取消 5-骑手取消 6-客户取消 7-系统取消 |
| | | RiderOrderRecord riderOrderRecord = new RiderOrderRecord(); |
| | | riderOrderRecord.setOrderNum(orderNum); |
| | | riderOrderRecord.setOrderStatus(orderStatus); |
| | | QueryWrapper<RiderOrderRecord> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq(RiderOrderRecord.COL_ORDER_NUM, orderNum); |
| | | // 更新订单状态 |
| | | riderOrderRecordMapper.update(riderOrderRecord, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R riderGrabOrder(String orderNum) { |
| | | // 唯一标识当前线程/客户端 |
| | | String clientId = UUID.randomUUID().toString(); |
| | | // Redis 锁 key |
| | | String lockKey = "lock:order:" + orderNum; |
| | | try { |
| | | // 获取分布式锁,设置超时时间10秒 |
| | | boolean isLocked = redisUtils.setIfAbsent(lockKey, clientId, 10); |
| | | if (!isLocked) { |
| | | return R.fail(400, "订单已经被其他骑手接单,请稍后重试"); |
| | | } |
| | | // 查询当前订单 检查订单是否已经被其他骑手抢到或取消 直接返回 |
| | | OrderResponse orderResponse = orderService.getByOrderNum(orderNum); |
| | | // 2商家已接单 4商家已备货 这两个状态可以接单 |
| | | if (orderResponse == null || orderResponse.getOrder().getOrderStatus() != 2 || orderResponse.getOrder().getOrderStatus() != 4) { |
| | | return R.fail(400, "订单已经被其他骑手接单或顾客取消,请稍后重试"); |
| | | } |
| | | // 订单没有被接单或取消的情况下,进行接单操作 |
| | | // 查询骑手信息 |
| | | Long riderId = SecurityUtils.getCurrentUserId(); |
| | | RiderInfo riderInfo = riderInfoService.getRiderSourceInfo(riderId); |
| | | // 查询商家信息 |
| | | Store store = storeService.getById(orderResponse.getOrder().getStoreId()); |
| | | // 1.新增骑手接单记录 |
| | | addRiderOrderRecord(riderInfo, orderResponse, store); |
| | | // 2.新增订单接单流程信息 |
| | | // 返回成功信息 |
| | | return R.success(orderResponse, "接单成功"); |
| | | } catch (Exception e) { |
| | | throw new BadRequestException("接单失败,请稍后重试"); |
| | | } finally { |
| | | // 安全释放锁(仅释放自己持有的锁) |
| | | String currentClientId = (String) redisUtils.get(lockKey); |
| | | // 当前线程持有锁 |
| | | if (StringUtils.equals(currentClientId, clientId)) { |
| | | // 释放锁 |
| | | redisUtils.del(lockKey); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 功能描述: <添加接单记录> |
| | | * |
| | | * @Date: 2025/7/14 17:48 |
| | | */ |
| | | public void addRiderOrderRecord(RiderInfo riderInfo, OrderResponse orderResponse, Store store) { |
| | | RiderOrderRecord riderOrderRecord = new RiderOrderRecord(); |
| | | riderOrderRecord.setOrderId(orderResponse.getOrder().getOrderId()); |
| | | riderOrderRecord.setOrderNum(orderResponse.getOrder().getOrderNum()); |
| | | riderOrderRecord.setMerchantId(orderResponse.getOrder().getStoreId()); |
| | | riderOrderRecord.setMerchantName(orderResponse.getOrder().getStoreName()); |
| | | riderOrderRecord.setMerchantAddress(store.getAddress()); |
| | | riderOrderRecord.setReceiverAddress(orderResponse.getAddress().getDetail()); |
| | | // 当前为接单 设置为待取货状态 0-已接单 1-已到店 2-配送中 3-已完成 4-商家取消 5-骑手取消 6-客户取消 7-系统取消 |
| | | riderOrderRecord.setOrderStatus(Constants.ORDER_STATUS_OK); |
| | | riderOrderRecord.setAcceptTime(new Timestamp(System.currentTimeMillis())); |
| | | // 取单编号 |
| | | riderOrderRecord.setAcceptNum(orderResponse.getOrder().getOrderStoreNum()); |
| | | // 是否超时:1-是 0-否 |
| | | riderOrderRecord.setIsOvertime(Constants.IS_OVERTIME_NO); |
| | | // 订单来源: 1-平台派单 2-骑手抢单 3-商家直派 4-其他 |
| | | riderOrderRecord.setOrderSource(Constants.ORDER_SOURCE_DIRECT); |
| | | riderOrderRecord.setRiderId(riderInfo.getRiderId()); |
| | | riderOrderRecord.setRiderName(riderInfo.getCardName()); |
| | | riderOrderRecord.setPhone(riderInfo.getPhone()); |
| | | riderOrderRecord.setUserId(orderResponse.getOrder().getUserId()); |
| | | riderOrderRecord.setUserLongitude(String.valueOf(orderResponse.getAddress().getLongitude())); |
| | | riderOrderRecord.setUserLatitude(String.valueOf(orderResponse.getAddress().getLatitude())); |
| | | riderOrderRecord.setMerchantLongitude(String.valueOf(store.getLongitude())); |
| | | riderOrderRecord.setMerchantLatitude(String.valueOf(store.getLatitude())); |
| | | // 配送费详情Id |
| | | // riderOrderRecord.setDeliveryFeeId(orderResponse.getOrder().getDeliveryFeeId()); |
| | | riderOrderRecord.setOrderIncome(orderResponse.getOrder().getSendPrice()); |
| | | create(riderOrderRecord); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R riderCancelOrder(String orderNum) { |
| | | // 查询当前订单信息 |
| | | OrderResponse orderResponse = orderService.getByOrderNum(orderNum); |
| | | // 根据信息判断当前订单信息是否满足取消条件 |
| | | // 满足取消订单 |
| | | // 不满足取消订单条件,返回错误信息 |
| | | // 取消订单后通知商家 |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R riderOperationOrder(OrderRiderOperationVo orderRiderOperationVo){ |
| | | // 判断骑手操作类型 |
| | | // 添加订单操作记录 |
| | | // 修改骑手端的订单状态 |
| | | updateRiderOrderStatus(orderRiderOperationVo.getOrderNum(), Constants.ORDER_STATUS_StORE); |
| | | return R.success(); |
| | | } |
| | | |
| | | } |
| | |
| | | * HTTP请求成功状态码 |
| | | */ |
| | | String HTTP_CODE_SUCCESS = "200"; |
| | | int HTTP_CODE_FAIL = 400; |
| | | |
| | | /** |
| | | * 状态 0不生效,1生效 其他平台是否满足接单的条件 |
| | | */ |
| | | String SOURCE_ENABLED_ON = "0"; |
| | | String SOURCE_ENABLED_DFF = "1"; |
| | | String SOURCE_ENABLED_ON = "1"; |
| | | String SOURCE_ENABLED_DFF = "0"; |
| | | |
| | | /** |
| | | * 初始值0 |
| | | */ |
| | | Integer ZERO = 0; |
| | | |
| | | /** |
| | | * 钱包状态(0冻结,1正常) |
| | | */ |
| | | String WALLET_STATUS_NORMAL = "1"; |
| | | String WALLET_STATUS_FROZEN = "0"; |
| | | /** |
| | | * 超时状态 1-是 0-否 |
| | | */ |
| | | String IS_OVERTIME_NO = "0"; |
| | | String IS_OVERTIME = "1"; |
| | | |
| | | /** |
| | | * 订单来源: 1-平台派单 2-骑手抢单 3-商家直派 4-其他 |
| | | */ |
| | | String ORDER_SOURCE_PLATFORM = "1"; |
| | | String ORDER_SOURCE_RIDER = "2"; |
| | | String ORDER_SOURCE_DIRECT = "3"; |
| | | String ORDER_SOURCE_OTHER = "4"; |
| | | |
| | | /** |
| | | * 订单状态:0-已接单 1-已到店 2-配送中 3-已完成 4-商家取消 5-骑手取消 6-客户取消 7-系统取消 |
| | | */ |
| | | String ORDER_STATUS_OK = "0"; |
| | | String ORDER_STATUS_StORE = "1"; |
| | | String ORDER_STATUS_DELIVERY = "2"; |
| | | String ORDER_STATUS_FINISH = "3"; |
| | | String ORDER_STATUS_CANCEL_MERCHANT = "4"; |
| | | String ORDER_STATUS_CANCEL_RIDER = "5"; |
| | | String ORDER_STATUS_CANCEL_CUSTOMER = "6"; |
| | | String ORDER_STATUS_CANCEL_SYSTEM = "7"; |
| | | } |
| | |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.oying.modules.rider.domain.RiderSourceInfo; |
| | | import com.oying.modules.rider.domain.RiderSourceInfoHttp; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp(); |
| | | riderSourceInfoHttp.setCode("500"); |
| | | riderSourceInfoHttp.setMessage(paramMap.get("phone") + "手机号请求异常:" + url); |
| | | riderSourceInfoHttp.setSuccess("false"); |
| | | return JSON.toJSONString(riderSourceInfoHttp); |
| | | } finally { |
| | | IoUtil.close(response); |
| | |
| | | public static RiderSourceInfoHttp getRiderSourceInfoHttp(String phone, String sourcePlatform) { |
| | | HashMap<String, Object> paramMap = new HashMap<>(2); |
| | | paramMap.put("phone", phone); |
| | | paramMap.put("produceType", sourcePlatform); |
| | | String url = ""; |
| | | paramMap.put("sourcePlatform", sourcePlatform); |
| | | // String url = ""; |
| | | // 转化成对象 |
| | | RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp(); |
| | | try { |
| | | String result = httpPostRequest(paramMap, url); |
| | | // 转换数据 |
| | | riderSourceInfoHttp = riderConvertUtils(result); |
| | | } catch (Exception e) { |
| | | riderSourceInfoHttp.setCode("500"); |
| | | riderSourceInfoHttp.setMessage("获取数据失败"); |
| | | riderSourceInfoHttp.setSuccess("false"); |
| | | return riderSourceInfoHttp; |
| | | } |
| | | // try { |
| | | // String result = httpPostRequest(paramMap, url); |
| | | // // 转换数据 |
| | | // riderSourceInfoHttp = riderConvertUtils(result); |
| | | // } catch (Exception e) { |
| | | // riderSourceInfoHttp.setCode("500"); |
| | | // riderSourceInfoHttp.setMessage("获取数据失败"); |
| | | // riderSourceInfoHttp.setSuccess("false"); |
| | | // return riderSourceInfoHttp; |
| | | // } |
| | | riderSourceInfoHttp.setCode(Constants.HTTP_CODE_SUCCESS); |
| | | riderSourceInfoHttp.setMessage("请求成功"); |
| | | RiderSourceInfo riderSourceInfo = new RiderSourceInfo(); |
| | | riderSourceInfo.setSourcePlatform("LY"); |
| | | riderSourceInfo.setCardNum("123456789012345678"); |
| | | riderSourceInfo.setPhone("15202394888"); |
| | | riderSourceInfo.setCardName("张三"); |
| | | riderSourceInfo.setEnabled(Constants.SOURCE_ENABLED_ON); |
| | | riderSourceInfoHttp.setData(riderSourceInfo); |
| | | return riderSourceInfoHttp; |
| | | } |
| | | |
| | |
| | | } catch (Exception e) { |
| | | riderSourceInfoHttp.setCode("500"); |
| | | riderSourceInfoHttp.setMessage("转化数据失败"); |
| | | riderSourceInfoHttp.setSuccess("false"); |
| | | return riderSourceInfoHttp; |
| | | } |
| | | } |
| | |
| | | redis: |
| | | #数据库索引 |
| | | database: 0 |
| | | host: 127.0.0.1 |
| | | host: 192.168.18.13 |
| | | port: 6379 |
| | | password: |
| | | #连接超时时间 |
| | |
| | | <result column="merchant_longitude" property="merchantLongitude"/> |
| | | <result column="merchant_latitude" property="merchantLatitude"/> |
| | | <result column="user_id" property="userId"/> |
| | | <result column="delivery_fee_id" property="deliveryFeeId"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | record_id, order_id, order_num, merchant_id, merchant_name, merchant_address, |
| | | receiver_address, order_status, accept_time, accept_num, finish_time, delivery_duration, |
| | | is_overtime, order_source, order_income, create_by, create_time, update_by, update_time, |
| | | rider_id, phone, rider_name, user_id, user_longitude, user_latitude, merchant_longitude, merchant_latitude |
| | | rider_id, phone, rider_name, user_id, user_longitude, user_latitude, merchant_longitude, merchant_latitude,delivery_fee_id |
| | | </sql> |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | | select |
| | |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="phone" property="phone"/> |
| | | <result column="card_name" property="cardName"/> |
| | | <result column="card_num" property="cardNum"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | wallet_id, rider_id, amount, available_balance, purchasing_electricity_amount, withdraw_total, income_total, frozen_amount, run_total, cash_withdrawal_total, purchasing_electricity_total, status, create_by, create_time, update_by, update_time |
| | | wallet_id, rider_id, amount, available_balance, |
| | | purchasing_electricity_amount, withdraw_total, |
| | | income_total, frozen_amount, run_total, cash_withdrawal_total, |
| | | purchasing_electricity_total, status, create_by, create_time, |
| | | update_by, update_time, phone, card_name, card_num |
| | | </sql> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | |
| | | <where> |
| | | <if test="criteria.riderId != null"> |
| | | and rider_id = #{criteria.riderId} |
| | | </if> |
| | | <if test="criteria.phone != null"> |
| | | and phone = #{criteria.phone} |
| | | </if> |
| | | <if test="criteria.cardName != null"> |
| | | and card_name = #{criteria.cardName} |
| | | </if> |
| | | <if test="criteria.cardNum != null"> |
| | | and card_num = #{criteria.cardNum} |
| | | </if> |
| | | <if test="criteria.status != null"> |
| | | and status = #{criteria.status} |
| | |
| | | AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} |
| | | </if> |
| | | </where> |
| | | order by wallet_id desc |
| | | order by create_time desc |
| | | </select> |
| | | </mapper> |