59个文件已修改
2个文件已删除
15个文件已添加
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | @ApiModelProperty("申请改派时间") |
| | | @TableField("apply_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | private Date applyTime; |
| | | |
| | | @ApiModelProperty("改派状态 (0:未改派 ;1:已改派)") |
| | |
| | | * @param changeDispatch 改派信息 |
| | | * @return 详细数据 |
| | | */ |
| | | @PostMapping(value = "/changeDispatch/save") |
| | | @PostMapping(value = "/changeDispatch/changeDispatchSave") |
| | | R<Boolean> changeDispatchSave(@RequestBody ChangeDispatch changeDispatch); |
| | | |
| | | /** |
| | |
| | | * @param id 订单id |
| | | * @return 改派订单 |
| | | */ |
| | | @GetMapping(value = "/changeDispatch/one") |
| | | @GetMapping(value = "/changeDispatch/changeDispatchOne") |
| | | R<ChangeDispatch> changeDispatchOne(@RequestParam("id") Integer id); |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.common.core.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-07-02 9:58 |
| | | */ |
| | | @Data |
| | | public class PolylineData { |
| | | |
| | | @ApiModelProperty("经度") |
| | | private String longitude; |
| | | |
| | | @ApiModelProperty("纬度") |
| | | private String latitude; |
| | | |
| | | public PolylineData(String longitude, String latitude) { |
| | | this.longitude = longitude; |
| | | this.latitude = latitude; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <finalName>${project.artifactId}</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
| | |
| | | import com.ruoyi.admin.service.ChangeDispatchService; |
| | | import com.ruoyi.admin.service.MasterWorkerService; |
| | | import com.ruoyi.admin.service.OrderService; |
| | | import com.ruoyi.admin.sorcket.WebSocketServer; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 订单改派 -远程调用 |
| | | * |
| | | * @param changeDispatch 订单改派信息 |
| | | */ |
| | | @ApiOperation(value = "新增订单改派", tags = {"后台-系统设置-订单改派管理"}) |
| | | @PostMapping(value = "/changeDispatchSave") |
| | | public R<Boolean> changeDispatchSave(@RequestBody ChangeDispatch changeDispatch) { |
| | | return R.ok(changeDispatchService.save(changeDispatch)); |
| | | } |
| | | |
| | | /** |
| | | * 订单改派详情 |
| | | * |
| | | * @param id 订单改派id |
| | |
| | | @ApiImplicitParam(value = "订单改派id", name = "id", dataType = "Integer", required = true) |
| | | }) |
| | | public R<ChangeDispatch> one(@RequestParam("id") Integer id) { |
| | | ChangeDispatch changeDispatch = changeDispatchService.lambdaQuery() |
| | | .eq(ChangeDispatch::getOrderId, id) |
| | | .eq(ChangeDispatch::getState, Constants.ZERO) |
| | | .one(); |
| | | return R.ok(changeDispatch); |
| | | } |
| | | |
| | | /** |
| | | * 订单改派详情 远程调用 |
| | | * |
| | | * @param id 订单id |
| | | */ |
| | | @GetMapping(value = "/changeDispatchOne") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单改派id", name = "id", dataType = "Integer", required = true) |
| | | }) |
| | | public R<ChangeDispatch> changeDispatchOne(@RequestParam("id") Integer id) { |
| | | ChangeDispatch changeDispatch = changeDispatchService.lambdaQuery() |
| | | .eq(ChangeDispatch::getOrderId, id) |
| | | .eq(ChangeDispatch::getState, Constants.ZERO) |
| | |
| | | if (null == order) { |
| | | throw new GlobalException("订单不存在!"); |
| | | } |
| | | // 判断订单状态 |
| | | if (!Constants.ZERO.equals(order.getState())) { |
| | | throw new GlobalException("订单已有师傅正在处理!"); |
| | | } |
| | | MasterWorker masterWorker = masterWorkerService.lambdaQuery().eq(MasterWorker::getId, workerId) |
| | | .eq(MasterWorker::getIsDelete, 0).one(); |
| | | // 师傅信息 |
| | |
| | | // 改派信息 |
| | | boolean update = changeDispatchService.lambdaUpdate().set(ChangeDispatch::getState, 1) |
| | | .eq(ChangeDispatch::getId, changeId).eq(ChangeDispatch::getIsDelete, 0).update(); |
| | | return orderUpdate && save && update ? R.ok() : R.fail(); |
| | | try { |
| | | WebSocketServer.sendInfo("您有一条新的订单,请注意查收!", String.valueOf(workerId)); |
| | | return orderUpdate && save && update ? R.ok() : R.fail(); |
| | | } catch (IOException e) { |
| | | return R.fail("师傅不在线!"); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.admin.service.UserService; |
| | | import com.ruoyi.admin.vo.MasterWorkerRankVO; |
| | | import com.ruoyi.admin.vo.OrderResultVO; |
| | | import com.ruoyi.admin.vo.UserDataCountVO; |
| | | import com.ruoyi.admin.vo.UserTrendsVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.Api; |
| | |
| | | */ |
| | | @ApiOperation(value = "后台-用户数据统计", tags = {"后台-首页"}) |
| | | @PostMapping(value = "/userDataCount") |
| | | public R<Object> userDataCount(@RequestBody UserDataCountRequest userDataCountRequest) { |
| | | public R<UserDataCountVO> userDataCount(@RequestBody UserDataCountRequest userDataCountRequest) { |
| | | return R.ok(userService.userDataCount(userDataCountRequest)); |
| | | } |
| | | |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @ApiImplicitParam(value = "师傅姓名", name = "name", dataType = "String"), |
| | | @ApiImplicitParam(value = "师傅电话", name = "phone", dataType = "String"), |
| | | @ApiImplicitParam(value = "服务城市", name = "city", dataType = "String"), |
| | | @ApiImplicitParam(value = "账号启用状态", name = "state", dataType = "Integer"), |
| | | @ApiImplicitParam(value = "页码", name = "pageNum", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "每页显示条数", name = "pageSize", dataType = "Integer", required = true) |
| | | }) |
| | | public R<IPage<MasterWorker>> selectServe(String name, String phone, String city, |
| | | public R<IPage<MasterWorker>> selectServe(String name, String phone, String city, Integer state, |
| | | @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | LambdaQueryChainWrapper<MasterWorker> wrapper = masterWorkerService.lambdaQuery(); |
| | | wrapper = StringUtils.isNotBlank(name) ? wrapper.like(MasterWorker::getRealName, name) : wrapper; |
| | | wrapper = StringUtils.isNotBlank(phone) ? wrapper.like(MasterWorker::getPhone, phone) : wrapper; |
| | | wrapper = StringUtils.isNotBlank(city) ? wrapper.like(MasterWorker::getCity, city) : wrapper; |
| | | return R.ok(wrapper.eq(MasterWorker::getIsDelete, 0) |
| | | .eq(MasterWorker::getIsEnable,1) |
| | | if (null != state) { |
| | | wrapper.eq(MasterWorker::getIsEnable, Constants.ONE); |
| | | } |
| | | return R.ok(wrapper.eq(MasterWorker::getIsDelete, Constants.ZERO) |
| | | .orderByDesc(MasterWorker::getCreateTime).page(Page.of(pageNum, pageSize))); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "新增师傅信息", tags = {"后台-师傅管理-师傅列表管理"}) |
| | | @PostMapping(value = "/save") |
| | | public R<String> save(@RequestBody MasterWorker masterWorker) { |
| | | // MD5加密登录密码(新) |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | String md5Password = passwordEncoder.encode(Constants.DEFAULT_PASSWORD); |
| | | masterWorker.setPassword(md5Password); |
| | | return masterWorkerService.save(masterWorker) ? R.ok() : R.fail(); |
| | | boolean check = masterWorkerService.checkOnlyPhone(masterWorker.getPhone()); |
| | | if (check) { |
| | | // MD5加密登录密码(新) |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | String md5Password = passwordEncoder.encode(Constants.DEFAULT_PASSWORD); |
| | | masterWorker.setPassword(md5Password); |
| | | return masterWorkerService.save(masterWorker) ? R.ok() : R.fail(); |
| | | } else { |
| | | return R.fail("该手机号已注册账号!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "修改师傅信息", tags = {"后台-师傅管理-师傅列表管理"}) |
| | | @PostMapping(value = "/update") |
| | | public R<String> update(@RequestBody MasterWorker masterWorker) { |
| | | return masterWorkerService.updateById(masterWorker) ? R.ok() : R.fail(); |
| | | public R<String> update(@RequestBody @Validated MasterWorker masterWorker) { |
| | | boolean check = masterWorkerService.checkOnlyPhone(masterWorker.getPhone()); |
| | | if (check) { |
| | | return masterWorkerService.updateById(masterWorker) ? R.ok() : R.fail(); |
| | | } else { |
| | | return R.fail("该手机号已注册账号!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * 订单列表 |
| | | */ |
| | | @ApiOperation(value = "订单列表-各订单数量统计", tags = {"后台-订单管理"}) |
| | | @GetMapping(value = "/orderPageCount") |
| | | public R<OrderPageCountVO> orderPageCount() { |
| | | return R.ok(orderService.orderPageCount()); |
| | | @PostMapping(value = "/orderPageCount") |
| | | public R<OrderPageCountVO> orderPageCount(@RequestBody OrderQueryRequest orderQueryRequest) { |
| | | return R.ok(orderService.orderPageCount(orderQueryRequest)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 新增订单 |
| | | * 后台订单与用户端及师傅端无关联 |
| | | * 后台订单为指定订单,默认为待上门状态 |
| | | * |
| | | * @param order 站点信息 |
| | | */ |
| | |
| | | // 后台订单 |
| | | order.setType(Constants.ONE); |
| | | // 待派单状态 |
| | | order.setState(Constants.ZERO); |
| | | order.setState(Constants.ONE); |
| | | order.setSubsidy(BigDecimal.ZERO); |
| | | order.setOrderNumber(String.valueOf(SNOW_FLAKE_ID_WORKER.nextId())); |
| | | return orderService.save(order) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 新增订单 |
| | | * 后台订单与用户端及师傅端无关联 |
| | | * 订单派单/改派 |
| | | * |
| | | * @param type 1:订单派单;2:订单改派 |
| | | */ |
| | |
| | | }) |
| | | public R<String> reassignment(@RequestParam Integer type, @RequestParam Integer orderId, |
| | | @RequestParam Integer workerId, String applyReason) { |
| | | Order order = orderService.lambdaQuery().eq(Order::getId, orderId).eq(Order::getIsDelete, 0).one(); |
| | | Order order = orderService.lambdaQuery().eq(Order::getId, orderId) |
| | | .eq(Order::getIsDelete, 0).one(); |
| | | MasterWorker masterWorker = masterWorkerService.lambdaQuery() |
| | | .eq(MasterWorker::getId, workerId) |
| | | .eq(MasterWorker::getIsDelete, 0).one(); |
| | |
| | | order.setState(Constants.ONE); |
| | | result = orderService.updateById(order); |
| | | } else if (Constants.TWO.equals(type)) { |
| | | order.setServeId(workerId); |
| | | order.setServerId(workerId); |
| | | // 更新接单时间 |
| | | order.setAcceptTime(new Date()); |
| | | order.setServerName(masterWorker.getRealName()); |
| | | order.setServerPhone(masterWorker.getPhone()); |
| | | result = orderService.updateById(order); |
| | |
| | | changeDispatch.setState(Constants.ONE); |
| | | changeDispatch.setOrderId(String.valueOf(order.getId())); |
| | | changeDispatch.setOrderNumber(order.getOrderNumber()); |
| | | changeDispatch.setUserId(String.valueOf(order.getUserId())); |
| | | if (null != order.getUserId()) { |
| | | changeDispatch.setUserId(String.valueOf(order.getUserId())); |
| | | } |
| | | changeDispatch.setUserName(order.getReservationName()); |
| | | changeDispatch.setIsDelete(Constants.ZERO); |
| | | changeDispatchService.save(changeDispatch); |
| | |
| | | package com.ruoyi.admin.controller; |
| | | |
| | | import com.ruoyi.admin.entity.Order; |
| | | import com.ruoyi.admin.service.OrderService; |
| | | import com.ruoyi.admin.service.SendSmsService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Resource |
| | | private SendSmsService sendSmsService; |
| | | @Resource |
| | | private OrderService orderService; |
| | | |
| | | /** |
| | | * 发送派单短信给用户 |
| | |
| | | @ApiOperation(value = "后台-发送派单短信", tags = {"发送短信"}) |
| | | @GetMapping(value = "/dispatchSms") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单记录id", name = "orderId", dataType = "String", required = true) |
| | | @ApiImplicitParam(value = "订单记录id", name = "orderId", dataType = "Integer", required = true) |
| | | }) |
| | | public R<Object> userDataCount(@RequestParam String orderId) { |
| | | return R.ok(); |
| | | public R<Object> dispatchSms(@RequestParam Integer orderId) { |
| | | Order order = orderService.lambdaQuery() |
| | | .eq(Order::getId, orderId) |
| | | .eq(Order::getIsDelete, 0).one(); |
| | | if (null == order) { |
| | | return R.fail("订单不存在或已删除!"); |
| | | } |
| | | return R.ok(sendSmsService.dispatchOrder(order)); |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.admin.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户收货地址 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-02 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-recipient") |
| | | public class UserRecipientController { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty("申请改派时间") |
| | | @TableField("apply_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | private Date applyTime; |
| | | |
| | | @ApiModelProperty("改派状态 (0:未改派 ;1:已改派)") |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | |
| | | @TableField("reservation_address") |
| | | private String reservationAddress; |
| | | |
| | | @ApiModelProperty("上门时间") |
| | | @ApiModelProperty("上门时间段") |
| | | @TableField("time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date time; |
| | | private String time; |
| | | |
| | | @ApiModelProperty("接单时间(师傅接单或后台派单,更新该字段时间)") |
| | | @TableField("accept_time") |
| | |
| | | @TableField("state") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty("师傅到达预约地点时间") |
| | | @TableField("arrive_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | private Date arriveTime; |
| | | |
| | | @ApiModelProperty("订单类型(0:正常订单,1:后台订单(后台订单与用户端、师傅端无联系))") |
| | | @TableField("type") |
| | | private Integer type; |
| | |
| | | @TableField("is_withdrawal") |
| | | private Integer isWithdrawal; |
| | | |
| | | @ApiModelProperty("详细地址") |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("订单取消原因") |
| | | @TableField("cancel_reason") |
| | | private String cancelReason; |
| | | |
| | | @ApiModelProperty("再投原因") |
| | | @TableField(exist = false) |
| | | private String applyReason; |
| | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 师傅路线经纬度信息 |
| | |
| | | @TableField("worker_id") |
| | | private Integer workerId; |
| | | |
| | | @ApiModelProperty("订单id") |
| | | @TableField("order_id") |
| | | private Integer orderId; |
| | | |
| | | @ApiModelProperty("路线经纬度") |
| | | @TableField("coordinate") |
| | | private String coordinate; |
| | | |
| | | @ApiModelProperty("经度") |
| | | @TableField("longitude") |
| | | private BigDecimal longitude; |
| | | |
| | | @ApiModelProperty("纬度") |
| | | @TableField("latitude") |
| | | private BigDecimal latitude; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.admin.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户收货地址 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-02 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("t_user_recipient") |
| | | @ApiModel(value = "UserRecipient对象", description = "用户收货地址") |
| | | public class UserRecipient { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("用户id") |
| | | @TableField("user_id") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty("收件人姓名") |
| | | @TableField("recipient") |
| | | private String recipient; |
| | | |
| | | @ApiModelProperty("收件人电话") |
| | | @TableField("recipientPhone") |
| | | private String recipientPhone; |
| | | |
| | | @ApiModelProperty("地址") |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("详细地址") |
| | | @TableField("address_detail") |
| | | private String addressDetail; |
| | | |
| | | @ApiModelProperty("是否为默认地址0否1是") |
| | | @TableField("isDefault") |
| | | private Integer isDefault; |
| | | |
| | | @ApiModelProperty("下单用户经度") |
| | | @TableField("longitude") |
| | | private BigDecimal longitude; |
| | | |
| | | @ApiModelProperty("下单用户纬度") |
| | | @TableField("latitude") |
| | | private BigDecimal latitude; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | |
| | | @TableField("updateTime") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty("是否删除 0否1是") |
| | | @TableField("is_delete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | |
| | | @Setter |
| | | @TableName("t_withdraw") |
| | | @ApiModel(value = "Withdraw对象", description = "用户提现记录表") |
| | | public class Withdraw extends BaseEntity { |
| | | public class Withdraw extends BaseEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id",type = IdType.AUTO) |
| | | private Integer id; |
| | |
| | | /** |
| | | * 订单管理分页模块,订单数量统计 |
| | | * |
| | | * @param orderQueryRequest 筛选参数 |
| | | * @return 统计数量 |
| | | */ |
| | | List<Order> orderPageCount(); |
| | | List<Order> orderPageCount(@Param("data") OrderQueryRequest orderQueryRequest); |
| | | |
| | | /** |
| | | * 根据所选id查询 |
New file |
| | |
| | | package com.ruoyi.admin.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.admin.entity.UserRecipient; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户收货地址 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-02 |
| | | */ |
| | | @Mapper |
| | | public interface UserRecipientMapper extends BaseMapper<UserRecipient> { |
| | | |
| | | } |
| | |
| | | /** |
| | | * 获取用户提现金额 |
| | | * |
| | | * @param cityList 城市集合 |
| | | * @param cityList 城市集合 |
| | | * @param startDateStr 季度开始时间 |
| | | * @param endDateStr 季度结束时间 |
| | | * @return 总金额 |
| | | */ |
| | | BigDecimal withdrawalTotalMoney(@Param("cityList") List<String> cityList); |
| | | BigDecimal withdrawalTotalMoney(@Param("cityList") List<String> cityList, @Param("start") String startDateStr, @Param("end") String endDateStr); |
| | | |
| | | /** |
| | | * 年度查询 |
| | |
| | | * @return 排行榜 |
| | | */ |
| | | List<MasterWorkerRankVO> workerRanking(List<String> cityList); |
| | | |
| | | /** |
| | | * 校验师傅手机号是否唯一 |
| | | * |
| | | * @param phone 注册手机号 |
| | | * @return 是否唯一 |
| | | */ |
| | | boolean checkOnlyPhone(String phone); |
| | | } |
| | |
| | | /** |
| | | * excel模板导出 |
| | | * |
| | | * @param orderQueryRequest 筛选参数 |
| | | * @param response 响应体 |
| | | * @param orderQueryRequest 筛选参数 |
| | | * @param response 响应体 |
| | | * @return 导出结果 |
| | | */ |
| | | R<String> excelExport(OrderQueryRequest orderQueryRequest, HttpServletResponse response); |
| | |
| | | /** |
| | | * 订单管理分页模块,订单数量统计 |
| | | * |
| | | * @param orderQueryRequest 筛选参数 |
| | | * @return 统计数量 |
| | | */ |
| | | OrderPageCountVO orderPageCount(); |
| | | OrderPageCountVO orderPageCount(OrderQueryRequest orderQueryRequest); |
| | | } |
| | |
| | | package com.ruoyi.admin.service; |
| | | |
| | | import com.ruoyi.admin.entity.Order; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | |
| | | * @return 验证码 |
| | | */ |
| | | String userLoginSms(String phone); |
| | | |
| | | /** |
| | | * 后台发送派单短信 |
| | | * |
| | | * @param order 订单信息 |
| | | * @return 短信结果 |
| | | */ |
| | | String dispatchOrder(Order order); |
| | | } |
New file |
| | |
| | | package com.ruoyi.admin.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.admin.entity.UserRecipient; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户收货地址 服务类 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-02 |
| | | */ |
| | | public interface UserRecipientService extends IService<UserRecipient> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.admin.entity.User; |
| | | import com.ruoyi.admin.request.UserDataCountRequest; |
| | | import com.ruoyi.admin.vo.UserDataCountVO; |
| | | import com.ruoyi.admin.vo.UserTrendsVO; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param userDataCountRequest 请求参数 |
| | | * @return 统计数据信息 |
| | | */ |
| | | Object userDataCount(UserDataCountRequest userDataCountRequest); |
| | | UserDataCountVO userDataCount(UserDataCountRequest userDataCountRequest); |
| | | } |
| | |
| | | /** |
| | | * excel模板导出 |
| | | * |
| | | * @param exportRequest 提现记录 |
| | | * @param response 响应体 |
| | | * @param exportRequest 提现记录 |
| | | * @param response 响应体 |
| | | * @return 导出结果 |
| | | */ |
| | | R<String> excelExport(WithdrawExportRequest exportRequest, HttpServletResponse response); |
| | |
| | | /** |
| | | * 获取用户提现金额 |
| | | * |
| | | * @param cityList 城市集合 |
| | | * @param cityList 城市集合 |
| | | * @param startDateStr 季度开始时间 |
| | | * @param endDateStr 季度结束时间 |
| | | * @return 总金额 |
| | | */ |
| | | BigDecimal withdrawalTotalMoney(List<String> cityList); |
| | | BigDecimal withdrawalTotalMoney(List<String> cityList, String startDateStr, String endDateStr); |
| | | |
| | | /** |
| | | * 年度查询 |
| | |
| | | /** |
| | | * 用户所关联提现记录分页列表 |
| | | * |
| | | * @param nickname 用户名称 |
| | | * @param userPhone 用户手机号 |
| | | * @param nickname 用户名称 |
| | | * @param userPhone 用户手机号 |
| | | * @param applyForTime 申请开始时间 |
| | | * @param state 审核状态 |
| | | * @param page 分页 |
| | | * @param state 审核状态 |
| | | * @param page 分页 |
| | | * @return 分页列表 |
| | | */ |
| | | IPage<UserWithdrawRecordVO> withdrawPage(String nickname, String userPhone, String applyForTime, |
| | |
| | | /** |
| | | * 提现审批通过,微信打款 |
| | | * |
| | | * @param user 下单用户 |
| | | * @param order 订单信息 |
| | | * @param user 下单用户 |
| | | * @param order 订单信息 |
| | | * @return 打款结果 |
| | | */ |
| | | Boolean confirmWithdraw(User user, Order order); |
| | |
| | | List<MasterWorkerRankVO> result = baseMapper.workerRanking(workerIdList); |
| | | return null == result ? new ArrayList<>() : result; |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkOnlyPhone(String phone) { |
| | | MasterWorker masterWorker = lambdaQuery().eq(MasterWorker::getPhone, phone).one(); |
| | | return masterWorker == null; |
| | | } |
| | | |
| | | } |
| | |
| | | public R<String> excelExport(OrderQueryRequest orderQueryRequest, HttpServletResponse response) { |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(Constants.EXCEL_ORDER_FILE_NAME, CharEncoding.UTF_8) + ".xlsx"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode(Constants.EXCEL_ORDER_FILE_NAME, CharEncoding.UTF_8) + ".xlsx"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | |
| | | ServeRecord serveRecord = serveRecordService.lambdaQuery().eq(ServeRecord::getOrderId, order.getId()) |
| | | .eq(ServeRecord::getIsDelete, 0).one(); |
| | | // 师傅路线轨迹 |
| | | List<ServeCoordinate> serveCoordinateList = serveCoordinateService.lambdaQuery().eq(ServeCoordinate::getWorkerId, order.getServerId()) |
| | | .eq(ServeCoordinate::getIsDelete, 0).orderByDesc(ServeCoordinate::getCreateTime).list(); |
| | | List<ServeCoordinate> serveCoordinateList = serveCoordinateService.lambdaQuery() |
| | | .eq(ServeCoordinate::getWorkerId, order.getServerId()) |
| | | .eq(ServeCoordinate::getIsDelete, 0) |
| | | .eq(ServeCoordinate::getOrderId, order.getId()) |
| | | .orderByDesc(ServeCoordinate::getCreateTime).list(); |
| | | OrderByServeRecordVO orderByServeRecord = new OrderByServeRecordVO(); |
| | | orderByServeRecord.setAcceptOrderTime(order.getAcceptTime()); |
| | | orderByServeRecord.setReachTime(order.getTime()); |
| | |
| | | } |
| | | OrderByServeVO orderByServe = new OrderByServeVO(); |
| | | orderByServe.setServeName(recoveryServe.getServeName()); |
| | | orderByServe.setCover(recoveryServe.getCover()); |
| | | orderByServe.setSupClassify(recoveryClassify.getSupClassify()); |
| | | orderByServe.setSubClassify(recoveryClassify.getSubClassify()); |
| | | orderByServe.setPrice(order.getServePrice()); |
| | |
| | | // 订单信息 |
| | | OrderInfoVO orderInfo = new OrderInfoVO(); |
| | | orderInfo.setOrderNumber(order.getOrderNumber()); |
| | | orderInfo.setPlaceOrderTime(order.getTime()); |
| | | orderInfo.setPlaceOrderTime(order.getCreateTime()); |
| | | orderInfo.setState(order.getState()); |
| | | result.setOrderInfo(orderInfo); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public OrderPageCountVO orderPageCount() { |
| | | List<Order> orderList = baseMapper.orderPageCount(); |
| | | public OrderPageCountVO orderPageCount(OrderQueryRequest orderQueryRequest) { |
| | | List<Order> orderList = baseMapper.orderPageCount(orderQueryRequest); |
| | | int total = 0; |
| | | int toBeDispatched = 0; |
| | | int stayDoorstep = 0; |
| | |
| | | package com.ruoyi.admin.service.impl; |
| | | |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import com.ruoyi.admin.entity.Order; |
| | | import com.ruoyi.admin.service.SendSmsService; |
| | | import com.ruoyi.admin.utils.SendSmsUtil; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | |
| | | sendSmsUtil.loginId); |
| | | } |
| | | |
| | | @Override |
| | | public String dispatchOrder(Order order) { |
| | | // 发送验证码 |
| | | String phone = order.getReservationPhone(); |
| | | String[] arr = {order.getOrderNumber()}; |
| | | sendSmsUtil.sendSms(new SendSmsUtil.SendSmsRequest(phone, sendSmsUtil.reservationId, arr)); |
| | | return "发送成功!"; |
| | | } |
| | | |
| | | private String sendPhoneCode(String phone, String redisKey, String templateId) { |
| | | // 生成随机 6位数字 验证码 |
| | | String phoneCode = RandomUtil.randomNumbers(6); |
New file |
| | |
| | | package com.ruoyi.admin.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.admin.entity.UserRecipient; |
| | | import com.ruoyi.admin.mapper.UserRecipientMapper; |
| | | import com.ruoyi.admin.service.UserRecipientService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户收货地址 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-02 |
| | | */ |
| | | @Service |
| | | public class UserRecipientServiceImpl extends ServiceImpl<UserRecipientMapper, UserRecipient> implements UserRecipientService { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.admin.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.admin.entity.User; |
| | | import com.ruoyi.admin.mapper.UserMapper; |
| | |
| | | |
| | | @Override |
| | | public List<UserTrendsVO> userTrends(List<String> city) { |
| | | if (null == city || city.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<UserTrendsVO> userTrendsList = baseMapper.userTrends(city); |
| | | return null == userTrendsList || userTrendsList.isEmpty() ? new ArrayList<>() : userTrendsList; |
| | | } |
| | | |
| | | @Override |
| | | public Object userDataCount(UserDataCountRequest userDataCountRequest) { |
| | | public UserDataCountVO userDataCount(UserDataCountRequest userDataCountRequest) { |
| | | List<String> cityList = userDataCountRequest.getCityList(); |
| | | List<User> userList = lambdaQuery().eq(User::getIsDelete, 0).list(); |
| | | // 用户总量 |
| | |
| | | BigDecimal withdrawalTotalMoney; |
| | | if (OrderConstants.QUARTER.equals(userDataCountRequest.getCountType())) { |
| | | // 用户增长数 |
| | | increaseNumber = lambdaQuery().ge(User::getCreateTime, startDateStr).le(User::getCreateTime, endDateStr) |
| | | .in(User::getCity, cityList).eq(User::getIsDelete, 0).count(); |
| | | LambdaQueryChainWrapper<User> wrapper = lambdaQuery().ge(User::getCreateTime, startDateStr) |
| | | .le(User::getCreateTime, endDateStr); |
| | | if (!cityList.isEmpty()) { |
| | | wrapper.in(User::getCity, cityList); |
| | | } |
| | | increaseNumber = wrapper.eq(User::getIsDelete, 0).count(); |
| | | // 用户总交易额 |
| | | totalMoney = orderService.totalMoneyByQuarter(startDateStr, endDateStr, cityList); |
| | | // 用户提现总额 |
| | | withdrawalTotalMoney = withdrawService.withdrawalTotalMoney(cityList); |
| | | withdrawalTotalMoney = withdrawService.withdrawalTotalMoney(cityList,startDateStr,endDateStr); |
| | | } else if (OrderConstants.YEAR.equals(userDataCountRequest.getCountType())) { |
| | | // 用户增长数 |
| | | increaseNumber = baseMapper.increaseNumberByYear(cityList); |
| | |
| | | public R<String> excelExport(WithdrawExportRequest exportRequest, HttpServletResponse response) { |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode(Constants.EXCEL_WITHDRAWAL_FILE_NAME, CharEncoding.UTF_8) + ".xlsx"); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal withdrawalTotalMoney(List<String> cityList) { |
| | | return baseMapper.withdrawalTotalMoney(cityList); |
| | | public BigDecimal withdrawalTotalMoney(List<String> cityList,String startDateStr, String endDateStr) { |
| | | return baseMapper.withdrawalTotalMoney(cityList,startDateStr,endDateStr); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public Boolean confirmWithdraw(User user, Order order) { |
| | | // 校验提现 |
| | | List<Withdraw> list = this.lambdaQuery().eq(Withdraw::getUserId, user.getId()) |
| | | .eq(Withdraw::getOrderId, order).list(); |
| | | .eq(Withdraw::getOrderId, order.getId()).list(); |
| | | List<Integer> stateList = list.stream().map(Withdraw::getState).collect(Collectors.toList()); |
| | | if (stateList.contains(Constants.ZERO)) { |
| | | throw new GlobalException("当前订单已提交提现申请,请等待审核!"); |
| | | } else if (stateList.contains(Constants.ONE)) { |
| | | throw new GlobalException("当前订单已提现通过!"); |
| | | if (stateList.contains(Constants.ONE)) { |
| | | throw new GlobalException("当前订单提现申请已通过!"); |
| | | } |
| | | return weChatPay(order.getOrderMoney(), user.getOpenId()); |
| | | } |
| | |
| | | WEB_SOCKET_MAP.get(workerId).getSession().getBasicRemote().sendText(message); |
| | | } else { |
| | | log.error("用户" + workerId + ",不在线!"); |
| | | throw new IOException("用户" + workerId + ",不在线!"); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | // 数据库连接url |
| | | String dbUrl = "jdbc:mysql://localhost:3306/old_data"; |
| | | String dbUrl = "jdbc:mysql://localhost:3306/secondary_recovery"; |
| | | // 数据库用户名 |
| | | String dbUsername = "root"; |
| | | // 数据库密码 |
| | |
| | | // 包配置 |
| | | .packageConfig(builder -> builder |
| | | // 父包名 |
| | | .parent("com.rouyi.user") |
| | | .parent("com.ruoyi.worker") |
| | | // 父包模块名 注释即为无 |
| | | // .moduleName(scanner("模块名")) |
| | | // Entity 包名 |
New file |
| | |
| | | package com.ruoyi.admin.utils; |
| | | |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.tencentcloudapi.common.Credential; |
| | | import com.tencentcloudapi.common.exception.TencentCloudSDKException; |
| | | import com.tencentcloudapi.sms.v20210111.SmsClient; |
| | | import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.var; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 腾讯云发送验证码 |
| | | * |
| | | * @author HJL |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class SendSmsUtil { |
| | | |
| | | /** |
| | | * 短信签名内容,必须填写已审核通过的签名 |
| | | */ |
| | | @Value("${tencent.signName}") |
| | | private String singName; |
| | | |
| | | /** |
| | | * 短信验证码登录模板id |
| | | */ |
| | | @Value("${tencent.template.loginId}") |
| | | public String loginId; |
| | | |
| | | /** |
| | | * 入驻申请验证码模板id |
| | | */ |
| | | @Value("${tencent.template.applyId}") |
| | | public String applyId; |
| | | |
| | | /** |
| | | * 预约成功验证码模板id |
| | | */ |
| | | @Value("${tencent.template.reservationId}") |
| | | public String reservationId; |
| | | |
| | | /** |
| | | * 应用id |
| | | */ |
| | | @Value("${tencent.appId}") |
| | | public String appId; |
| | | |
| | | /** |
| | | * 密钥id |
| | | */ |
| | | @Value("${tencent.secretId}") |
| | | public String secretId; |
| | | |
| | | /** |
| | | * 应用的appKey |
| | | */ |
| | | @Value("${tencent.secretKey}") |
| | | public String secretKey; |
| | | |
| | | public void sendSms(SendSmsRequest request) { |
| | | Credential cred = new Credential(secretId, secretKey); |
| | | SmsClient client = new SmsClient(cred, "ap-beijing"); |
| | | final var req = new com.tencentcloudapi.sms.v20210111.models.SendSmsRequest(); |
| | | req.setPhoneNumberSet(new String[]{"+86" + request.getPhone()}); |
| | | req.setSmsSdkAppId(appId); |
| | | req.setSignName(singName); |
| | | req.setTemplateId(request.getTemplateId()); |
| | | req.setTemplateParamSet(request.getTemplateParamSet()); |
| | | SendSmsResponse res; |
| | | try { |
| | | res = client.SendSms(req); |
| | | } catch (TencentCloudSDKException e) { |
| | | log.error("发送短信出错:", e); |
| | | throw new GlobalException("发送短信验证码错误!"); |
| | | } |
| | | log.info("发送短信结果:", SendSmsResponse.toJsonString(res)); |
| | | if (!Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length == 0 |
| | | && !"Ok".equals(res.getSendStatusSet()[0].getCode())) { |
| | | throw new GlobalException("发送短信验证码失败!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 参数对象 |
| | | */ |
| | | @Data |
| | | public static class SendSmsRequest { |
| | | /** |
| | | * 电话 |
| | | */ |
| | | private String phone; |
| | | |
| | | /** |
| | | * 模板 ID: 必须填写已审核通过的模板 ID |
| | | */ |
| | | private String templateId; |
| | | |
| | | /** |
| | | * 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 |
| | | */ |
| | | private String[] templateParamSet; |
| | | |
| | | public SendSmsRequest(String phone, String templateId, String[] templateParamSet) { |
| | | this.phone = phone; |
| | | this.templateId = templateId; |
| | | this.templateParamSet = templateParamSet; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date acceptOrderTime; |
| | | |
| | | @ApiModelProperty("到达时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date reachTime; |
| | | @ApiModelProperty("上门时间") |
| | | private String reachTime; |
| | | |
| | | @ApiModelProperty("路线经纬度集合") |
| | | private List<String> coordinate; |
| | |
| | | @ApiModelProperty("回收价格") |
| | | private BigDecimal price; |
| | | |
| | | @ApiModelProperty("封面图片") |
| | | private String cover; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.admin.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author HJL |
| | |
| | | private String reservationAddress; |
| | | |
| | | @ApiModelProperty("预约上门时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date time; |
| | | private String time; |
| | | |
| | | } |
| | |
| | | * @since 2024-05-30 16:30 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "OrderQuery对象", description = "回收订单统计查询类") |
| | | @ApiModel(value = "OrderResultVO对象", description = "回收订单统计查询类") |
| | | public class OrderResultVO { |
| | | |
| | | @ApiModelProperty("订单总额") |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration scan="true" scanPeriod="60 seconds" debug="false"> |
| | | <!-- 日志存放路径 --> |
| | | <property name="log.path" value="logs/ruoyi-admin" /> |
| | | <!-- 日志输出格式 --> |
| | | <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> |
| | | |
| | | <!-- 控制台输出 --> |
| | | <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统日志输出 --> |
| | | <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/info.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>INFO</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/error.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>ERROR</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 系统模块日志级别控制 --> |
| | | <logger name="com.ruoyi" level="info" /> |
| | | <!-- Spring日志级别控制 --> |
| | | <logger name="org.springframework" level="warn" /> |
| | | |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | | <!--系统操作日志--> |
| | | <root level="info"> |
| | | <appender-ref ref="file_info" /> |
| | | <appender-ref ref="file_error" /> |
| | | </root> |
| | | </configuration> |
| | |
| | | <result column="site_name" property="siteName"/> |
| | | <result column="serve_id" property="serveId"/> |
| | | <result column="serve_name" property="serveName"/> |
| | | <result column="serve_price" property="servePrice"/> |
| | | <result column="reservation_name" property="reservationName"/> |
| | | <result column="reservation_phone" property="reservationPhone"/> |
| | | <result column="reservation_address" property="reservationAddress"/> |
| | |
| | | and DATE(o.time) <![CDATA[ <= ]]> #{data.endTime} |
| | | </if> |
| | | </where> |
| | | order by o.createTime desc |
| | | </select> |
| | | |
| | | <select id="orderPageCount" resultMap="BaseResultMap"> |
| | | select o.* |
| | | from t_order o |
| | | where o.is_delete = 0 |
| | | <where> |
| | | o.is_delete = 0 |
| | | <if test="data.orderNumber != null and data.orderNumber != ''"> |
| | | and o.order_number like concat('%', #{data.orderNumber}, '%') |
| | | </if> |
| | | <if test="data.cityName != null and data.cityName != ''"> |
| | | and o.city like concat('%', #{data.cityName}, '%') |
| | | </if> |
| | | <if test="data.reservationName != null and data.reservationName != ''"> |
| | | and o.reservation_name like concat('%', #{data.reservationName}, '%') |
| | | </if> |
| | | <if test="data.reservationPhone != null and data.reservationPhone != ''"> |
| | | and o.reservation_phone like concat('%', #{data.reservationPhone}, '%') |
| | | </if> |
| | | <if test="data.state != null"> |
| | | and o.state = #{data.state} |
| | | </if> |
| | | <if test="data.workerName != null and data.workerName != ''"> |
| | | and o.server_name like concat('%', #{data.workerName}, '%') |
| | | </if> |
| | | <if test="data.workerPhone != null and data.workerPhone != ''"> |
| | | and o.server_phone like concat('%', #{data.workerPhone}, '%') |
| | | </if> |
| | | <if test="data.serveName != null and data.serveName != ''"> |
| | | and o.serve_name like concat('%', #{data.serveName}, '%') |
| | | </if> |
| | | <if test="data.orderTimeStart != null and data.orderTimeStart != ''"> |
| | | and DATE(o.createTime) <![CDATA[ >= ]]> #{data.orderTimeStart} |
| | | </if> |
| | | <if test="data.orderTimeEnd != null and data.orderTimeEnd != ''"> |
| | | and DATE(o.createTime) <![CDATA[ <= ]]> #{data.orderTimeEnd} |
| | | </if> |
| | | <if test="data.startTime != null and data.startTime != ''"> |
| | | and DATE(o.time) <![CDATA[ >= ]]> #{data.startTime} |
| | | </if> |
| | | <if test="data.endTime != null and data.endTime != ''"> |
| | | and DATE(o.time) <![CDATA[ <= ]]> #{data.endTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="exportByIdList" resultMap="BaseResultMap"> |
| | |
| | | and state = 1 |
| | | </where> |
| | | GROUP BY DATE_FORMAT(createTime, '%Y-%m') |
| | | ORDER BY createTime; |
| | | ORDER BY date; |
| | | </select> |
| | | |
| | | <select id="increaseNumberByYear" resultType="java.lang.Long"> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.admin.mapper.UserRecipientMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.admin.entity.UserRecipient"> |
| | | <id column="id" property="id" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="recipient" property="recipient" /> |
| | | <result column="recipientPhone" property="recipientPhone" /> |
| | | <result column="address" property="address" /> |
| | | <result column="address_detail" property="addressDetail" /> |
| | | <result column="isDefault" property="isDefault" /> |
| | | <result column="longitude" property="longitude" /> |
| | | <result column="latitude" property="latitude" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="is_delete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | FROM t_withdraw w |
| | | LEFT JOIN t_user u on w.user_id = u.id |
| | | <where> |
| | | w.is_delete = 0 |
| | | <if test="start != null and start != ''"> |
| | | and w.createTime <![CDATA[ >= ]]> #{start} |
| | | </if> |
| | | <if test="end != null and end != ''"> |
| | | and w.createTime <![CDATA[ <= ]]> #{end} |
| | | </if> |
| | | <if test="cityList != null and cityList.size() != 0"> |
| | | u.city in |
| | | and u.city in |
| | | <foreach collection="cityList" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <finalName>${project.artifactId}</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
| | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @GetMapping("/orderList") |
| | | @ApiOperation(value = "订单列表", tags = {"用户端-订单"}) |
| | | public R<List<Order>> orderList() { |
| | | LoginUserInfo loginUser = tokenService.getLoginUserByUser(); |
| | | if (null == loginUser) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | return R.ok(orderService.lambdaQuery() |
| | | .eq(Order::getIsDelete, 0) |
| | | .eq(Order::getUserId, loginUser.getUserid()) |
| | | .orderByDesc(Order::getCreateTime).list()); |
| | | } |
| | | |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "订单详情", tags = {"用户端-订单"}) |
| | | @ApiImplicitParams({ |
| | |
| | | Boolean result = orderService.placeOrder(orderRequest, loginUser.getUserid()); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/withdraw") |
| | | @Api(tags = {"用户端-提现"}) |
| | | @Api(tags = {"用户端-个人中心-提现"}) |
| | | public class WithdrawController { |
| | | |
| | | @Resource |
| | |
| | | private TokenService tokenService; |
| | | |
| | | @GetMapping("/withdrawList") |
| | | @ApiOperation(value = "提现列表", tags = {"用户端-个人中心"}) |
| | | @ApiOperation(value = "提现列表", tags = {"用户端-个人中心-提现"}) |
| | | public R<WithdrawListVO> withdrawList() { |
| | | LoginUserInfo loginUser = tokenService.getLoginUserByUser(); |
| | | if (null == loginUser) { |
| | |
| | | return R.ok(withdrawService.withdrawList(loginUser.getUserid())); |
| | | } |
| | | |
| | | @GetMapping("/withdrawDetail") |
| | | @ApiOperation(value = "提现详情", tags = {"用户端-个人中心-提现"}) |
| | | public R<WithdrawListVO> withdrawDetail() { |
| | | LoginUserInfo loginUser = tokenService.getLoginUserByUser(); |
| | | if (null == loginUser) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | return R.ok(withdrawService.withdrawList(loginUser.getUserid())); |
| | | } |
| | | |
| | | @GetMapping("/confirmWithdraw") |
| | | @ApiOperation(value = "确认提现", tags = {"用户端-个人中心"}) |
| | | @ApiOperation(value = "确认提现", tags = {"用户端-个人中心-提现"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true) |
| | | }) |
| | |
| | | } |
| | | |
| | | @GetMapping("/withdrawRecord") |
| | | @ApiOperation(value = "提现记录", tags = {"用户端-个人中心"}) |
| | | @ApiOperation(value = "提现记录", tags = {"用户端-个人中心-提现"}) |
| | | public R<List<Withdraw>> withdrawRecord() { |
| | | LoginUserInfo loginUser = tokenService.getLoginUserByUser(); |
| | | if (null == loginUser) { |
| | |
| | | |
| | | @ApiModelProperty("上门时间") |
| | | @TableField("time") |
| | | private Date time; |
| | | private String time; |
| | | |
| | | @ApiModelProperty("服务人员id") |
| | | @TableField("server_id") |
| | |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("订单取消原因") |
| | | @TableField("cancel_reason") |
| | | private String cancelReason; |
| | | |
| | | } |
| | |
| | | @ApiModel(value = "UserRecipient对象", description = "用户收货地址") |
| | | public class UserRecipient extends BaseEntity { |
| | | |
| | | @TableId(value = "id",type = IdType.AUTO) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("用户id") |
| | |
| | | @TableField("isDefault") |
| | | private Integer isDefault; |
| | | |
| | | @ApiModelProperty("经度") |
| | | @TableField("longitude") |
| | | private Double longitude; |
| | | |
| | | @ApiModelProperty("纬度") |
| | | @TableField("latitude") |
| | | private Double latitude; |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 用户下单请求参数对象 |
| | |
| | | private Integer addressId; |
| | | |
| | | @ApiModelProperty("上门时间") |
| | | private Date time; |
| | | private String time; |
| | | |
| | | @ApiModelProperty("预约备注(服务备注)") |
| | | private String reservationRemark; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.stream.Collectors; |
| | |
| | | String reservationName = orderRequest.getReservationName(); |
| | | String reservationPhone = orderRequest.getReservationPhone(); |
| | | Integer addressId = orderRequest.getAddressId(); |
| | | Date time = orderRequest.getTime(); |
| | | String time = orderRequest.getTime(); |
| | | String reservationRemark = orderRequest.getReservationRemark(); |
| | | Double longitude = orderRequest.getLongitude(); |
| | | Double latitude = orderRequest.getLatitude(); |
| | |
| | | String openid = json.getString("openid"); |
| | | return R.ok(openid); |
| | | } catch (Exception e) { |
| | | return R.fail("openId生成失败"); |
| | | return R.fail("openId生成失败!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | for (Order order : orderList) { |
| | | RecoveryServe recoveryServe = serveMap.get(order.getServeId()); |
| | | WithdrawOrderVO withdrawOrder = new WithdrawOrderVO(); |
| | | withdrawOrder.setOrderId(order.getId()); |
| | | withdrawOrder.setOrderNumber(order.getOrderNumber()); |
| | | withdrawOrder.setServeId(order.getServeId()); |
| | | withdrawOrder.setServeName(recoveryServe.getServeName()); |
| | |
| | | @Data |
| | | public class EvaluateOrderInfoVO { |
| | | |
| | | @ApiModelProperty("订单id") |
| | | private String orderId; |
| | | |
| | | @ApiModelProperty("订单编号") |
| | | private String orderNumber; |
| | | |
| | |
| | | private String reservationAddress; |
| | | |
| | | @ApiModelProperty("上门时间") |
| | | private Date time; |
| | | private String time; |
| | | |
| | | @ApiModelProperty("服务人员名称") |
| | | private String serverName; |
| | |
| | | @ApiModelProperty("评价信息") |
| | | private EvaluateInfoVO evaluateInfo; |
| | | |
| | | @ApiModelProperty("是否已评价") |
| | | private Boolean isEvaluate; |
| | | @ApiModelProperty("是否还未评价") |
| | | private Boolean evaluate; |
| | | |
| | | public Boolean getEvaluate() { |
| | | return null != evaluateInfo.getStarRating(); |
| | | return null != evaluateInfo; |
| | | } |
| | | } |
| | |
| | | @Data |
| | | public class WithdrawOrderVO { |
| | | |
| | | @ApiModelProperty("订单id") |
| | | private Integer orderId; |
| | | |
| | | @ApiModelProperty("订单编号") |
| | | private String orderNumber; |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration scan="true" scanPeriod="60 seconds" debug="false"> |
| | | <!-- 日志存放路径 --> |
| | | <property name="log.path" value="logs/ruoyi-user" /> |
| | | <!-- 日志输出格式 --> |
| | | <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> |
| | | |
| | | <!-- 控制台输出 --> |
| | | <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统日志输出 --> |
| | | <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/info.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>INFO</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/error.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>ERROR</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 系统模块日志级别控制 --> |
| | | <logger name="com.ruoyi" level="info" /> |
| | | <!-- Spring日志级别控制 --> |
| | | <logger name="org.springframework" level="warn" /> |
| | | |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | | <!--系统操作日志--> |
| | | <root level="info"> |
| | | <appender-ref ref="file_info" /> |
| | | <appender-ref ref="file_error" /> |
| | | </root> |
| | | </configuration> |
| | |
| | | |
| | | <resultMap id="evaluateMap" type="com.ruoyi.user.vo.OrderEvaluateVO"> |
| | | <association property="orderInfo" javaType="com.ruoyi.user.vo.EvaluateOrderInfoVO"> |
| | | <result column="id" property="orderId"/> |
| | | <result column="order_number" property="orderNumber"/> |
| | | <result column="complete_time" property="completeTime"/> |
| | | <result column="serve_name" property="serveName"/> |
| | |
| | | </association> |
| | | </resultMap> |
| | | <select id="orderEvaluate" resultMap="evaluateMap"> |
| | | SELECT o.order_number, |
| | | SELECT o.id,o.order_number, |
| | | o.complete_time, |
| | | r.serve_name, |
| | | r.serve_describe, |
| | |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <finalName>${project.artifactId}</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | |
| | | * @param worker 登录信息 |
| | | * @return token |
| | | */ |
| | | private HashMap<String, Object> generateLoginToken(MasterWorker worker) { |
| | | private Map<String, Object> generateLoginToken(MasterWorker worker) { |
| | | // 校验通过,生成token及过期时间 |
| | | LoginUserInfo loginUserInfo = new LoginUserInfo(); |
| | | loginUserInfo.setName(worker.getRealName()); |
| | | loginUserInfo.setUserid(worker.getId()); |
| | | loginUserInfo.setPhone(worker.getPhone()); |
| | | loginUserInfo.setLoginTime(System.currentTimeMillis()); |
| | | HashMap<String, Object> map = new HashMap<>(8); |
| | | Map<String, Object> map = new HashMap<>(8); |
| | | map.put("token", tokenService.createTokenByWorker(loginUserInfo)); |
| | | map.put("userId", worker.getId()); |
| | | return map; |
| | | } |
| | | |
| | |
| | | return R.notEnabled("登录失败,当前账号未启用!"); |
| | | } |
| | | } else { |
| | | return R.unregistered("当前手机号通过入驻申请认证!"); |
| | | // 校验师傅是否已提交入驻申请 |
| | | WorkerProcess process = workerProcessService.lambdaQuery() |
| | | .eq(WorkerProcess::getPhone, phone) |
| | | .eq(WorkerProcess::getIsDelete, 0).one(); |
| | | if (Constants.ZERO.equals(process.getState())) { |
| | | return R.fail("入驻申请暂未审核通过,请耐心等待!"); |
| | | } else if (Constants.TWO.equals(process.getState())) { |
| | | return R.fail("入驻申请已驳回,请重新提交入驻申请!"); |
| | | } else { |
| | | return R.registered("当前账号未提交入驻申请,无法登录!"); |
| | | } |
| | | } |
| | | // 校验通过,生成token及过期时间 |
| | | return R.ok(generateLoginToken(worker)); |
| | |
| | | */ |
| | | @ApiOperation(value = "入驻申请", tags = {"师傅端-登录"}) |
| | | @PostMapping(value = "/settledApply") |
| | | public R<String> settledApply(@RequestBody WorkerProcess workerProcess) { |
| | | public R<String> settledApply(@RequestBody @Validated WorkerProcess workerProcess) { |
| | | String phone = workerProcess.getPhone(); |
| | | String phoneCode = workerProcess.getCode(); |
| | | if (!Constants.DEFAULT_PHONE_CODE.equals(phoneCode)) { |
| | | Object redisCodeObj = redisService.getCacheObject(RedisConstants.WORKER_SETTLE_KEY + phone); |
| | | if (null == redisCodeObj) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | String redisCodeStr = String.valueOf(redisCodeObj).split(":")[0]; |
| | | if (!String.valueOf(redisCodeStr).equalsIgnoreCase(phoneCode)) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | Object redisCodeObj = redisService.getCacheObject(RedisConstants.WORKER_SETTLE_KEY + phone); |
| | | if (null == redisCodeObj) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | String redisCodeStr = String.valueOf(redisCodeObj).split(":")[0]; |
| | | if (!String.valueOf(redisCodeStr).equalsIgnoreCase(phoneCode)) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | // 校验手机号是否已注册 |
| | | MasterWorker masterWorker = masterWorkerService.lambdaQuery().eq(MasterWorker::getPhone, phone) |
| | |
| | | return R.registered("当前手机号已注册!"); |
| | | } |
| | | // 校验手机号是否已提交申请 |
| | | WorkerProcess dbProcess = workerProcessService.lambdaQuery().eq(WorkerProcess::getPhone, phone) |
| | | WorkerProcess dbProcess = workerProcessService.lambdaQuery() |
| | | .eq(WorkerProcess::getPhone, phone) |
| | | .eq(WorkerProcess::getIsDelete, 0).one(); |
| | | if (null != dbProcess) { |
| | | return R.repeatedSubmission("当前手机号已提交申请,请勿重复提交!"); |
| | | } |
| | | // 默认状态待审核 |
| | | workerProcess.setState(Constants.ZERO); |
| | | // 获取用户性别 |
| | | String idNumber = workerProcess.getIdNumber(); |
| | | // 判断身份证号码长度是否合法 |
| | | if (idNumber.length() == Constants.EIGHTEEN) { |
| | | // 获取身份证号码倒数第二位的数字 |
| | | int genderNum = Integer.parseInt(idNumber.substring(16, 17)); |
| | | // 判断性别 |
| | | if (genderNum % Constants.TWO == 0) { |
| | | workerProcess.setSex("女"); |
| | | } else { |
| | | workerProcess.setSex("男"); |
| | | if (Constants.ZERO.equals(dbProcess.getState())) { |
| | | return R.fail("入驻申请已提交,审核未通过,请耐心等待!"); |
| | | } else if (Constants.ONE.equals(dbProcess.getState())) { |
| | | return R.fail("该手机号入驻申请已通过,请通过手机号登录!"); |
| | | } |
| | | } else { |
| | | return R.idNumberIllegal("身份证号码不合法!"); |
| | | // 默认状态待审核 |
| | | workerProcess.setState(Constants.ZERO); |
| | | // 获取用户性别 |
| | | String idNumber = workerProcess.getIdNumber(); |
| | | // 判断身份证号码长度是否合法 |
| | | if (idNumber.length() == Constants.EIGHTEEN) { |
| | | // 获取身份证号码倒数第二位的数字 |
| | | int genderNum = Integer.parseInt(idNumber.substring(16, 17)); |
| | | // 判断性别 |
| | | if (genderNum % Constants.TWO == 0) { |
| | | workerProcess.setSex("女"); |
| | | } else { |
| | | workerProcess.setSex("男"); |
| | | } |
| | | } else { |
| | | return R.idNumberIllegal("身份证号码不合法!"); |
| | | } |
| | | } |
| | | return workerProcessService.save(workerProcess) ? R.ok("申请成功!") : R.fail("申请失败!"); |
| | | } |
| | |
| | | @ApiImplicitParam(value = "手机验证码", name = "phoneCode", dataType = "String", required = true) |
| | | }) |
| | | public R<String> verifyPhone(@RequestParam String phone, @RequestParam String phoneCode) { |
| | | if (!Constants.DEFAULT_PHONE_CODE.equals(phoneCode)) { |
| | | // 验证码是否一致 |
| | | Object redisCode = redisService.getCacheObject(RedisConstants.WORKER_APPLY_KEY + phone); |
| | | if (null == redisCode) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | String redisCodeStr = String.valueOf(redisCode).split(",")[0]; |
| | | if (!String.valueOf(redisCodeStr).equalsIgnoreCase(phoneCode)) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | // 验证码是否一致 |
| | | Object redisCode = redisService.getCacheObject(RedisConstants.WORKER_APPLY_KEY + phone); |
| | | if (null == redisCode) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | String redisCodeStr = String.valueOf(redisCode).split(":")[0]; |
| | | if (!String.valueOf(redisCodeStr).equalsIgnoreCase(phoneCode)) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | // 手机号是否注册 |
| | | MasterWorker worker = masterWorkerService.lambdaQuery().eq(MasterWorker::getPhone, phone) |
| | |
| | | return R.loginExpire("登录已失效!"); |
| | | } |
| | | return R.ok(masterWorkerService.orderNotHandle(loginWorker.getUserid(), longitude, latitude)); |
| | | } |
| | | |
| | | /** |
| | | * 师傅端-操作指南 |
| | | */ |
| | | @ApiOperation(value = "操作指南", tags = {"师傅端-首页"}) |
| | | @GetMapping(value = "/guide") |
| | | public R<Agreement> guide() { |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | | return R.loginExpire("登录已失效!"); |
| | | } |
| | | return R.ok(adminClient.dataInfo(Constants.TWO).getData()); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (null == redisCode) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | | String redisCodeStr = String.valueOf(redisCode).split(",")[0]; |
| | | String redisCodeStr = String.valueOf(redisCode).split(":")[0]; |
| | | if (!String.valueOf(redisCodeStr).equalsIgnoreCase(code)) { |
| | | return R.errorCode("验证码错误或已过期!"); |
| | | } |
| | |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUserInfo; |
| | | import com.ruoyi.worker.entity.Evaluate; |
| | | import com.ruoyi.worker.entity.MasterWorker; |
| | | import com.ruoyi.worker.entity.Order; |
| | | import com.ruoyi.worker.entity.ServeRecord; |
| | | import com.ruoyi.worker.entity.*; |
| | | import com.ruoyi.worker.request.OrderSubmitRequest; |
| | | import com.ruoyi.worker.service.EvaluateService; |
| | | import com.ruoyi.worker.service.MasterWorkerService; |
| | | import com.ruoyi.worker.service.OrderService; |
| | | import com.ruoyi.worker.service.ServeRecordService; |
| | | import com.ruoyi.worker.service.*; |
| | | import com.ruoyi.worker.vo.OrderDetailVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private ServeRecordService serveRecordService; |
| | | @Resource |
| | | private EvaluateService evaluateService; |
| | | @Resource |
| | | private SysServeCoordinateService serveCoordinateService; |
| | | |
| | | /** |
| | | * 师傅端-获取订单列表 |
| | |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "改派原因", name = "reason", dataType = "String", required = true) |
| | | }) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<String> applyChange(@RequestParam Integer orderId, @RequestParam String reason) { |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "orderId", name = "orderId", dataType = "Integer", required = true) |
| | | }) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> reachPosition(@RequestParam Integer orderId) { |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | |
| | | if (null == order) { |
| | | throw new GlobalException("请确认当前订单所派单师傅是否是您!"); |
| | | } |
| | | order.setState(Constants.THREE); |
| | | // 待完工状态 |
| | | order.setState(Constants.TWO); |
| | | order.setArriveTime(new Date()); |
| | | return R.ok(orderService.updateById(order)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "订单详情", tags = {"师傅端-订单列表"}) |
| | | @GetMapping(value = "/orderDetail") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "orderId", name = "orderId", dataType = "Integer", required = true) |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true) |
| | | }) |
| | | public R<OrderDetailVO> orderDetail(@RequestParam Integer orderId) { |
| | | // 订单信息 |
| | |
| | | */ |
| | | @ApiOperation(value = "订单完工-提交订单", tags = {"师傅端-订单列表"}) |
| | | @PostMapping(value = "/orderSubmit") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> orderSubmit(@RequestBody OrderSubmitRequest orderSubmitRequest) { |
| | | // 订单信息 |
| | | Order order = orderService.lambdaQuery().eq(Order::getId, orderSubmitRequest.getOrderId()) |
| | |
| | | return R.ok(update && save); |
| | | } |
| | | |
| | | /** |
| | | * 师傅端-定时调度记录师傅所走路线经纬度 |
| | | * |
| | | * @param orderId 订单id |
| | | * @param longitude 经度 |
| | | * @param latitude 纬度 |
| | | */ |
| | | @ApiOperation(value = "订单进行-记录路线经纬度", tags = {"师傅端-订单列表"}) |
| | | @GetMapping(value = "/coordinate") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "经度", name = "longitude", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "纬度", name = "latitude", dataType = "Integer", required = true) |
| | | }) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> coordinate(@RequestParam Integer orderId, @RequestParam Double longitude, |
| | | @RequestParam Double latitude) { |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | SysServeCoordinate sysServeCoordinate = new SysServeCoordinate(); |
| | | sysServeCoordinate.setWorkerId(loginWorker.getUserid()); |
| | | sysServeCoordinate.setOrderId(orderId); |
| | | sysServeCoordinate.setCoordinate(longitude + "," + latitude); |
| | | sysServeCoordinate.setLongitude(BigDecimal.valueOf(longitude)); |
| | | sysServeCoordinate.setLatitude(BigDecimal.valueOf(latitude)); |
| | | return R.ok(serveCoordinateService.save(sysServeCoordinate)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.common.core.utils.GaoDeMapUtil; |
| | | import com.ruoyi.common.core.utils.ObsUploadUtil; |
| | | import com.ruoyi.worker.entity.Order; |
| | |
| | | @ApiImplicitParam(value = "师傅所在经度", name = "longitude", dataType = "String", required = true), |
| | | @ApiImplicitParam(value = "师傅所在纬度", name = "latitude", dataType = "String", required = true) |
| | | }) |
| | | public R<String> uploadPhoto(@RequestParam("file") MultipartFile file, @RequestParam String orderId, |
| | | @RequestParam String longitude, @RequestParam String latitude) { |
| | | public R<Boolean> uploadPhoto(@RequestParam("file") MultipartFile file, @RequestParam String orderId, |
| | | @RequestParam String longitude, @RequestParam String latitude) { |
| | | // 校验经纬度 |
| | | Order order = orderService.lambdaQuery().eq(Order::getIsDelete, orderId).eq(Order::getIsDelete, 0).one(); |
| | | Order order = orderService.lambdaQuery().eq(Order::getId, orderId) |
| | | .eq(Order::getIsDelete, 0).one(); |
| | | // 用户下单位置经纬度 |
| | | String orderPosition = order.getLongitude() + "," + order.getLatitude(); |
| | | // 师傅经纬度 |
| | |
| | | Long distance = GaoDeMapUtil.getDistance(orderPosition, workerPosition).getDatas(); |
| | | // 上传时判断是否在下单位置附件,距离大于某个值则 不允许上传 |
| | | if (distance > Constants.THREE_THOUSAND) { |
| | | throw new GlobalException("您当前手机定位超出当前订单预约地址范围 3km,无法提供回收服务!"); |
| | | // throw new GlobalException("您当前手机定位超出当前订单预约地址范围 3km,无法提供回收服务!"); |
| | | return R.fail(Boolean.FALSE, "您当前手机定位超出当前订单预约地址范围 3km,无法提供回收服务!"); |
| | | } |
| | | try { |
| | | return R.ok(ObsUploadUtil.obsUpload(file)); |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | |
| | | private String updateBy; |
| | | |
| | | @TableField("createTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | private Date createTime; |
| | | |
| | | @TableField("updateTime") |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty("上门时间") |
| | | @TableField("time") |
| | | private Date time; |
| | | private String time; |
| | | |
| | | @ApiModelProperty("服务人员id") |
| | | @TableField("server_id") |
| | |
| | | |
| | | @ApiModelProperty("师傅到达预约地点时间") |
| | | @TableField("arrive_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | private Date arriveTime; |
| | | |
| | | @ApiModelProperty("订单类型(0:正常订单,1:后台订单(后台订单与用户端、师傅端无联系))") |
| | |
| | | |
| | | @ApiModelProperty("订单完成时间") |
| | | @TableField("complete_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | private Date completeTime; |
| | | |
| | | @ApiModelProperty("是否已提现(0:未提现,1:已提现)") |
| | |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("订单取消原因") |
| | | @TableField("cancel_reason") |
| | | private String cancelReason; |
| | | |
| | | @ApiModelProperty("置顶顺序") |
| | | @TableField("top_sort") |
| | | private Integer topSort; |
| | | |
| | | @ApiModelProperty("回收服务封面图") |
| | | @TableField(exist = false) |
| | | private String cover; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.worker.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 师傅路线经纬度信息 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-03 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("sys_serve_coordinate") |
| | | @ApiModel(value = "SysServeCoordinate对象", description = "师傅路线经纬度信息") |
| | | public class SysServeCoordinate extends BaseEntity { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("师傅id") |
| | | @TableField("worker_id") |
| | | private Integer workerId; |
| | | |
| | | @ApiModelProperty("订单id") |
| | | @TableField("order_id") |
| | | private Integer orderId; |
| | | |
| | | @ApiModelProperty("路线经纬度") |
| | | @TableField("coordinate") |
| | | private String coordinate; |
| | | |
| | | @ApiModelProperty("经度") |
| | | @TableField("longitude") |
| | | private BigDecimal longitude; |
| | | |
| | | @ApiModelProperty("纬度") |
| | | @TableField("latitude") |
| | | private BigDecimal latitude; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.worker.entity.Order; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface OrderMapper extends BaseMapper<Order> { |
| | | |
| | | /** |
| | | * 订单列表 |
| | | * |
| | | * @param userid 登录id |
| | | * @param state 区分 |
| | | * @return 订单列表 |
| | | */ |
| | | List<Order> orderList(@Param("userId") Integer userid, @Param("state") Integer state); |
| | | } |
New file |
| | |
| | | package com.ruoyi.worker.mapper; |
| | | |
| | | import com.ruoyi.worker.entity.SysServeCoordinate; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 师傅路线经纬度信息 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-03 |
| | | */ |
| | | @Mapper |
| | | public interface SysServeCoordinateMapper extends BaseMapper<SysServeCoordinate> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.worker.service; |
| | | |
| | | import com.ruoyi.worker.entity.SysServeCoordinate; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 师傅路线经纬度信息 服务类 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-03 |
| | | */ |
| | | public interface SysServeCoordinateService extends IService<SysServeCoordinate> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.worker.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.Result; |
| | |
| | | |
| | | @Override |
| | | public List<OrderListVO> orderNotHandle(Integer userid, String longitude, String latitude) { |
| | | List<Order> orderList = orderService.lambdaQuery() |
| | | .eq(Order::getServerId, userid) |
| | | .eq(Order::getState, Constants.ONE) |
| | | .eq(Order::getIsDelete, 0) |
| | | .orderByAsc(Order::getTopSort).list(); |
| | | QueryWrapper<Order> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("server_id", userid) |
| | | .in("state", 1, 2) |
| | | .eq("is_delete", Constants.ZERO) |
| | | .orderByAsc("CASE WHEN topSort IS NULL THEN 1 ELSE 0 END") |
| | | .orderByAsc("topSort"); |
| | | List<Order> orderList = orderService.list(wrapper); |
| | | // 根据经纬度距离封装 |
| | | List<OrderNotHandleVO> list = new ArrayList<>(); |
| | | boolean item = false; |
| | | for (Order order : orderList) { |
| | | if (null != order.getTopSort()) { |
| | | item = true; |
| | | break; |
| | | } |
| | | } |
| | | for (Order order : orderList) { |
| | | // 用户下单经纬度 |
| | | Double orderLongitude = order.getLongitude(); |
| | |
| | | Result<Long> result = GaoDeMapUtil.getDistance(orderPosition, longitude + "," + latitude); |
| | | Long distance = result.getDatas(); |
| | | // 回收服务信息 |
| | | RecoveryServe recoveryServe = recoveryServeService.lambdaQuery().eq(RecoveryServe::getId, order.getServeId()) |
| | | RecoveryServe recoveryServe = recoveryServeService.lambdaQuery() |
| | | .eq(RecoveryServe::getId, order.getServeId()) |
| | | .eq(RecoveryServe::getIsDelete, 0).one(); |
| | | // vo类信息封装 |
| | | OrderListVO orderListVO = new OrderListVO(order.getServeId()); |
| | |
| | | orderListVO.setSiteName(order.getSiteName()); |
| | | orderListVO.setServeId(order.getServeId()); |
| | | orderListVO.setServeName(order.getServeName()); |
| | | orderListVO.setServePicture(recoveryServe.getCover()); |
| | | orderListVO.setServePrice(recoveryServe.getDefaultPrice()); |
| | | if (null != recoveryServe) { |
| | | orderListVO.setServePicture(recoveryServe.getCover()); |
| | | orderListVO.setServePrice(recoveryServe.getDefaultPrice()); |
| | | } |
| | | orderListVO.setUserId(userid); |
| | | orderListVO.setReservationName(order.getReservationName()); |
| | | orderListVO.setReservationPhone(order.getReservationPhone()); |
| | |
| | | OrderNotHandleVO vo = new OrderNotHandleVO(distance, orderListVO); |
| | | list.add(vo); |
| | | } |
| | | // 根据距离排序 |
| | | list.sort(Comparator.comparing(OrderNotHandleVO::getDistance)); |
| | | List<OrderListVO> resultList = list.stream().map(OrderNotHandleVO::getOrderList).collect(Collectors.toList()); |
| | | for (OrderListVO orderListVO : resultList) { |
| | | Integer serveId = orderListVO.getServeId(); |
| | | // 回收服务信息 |
| | | RecoveryServe recoveryServe = recoveryServeService.lambdaQuery().eq(RecoveryServe::getId, serveId) |
| | | .eq(RecoveryServe::getIsDelete, 0).one(); |
| | | if (null != recoveryServe) { |
| | | orderListVO.setServePicture(recoveryServe.getCover()); |
| | | if (item) { |
| | | return list.stream().map(OrderNotHandleVO::getOrderList).collect(Collectors.toList()); |
| | | } else { |
| | | // 根据距离排序 |
| | | list.sort(Comparator.comparing(OrderNotHandleVO::getDistance)); |
| | | List<OrderListVO> resultList = list.stream().map(OrderNotHandleVO::getOrderList).collect(Collectors.toList()); |
| | | for (OrderListVO orderListVO : resultList) { |
| | | Integer serveId = orderListVO.getServeId(); |
| | | // 回收服务信息 |
| | | RecoveryServe recoveryServe = recoveryServeService.lambdaQuery().eq(RecoveryServe::getId, serveId) |
| | | .eq(RecoveryServe::getIsDelete, 0).one(); |
| | | if (null != recoveryServe) { |
| | | orderListVO.setServePicture(recoveryServe.getCover()); |
| | | } |
| | | } |
| | | return resultList; |
| | | } |
| | | return resultList; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean orderTop(Integer orderId, Integer userid) { |
| | | // 订单代办列表 |
| | | List<Order> orderList = orderService.lambdaQuery().eq(Order::getServerId, userid) |
| | | .eq(Order::getState, Constants.ONE) |
| | | .in(Order::getState, Constants.ONE, Constants.TWO) |
| | | .eq(Order::getIsDelete, 0) |
| | | .eq(Order::getType, Constants.ZERO) |
| | | .orderByAsc(Order::getTopSort).list(); |
| | | List<Order> orders = orderList.stream().filter(data -> null != data.getTopSort()).collect(Collectors.toList()); |
| | | int itemSort = 2; |
| | | for (Order order : orders) { |
| | | order.setTopSort(itemSort); |
| | | itemSort++; |
| | | for (Order order : orderList) { |
| | | if (null != order.getTopSort()) { |
| | | order.setTopSort(itemSort); |
| | | itemSort++; |
| | | } |
| | | } |
| | | orderService.updateBatchById(orderList); |
| | | return orderService.lambdaUpdate().set(Order::getTopSort, Constants.ONE) |
| | | .eq(Order::getServerId, userid) |
| | | .eq(Order::getId, orderId) |
| | | .eq(Order::getIsDelete, 0).update(); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<Order> orderList(Integer userid, Integer state) { |
| | | LambdaQueryChainWrapper<Order> wrapper = lambdaQuery().eq(Order::getIsDelete, 0) |
| | | .eq(Order::getType, 0); |
| | | LambdaQueryChainWrapper<Order> wrapper = lambdaQuery() |
| | | .eq(Order::getIsDelete, 0); |
| | | // 查询所有订单/待上门/已完结订单 |
| | | if (Constants.ZERO.equals(state)) { |
| | | wrapper.in(Order::getState, 1, 2, 3, 4, 5); |
| | | } else if (Constants.ONE.equals(state)) { |
| | | wrapper.eq(Order::getState, 1); |
| | | if (Constants.ONE.equals(state)) { |
| | | wrapper.in(Order::getState, 1, 2); |
| | | } else if (Constants.TWO.equals(state)) { |
| | | wrapper.eq(Order::getState, 3); |
| | | } else { |
| | | wrapper.in(Order::getState, 1, 2, 3, 4, 5); |
| | | } |
| | | List<Order> list = baseMapper.orderList(userid, state); |
| | | return wrapper.eq(Order::getServerId, userid).list(); |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.worker.service.impl; |
| | | |
| | | import com.ruoyi.worker.entity.SysServeCoordinate; |
| | | import com.ruoyi.worker.mapper.SysServeCoordinateMapper; |
| | | import com.ruoyi.worker.service.SysServeCoordinateService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 师傅路线经纬度信息 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author hjl |
| | | * @since 2024-07-03 |
| | | */ |
| | | @Service |
| | | public class SysServeCoordinateServiceImpl extends ServiceImpl<SysServeCoordinateMapper, SysServeCoordinate> implements SysServeCoordinateService { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.worker.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | @ApiModelProperty("预约地址") |
| | | private String reservationAddress; |
| | | |
| | | @ApiModelProperty("预约上门时间") |
| | | private Date time; |
| | | @ApiModelProperty("预约上门时间段") |
| | | private String time; |
| | | |
| | | @ApiModelProperty("服务人员id") |
| | | private Integer serverId; |
| | |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty("接单时间(师傅接单或后台派单,更新该字段时间)") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | private Date acceptTime; |
| | | |
| | | @ApiModelProperty("师傅到达预约地点时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm") |
| | | private Date arriveTime; |
| | | |
| | | @ApiModelProperty("订单类型(0:正常订单,1:后台订单(后台订单与用户端、师傅端无联系))") |
| | |
| | | |
| | | <select id="orderCount" resultType="com.ruoyi.worker.vo.OrderCountVO"> |
| | | SELECT COALESCE(SUM(CASE WHEN o.state IN (1, 2, 3) THEN 1 ELSE 0 END), 0) AS total, |
| | | COALESCE(SUM(CASE WHEN o.state = 1 THEN 1 ELSE 0 END), 0) AS waitVisit, |
| | | COALESCE(SUM(CASE WHEN o.state in (1, 2)THEN 1 ELSE 0 END), 0) AS waitVisit, |
| | | COALESCE(SUM(CASE WHEN o.state = 3 THEN 1 ELSE 0 END), 0) AS completed |
| | | FROM t_order o |
| | | left join sys_master_worker m on o.server_id = m.id |
| | |
| | | <result column="type" property="type"/> |
| | | <result column="longitude" property="longitude"/> |
| | | <result column="latitude" property="latitude"/> |
| | | <result column="cover" property="cover"/> |
| | | </resultMap> |
| | | |
| | | <select id="orderList" resultMap="BaseResultMap"> |
| | | select o.*, s.cover |
| | | from t_order o |
| | | left join sys_recovery_serve s on o.serve_id = s.id |
| | | <where> |
| | | o.is_delete = 0 |
| | | and s.is_delete = 0 |
| | | and o.server_id = #{userId} |
| | | <if test="state == 1"> |
| | | and o.state in (1, 2) |
| | | </if> |
| | | <if test="state == 2"> |
| | | and o.state = 3 |
| | | </if> |
| | | <choose> |
| | | <when test="state == 1"> |
| | | and o.state in (1, 2) |
| | | </when> |
| | | <when test="state == 2"> |
| | | and o.state = 3 |
| | | </when> |
| | | <otherwise> |
| | | and o.state in (1, 2, 3) |
| | | </otherwise> |
| | | </choose> |
| | | </where> |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.worker.mapper.SysServeCoordinateMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.worker.entity.SysServeCoordinate"> |
| | | <id column="id" property="id" /> |
| | | <result column="worker_id" property="workerId" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="coordinate" property="coordinate" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="is_delete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |