【admin】新增# 1.新增检修员小程序列表、抢单、接单、详情接口
							parent
							
								
									f770a71adf
								
							
						
					
					
						commit
						faee0d88a8
					
				| 
						 | 
					@ -92,6 +92,12 @@ public class MaintenanceOrderServiceImpl implements IMaintenanceOrderService {
 | 
				
			||||||
                    regionMap.get(item.getEquipmentDistrictId()) +
 | 
					                    regionMap.get(item.getEquipmentDistrictId()) +
 | 
				
			||||||
                    item.getDetailedAddress());
 | 
					                    item.getDetailedAddress());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //设置接单人名称
 | 
				
			||||||
 | 
					            User user = userMapper.selectById(item.getReceiverId());
 | 
				
			||||||
 | 
					            if(user != null){
 | 
				
			||||||
 | 
					                vo.setReceiverName(user.getNickname());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            list.add(vo);
 | 
					            list.add(vo);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -211,8 +217,8 @@ public class MaintenanceOrderServiceImpl implements IMaintenanceOrderService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Assert.notNull(model, "数据不存在!");
 | 
					        Assert.notNull(model, "数据不存在!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(param.getOrderStatus() == MaintenanceOrderStatusEnum.WAITING_LIST.getStatus() ||
 | 
					        if(model.getOrderStatus() == MaintenanceOrderStatusEnum.WAITING_LIST.getStatus() ||
 | 
				
			||||||
                param.getOrderStatus() == MaintenanceOrderStatusEnum.PENDING_ORDER.getStatus()){
 | 
					                model.getOrderStatus() == MaintenanceOrderStatusEnum.PENDING_ORDER.getStatus()){
 | 
				
			||||||
            model.setReceiverId(param.getReceiverId());
 | 
					            model.setReceiverId(param.getReceiverId());
 | 
				
			||||||
            model.setReceiverType(param.getReceiverType());
 | 
					            model.setReceiverType(param.getReceiverType());
 | 
				
			||||||
            model.setOrderDistance(param.getOrderDistance());
 | 
					            model.setOrderDistance(param.getOrderDistance());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,21 +28,21 @@ public class MaintenanceOrderParam implements Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String orderNo;
 | 
					    private String orderNo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NotNull(message = "orderSource参数缺失", groups = {create.class, update.class})
 | 
					    @NotNull(message = "orderSource参数缺失", groups = {create.class})
 | 
				
			||||||
    @DecimalMin(value = "0", message = "orderSource参数值不能少于0", groups = {create.class, update.class})
 | 
					    @DecimalMin(value = "0", message = "orderSource参数值不能少于0", groups = {create.class})
 | 
				
			||||||
    private Integer orderSource;
 | 
					    private Integer orderSource;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Integer orderStatus;
 | 
					    private Integer orderStatus;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NotNull(message = "clientId参数缺失", groups = {create.class, update.class})
 | 
					    @NotNull(message = "clientId参数缺失", groups = {create.class})
 | 
				
			||||||
    @DecimalMin(value = "0", message = "clientId参数值不能少于0", groups = {create.class, update.class})
 | 
					    @DecimalMin(value = "0", message = "clientId参数值不能少于0", groups = {create.class})
 | 
				
			||||||
    private Long clientId;
 | 
					    private Long clientId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NotNull(message = "equipmentId参数缺失", groups = {create.class, update.class})
 | 
					    @NotNull(message = "equipmentId参数缺失", groups = {create.class})
 | 
				
			||||||
    @DecimalMin(value = "0", message = "equipmentId参数值不能少于0", groups = {create.class, update.class})
 | 
					    @DecimalMin(value = "0", message = "equipmentId参数值不能少于0", groups = {create.class})
 | 
				
			||||||
    private Long equipmentId;
 | 
					    private Long equipmentId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NotNull(message = "faultId参数缺失", groups = {create.class, update.class})
 | 
					    @NotNull(message = "faultId参数缺失", groups = {create.class})
 | 
				
			||||||
    @DecimalMin(value = "0", message = "faultId参数值不能少于0", groups = {create.class, update.class})
 | 
					    @DecimalMin(value = "0", message = "faultId参数值不能少于0", groups = {create.class, update.class})
 | 
				
			||||||
    private Long faultId;
 | 
					    private Long faultId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,7 @@ public class MaintenanceOrderParam implements Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String faultImg;
 | 
					    private String faultImg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NotNull(message = "receiverType参数缺失", groups = {create.class, update.class})
 | 
					    @NotNull(message = "receiverType参数缺失", groups = {create.class})
 | 
				
			||||||
    @DecimalMin(value = "0", message = "receiverType参数值不能少于0", groups = {create.class, update.class})
 | 
					    @DecimalMin(value = "0", message = "receiverType参数值不能少于0", groups = {create.class, update.class})
 | 
				
			||||||
    private Long receiverType;
 | 
					    private Long receiverType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,6 @@ public class MaintenanceOrderParam implements Serializable {
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 订单去向 0-工单池 1-检修员
 | 
					     * 订单去向 0-工单池 1-检修员
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @NotNull(message = "repairWorkOrderFlow参数缺失", groups = {create.class, update.class})
 | 
					 | 
				
			||||||
    private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
 | 
					    private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String faultName; //故障名称
 | 
					    private String faultName; //故障名称
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,7 @@ public class MaintenanceOrderListVo implements Serializable {
 | 
				
			||||||
    private Date updateTime; // 更新时间
 | 
					    private Date updateTime; // 更新时间
 | 
				
			||||||
    private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
 | 
					    private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String faultName; //故障名称
 | 
					    private String faultName; //故障名称
 | 
				
			||||||
    private String equipmentNo; //设备编号
 | 
					    private String equipmentNo; //设备编号
 | 
				
			||||||
    private String equipmentName; //设备名称
 | 
					    private String equipmentName; //设备名称
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,7 @@ public class SystemAuthAdminVo implements Serializable {
 | 
				
			||||||
    private String lastLoginTime;  // 最后登录时间
 | 
					    private String lastLoginTime;  // 最后登录时间
 | 
				
			||||||
    private String createTime;     // 创建时间
 | 
					    private String createTime;     // 创建时间
 | 
				
			||||||
    private String updateTime;     // 更新时间
 | 
					    private String updateTime;     // 更新时间
 | 
				
			||||||
 | 
					    private Integer userId; //用户id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String plantName;      //工厂名
 | 
					    private String plantName;      //工厂名
 | 
				
			||||||
    private Integer sex; // 性别 0-男 1-女
 | 
					    private Integer sex; // 性别 0-男 1-女
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,7 @@ public class SystemAuthAdminDto implements Serializable {
 | 
				
			||||||
    private String lastLoginTime;  // 最后登录时间
 | 
					    private String lastLoginTime;  // 最后登录时间
 | 
				
			||||||
    private String createTime;     // 创建时间
 | 
					    private String createTime;     // 创建时间
 | 
				
			||||||
    private String updateTime;     // 更新时间
 | 
					    private String updateTime;     // 更新时间
 | 
				
			||||||
 | 
					    private Integer userId; //用户id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String plantName;      //工厂名
 | 
					    private String plantName;      //工厂名
 | 
				
			||||||
    private Integer sex; // 性别 0-男 1-女
 | 
					    private Integer sex; // 性别 0-男 1-女
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,4 +56,6 @@ public class MaintenanceOrderDto implements Serializable {
 | 
				
			||||||
    private Long equipmentProvinceId; //设备省id
 | 
					    private Long equipmentProvinceId; //设备省id
 | 
				
			||||||
    private Long equipmentDistrictId; //设备区id
 | 
					    private Long equipmentDistrictId; //设备区id
 | 
				
			||||||
    private Long equipmentCityId; //设备市id
 | 
					    private Long equipmentCityId; //设备市id
 | 
				
			||||||
 | 
					    private double longitude; //经度
 | 
				
			||||||
 | 
					    private double latitude; //纬度
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
package com.hcy.common.entity.order;
 | 
					package com.hcy.common.entity.order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.annotation.FieldStrategy;
 | 
				
			||||||
import com.baomidou.mybatisplus.annotation.IdType;
 | 
					import com.baomidou.mybatisplus.annotation.IdType;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.annotation.TableField;
 | 
				
			||||||
import com.baomidou.mybatisplus.annotation.TableId;
 | 
					import com.baomidou.mybatisplus.annotation.TableId;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,5 +49,5 @@ public class MaintenanceOrder implements Serializable {
 | 
				
			||||||
    private Date createTime; // 创建时间
 | 
					    private Date createTime; // 创建时间
 | 
				
			||||||
    private Date updateTime; // 更新时间
 | 
					    private Date updateTime; // 更新时间
 | 
				
			||||||
    private Integer isDelete; // 是否删除 0-未删除 1-删除
 | 
					    private Integer isDelete; // 是否删除 0-未删除 1-删除
 | 
				
			||||||
 | 
					    private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,11 @@ public enum MaintenanceOrderStatusEnum {
 | 
				
			||||||
    MAINTENANCE_ING(5,"维修中"),
 | 
					    MAINTENANCE_ING(5,"维修中"),
 | 
				
			||||||
    FINISHED(6,"已完成"),
 | 
					    FINISHED(6,"已完成"),
 | 
				
			||||||
    CHARGEBACK(7,"已退单"),
 | 
					    CHARGEBACK(7,"已退单"),
 | 
				
			||||||
    CLOSED(8,"已关闭");
 | 
					    CLOSED(8,"已关闭"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    NEAREST_TO_ME(0,"离我最近"),
 | 
				
			||||||
 | 
					    TIME_PRIORITY(1,"时间优先");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final int status;
 | 
					    private final int status;
 | 
				
			||||||
    private final String desc;
 | 
					    private final String desc;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,9 @@ import com.hcy.common.dto.order.MaintenanceOrderDto;
 | 
				
			||||||
import com.hcy.common.entity.order.MaintenanceOrder;
 | 
					import com.hcy.common.entity.order.MaintenanceOrder;
 | 
				
			||||||
import org.apache.ibatis.annotations.Mapper;
 | 
					import org.apache.ibatis.annotations.Mapper;
 | 
				
			||||||
import org.apache.ibatis.annotations.Param;
 | 
					import org.apache.ibatis.annotations.Param;
 | 
				
			||||||
 | 
					import org.apache.ibatis.annotations.Select;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 检修订单Mapper
 | 
					 * 检修订单Mapper
 | 
				
			||||||
| 
						 | 
					@ -14,4 +17,13 @@ import org.apache.ibatis.annotations.Param;
 | 
				
			||||||
public interface MaintenanceOrderMapper extends IBaseMapper<MaintenanceOrder> {
 | 
					public interface MaintenanceOrderMapper extends IBaseMapper<MaintenanceOrder> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Page<MaintenanceOrderDto> list(Page page,@Param("param") MaintenanceOrderDto maintenanceOrderDto);
 | 
					    Page<MaintenanceOrderDto> list(Page page,@Param("param") MaintenanceOrderDto maintenanceOrderDto);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    List<MaintenanceOrderDto> list(MaintenanceOrderDto maintenanceOrderDto);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 通过订单id查询检修订单
 | 
				
			||||||
 | 
					     * @return MaintenanceOrder
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Select("select * from lc_maintenance_order where is_delete = 0 and id = #{id}")
 | 
				
			||||||
 | 
					    MaintenanceOrder findMaintenanceOrderById(@Param("id") Long id);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -191,4 +191,41 @@ public class ToolsUtil {
 | 
				
			||||||
        return map2;
 | 
					        return map2;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 地球平均半径(单位:米)
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private static final double EARTH_AVG_RADIUS = 6371000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 方法二:(反余弦计算方式)
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param longitude1 第一点的经度
 | 
				
			||||||
 | 
					     * @param latitude1  第一点的纬度
 | 
				
			||||||
 | 
					     * @param longitude2 第二点的经度
 | 
				
			||||||
 | 
					     * @param latitude2  第二点的纬度
 | 
				
			||||||
 | 
					     * @return 返回的距离,单位m
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static double getDistance(double longitude1, double latitude1, double longitude2, double latitude2) {
 | 
				
			||||||
 | 
					        // 经纬度(角度)转弧度。弧度作为作参数,用以调用Math.cos和Math.sin
 | 
				
			||||||
 | 
					        // A经弧度
 | 
				
			||||||
 | 
					        double radiansAX = Math.toRadians(longitude1);
 | 
				
			||||||
 | 
					        // A纬弧度
 | 
				
			||||||
 | 
					        double radiansAY = Math.toRadians(latitude1);
 | 
				
			||||||
 | 
					        // B经弧度
 | 
				
			||||||
 | 
					        double radiansBX = Math.toRadians(longitude2);
 | 
				
			||||||
 | 
					        // B纬弧度
 | 
				
			||||||
 | 
					        double radiansBY = Math.toRadians(latitude2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 公式中“cosβ1cosβ2cos(α1-α2)+sinβ1sinβ2”的部分,得到∠AOB的cos值
 | 
				
			||||||
 | 
					        double cos = Math.cos(radiansAY) * Math.cos(radiansBY) * Math.cos(radiansAX - radiansBX) + Math.sin(radiansAY) * Math.sin(radiansBY);
 | 
				
			||||||
 | 
					        // System.out.println("cos = " + cos); // 值域[-1,1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 反余弦值
 | 
				
			||||||
 | 
					        double acos = Math.acos(cos);
 | 
				
			||||||
 | 
					        // System.out.println("acos = " + acos); // 值域[0,π]
 | 
				
			||||||
 | 
					        // System.out.println("∠AOB = " + Math.toDegrees(acos)); // 球心角 值域[0,180]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 最终结果
 | 
				
			||||||
 | 
					        return EARTH_AVG_RADIUS * acos;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
<mapper namespace="com.hcy.common.mapper.order.MaintenanceOrderMapper">
 | 
					<mapper namespace="com.hcy.common.mapper.order.MaintenanceOrderMapper">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <select id="list" resultType="com.hcy.common.dto.order.MaintenanceOrderDto">
 | 
					    <select id="pageList" resultType="com.hcy.common.dto.order.MaintenanceOrderDto">
 | 
				
			||||||
        SELECT
 | 
					        SELECT
 | 
				
			||||||
            lmo.*,
 | 
					            lmo.*,
 | 
				
			||||||
            lf.`name` as faultName,
 | 
					            lf.`name` as faultName,
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,9 @@
 | 
				
			||||||
            lu.username as receiverName,
 | 
					            lu.username as receiverName,
 | 
				
			||||||
            le.province_id as equipmentProvinceId,
 | 
					            le.province_id as equipmentProvinceId,
 | 
				
			||||||
            le.district_id as equipmentDistrictId,
 | 
					            le.district_id as equipmentDistrictId,
 | 
				
			||||||
            le.city_id as equipmentCityId
 | 
					            le.city_id as equipmentCityId,
 | 
				
			||||||
 | 
					            le.longitude,
 | 
				
			||||||
 | 
					            le.latitude
 | 
				
			||||||
        FROM
 | 
					        FROM
 | 
				
			||||||
            la_maintenance_order AS lmo
 | 
					            la_maintenance_order AS lmo
 | 
				
			||||||
            LEFT JOIN la_client AS lc ON lc.id = lmo.client_id
 | 
					            LEFT JOIN la_client AS lc ON lc.id = lmo.client_id
 | 
				
			||||||
| 
						 | 
					@ -31,7 +33,7 @@
 | 
				
			||||||
                and lmo.order_source = #{param.orderSource}
 | 
					                and lmo.order_source = #{param.orderSource}
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
            <if test="param.clientName != null and param.clientName != ''">
 | 
					            <if test="param.clientName != null and param.clientName != ''">
 | 
				
			||||||
                and lc.name like concat('%',#{param.clientName},'%')
 | 
					                and lc.client_name like concat('%',#{param.clientName},'%')
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
            <if test="param.creatorName != null and param.creatorName != ''">
 | 
					            <if test="param.creatorName != null and param.creatorName != ''">
 | 
				
			||||||
                and lsaa.username like concat('%',#{param.creatorName},'%')
 | 
					                and lsaa.username like concat('%',#{param.creatorName},'%')
 | 
				
			||||||
| 
						 | 
					@ -40,7 +42,7 @@
 | 
				
			||||||
                and lu.username like concat('%',#{param.receiverName},'%')
 | 
					                and lu.username like concat('%',#{param.receiverName},'%')
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
            <if test="param.orderStatus != null">
 | 
					            <if test="param.orderStatus != null">
 | 
				
			||||||
                and order_status = #{param.orderStatus}
 | 
					                and find_in_set(lmo.order_status,#{param.orderStatus})
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
            order by create_time desc
 | 
					            order by create_time desc
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@
 | 
				
			||||||
            t.nickname,
 | 
					            t.nickname,
 | 
				
			||||||
            t.avatar,
 | 
					            t.avatar,
 | 
				
			||||||
            t.role,
 | 
					            t.role,
 | 
				
			||||||
 | 
					            t.user_id,
 | 
				
			||||||
            sd.NAME AS dept,
 | 
					            sd.NAME AS dept,
 | 
				
			||||||
            t.is_multipoint,
 | 
					            t.is_multipoint,
 | 
				
			||||||
            t.is_disable,
 | 
					            t.is_disable,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
<mapper namespace="com.hcy.common.mapper.order.MaintenanceOrderMapper">
 | 
					<mapper namespace="com.hcy.common.mapper.order.MaintenanceOrderMapper">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <select id="list" resultType="com.hcy.common.dto.order.MaintenanceOrderDto">
 | 
					    <select id="pageList" resultType="com.hcy.common.dto.order.MaintenanceOrderDto">
 | 
				
			||||||
        SELECT
 | 
					        SELECT
 | 
				
			||||||
            lmo.*,
 | 
					            lmo.*,
 | 
				
			||||||
            lf.`name` as faultName,
 | 
					            lf.`name` as faultName,
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,9 @@
 | 
				
			||||||
            lu.username as receiverName,
 | 
					            lu.username as receiverName,
 | 
				
			||||||
            le.province_id as equipmentProvinceId,
 | 
					            le.province_id as equipmentProvinceId,
 | 
				
			||||||
            le.district_id as equipmentDistrictId,
 | 
					            le.district_id as equipmentDistrictId,
 | 
				
			||||||
            le.city_id as equipmentCityId
 | 
					            le.city_id as equipmentCityId,
 | 
				
			||||||
 | 
					            le.longitude,
 | 
				
			||||||
 | 
					            le.latitude
 | 
				
			||||||
        FROM
 | 
					        FROM
 | 
				
			||||||
            la_maintenance_order AS lmo
 | 
					            la_maintenance_order AS lmo
 | 
				
			||||||
            LEFT JOIN la_client AS lc ON lc.id = lmo.client_id
 | 
					            LEFT JOIN la_client AS lc ON lc.id = lmo.client_id
 | 
				
			||||||
| 
						 | 
					@ -31,7 +33,7 @@
 | 
				
			||||||
                and lmo.order_source = #{param.orderSource}
 | 
					                and lmo.order_source = #{param.orderSource}
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
            <if test="param.clientName != null and param.clientName != ''">
 | 
					            <if test="param.clientName != null and param.clientName != ''">
 | 
				
			||||||
                and lc.name like concat('%',#{param.clientName},'%')
 | 
					                and lc.client_name like concat('%',#{param.clientName},'%')
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
            <if test="param.creatorName != null and param.creatorName != ''">
 | 
					            <if test="param.creatorName != null and param.creatorName != ''">
 | 
				
			||||||
                and lsaa.username like concat('%',#{param.creatorName},'%')
 | 
					                and lsaa.username like concat('%',#{param.creatorName},'%')
 | 
				
			||||||
| 
						 | 
					@ -40,7 +42,7 @@
 | 
				
			||||||
                and lu.username like concat('%',#{param.receiverName},'%')
 | 
					                and lu.username like concat('%',#{param.receiverName},'%')
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
            <if test="param.orderStatus != null">
 | 
					            <if test="param.orderStatus != null">
 | 
				
			||||||
                and order_status = #{param.orderStatus}
 | 
					                and find_in_set(lmo.order_status,#{param.orderStatus})
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
            order by create_time desc
 | 
					            order by create_time desc
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@
 | 
				
			||||||
            t.nickname,
 | 
					            t.nickname,
 | 
				
			||||||
            t.avatar,
 | 
					            t.avatar,
 | 
				
			||||||
            t.role,
 | 
					            t.role,
 | 
				
			||||||
 | 
					            t.user_id,
 | 
				
			||||||
            sd.NAME AS dept,
 | 
					            sd.NAME AS dept,
 | 
				
			||||||
            t.is_multipoint,
 | 
					            t.is_multipoint,
 | 
				
			||||||
            t.is_disable,
 | 
					            t.is_disable,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,80 @@
 | 
				
			||||||
 | 
					package com.hcy.front.controller.order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hcy.common.core.AjaxResult;
 | 
				
			||||||
 | 
					import com.hcy.common.core.PageResult;
 | 
				
			||||||
 | 
					import com.hcy.common.validator.annotation.IDMust;
 | 
				
			||||||
 | 
					import com.hcy.front.service.order.IMaintenanceOrderService;
 | 
				
			||||||
 | 
					import com.hcy.front.validate.PageParam;
 | 
				
			||||||
 | 
					import com.hcy.front.validate.order.MaintenanceOrderParam;
 | 
				
			||||||
 | 
					import com.hcy.front.vo.order.MaintenanceOrderDetailVo;
 | 
				
			||||||
 | 
					import com.hcy.front.vo.order.MaintenanceOrderListVo;
 | 
				
			||||||
 | 
					import lombok.extern.java.Log;
 | 
				
			||||||
 | 
					import org.springframework.validation.annotation.Validated;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Resource;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 检修订单管理
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@RequestMapping("api/maintenanceOrder")
 | 
				
			||||||
 | 
					public class MaintenanceOrderController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    IMaintenanceOrderService iMaintenanceOrderService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 检修订单列表
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam 搜索参数
 | 
				
			||||||
 | 
					     * @return Object
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/list")
 | 
				
			||||||
 | 
					    public Object list(MaintenanceOrderParam maintenanceOrderParam) {
 | 
				
			||||||
 | 
					        return AjaxResult.success(iMaintenanceOrderService.list(maintenanceOrderParam));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 抢单
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam 参数
 | 
				
			||||||
 | 
					     * @return Object
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/grabTheOrder")
 | 
				
			||||||
 | 
					    public Object grabTheOrder(@RequestBody MaintenanceOrderParam maintenanceOrderParam) {
 | 
				
			||||||
 | 
					        iMaintenanceOrderService.grabTheOrder(maintenanceOrderParam);
 | 
				
			||||||
 | 
					        return AjaxResult.success();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 接单
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam 参数
 | 
				
			||||||
 | 
					     * @return Object
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/receivingOrder")
 | 
				
			||||||
 | 
					    public Object receivingOrder(@RequestBody MaintenanceOrderParam maintenanceOrderParam) {
 | 
				
			||||||
 | 
					        iMaintenanceOrderService.receivingOrder(maintenanceOrderParam);
 | 
				
			||||||
 | 
					        return AjaxResult.success();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 退单
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam 参数
 | 
				
			||||||
 | 
					     * @return Object
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/checking")
 | 
				
			||||||
 | 
					    public Object checking(@RequestBody MaintenanceOrderParam maintenanceOrderParam) {
 | 
				
			||||||
 | 
					        iMaintenanceOrderService.checking(maintenanceOrderParam);
 | 
				
			||||||
 | 
					        return AjaxResult.success();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 检修工单详情
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return Object
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/detail")
 | 
				
			||||||
 | 
					    public Object detail() {
 | 
				
			||||||
 | 
					        return AjaxResult.success(iMaintenanceOrderService.detail());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,47 @@
 | 
				
			||||||
 | 
					package com.hcy.front.service.order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hcy.common.core.PageResult;
 | 
				
			||||||
 | 
					import com.hcy.front.validate.PageParam;
 | 
				
			||||||
 | 
					import com.hcy.front.validate.order.MaintenanceOrderParam;
 | 
				
			||||||
 | 
					import com.hcy.front.vo.order.MaintenanceOrderDetailVo;
 | 
				
			||||||
 | 
					import com.hcy.front.vo.order.MaintenanceOrderListVo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 检修订单服务接口类
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface IMaintenanceOrderService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 检修订单列表
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam 搜索参数
 | 
				
			||||||
 | 
					     * @return PageResult<MaintenanceOrderVo>
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    List<MaintenanceOrderListVo> list(MaintenanceOrderParam maintenanceOrderParam);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 抢单
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam 参数
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void grabTheOrder(MaintenanceOrderParam maintenanceOrderParam);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 接单
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam 参数
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void receivingOrder(MaintenanceOrderParam maintenanceOrderParam);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 退单
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam 参数
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void checking(MaintenanceOrderParam maintenanceOrderParam);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 检修工单详情
 | 
				
			||||||
 | 
					     * @return MaintenanceOrderDetailVo
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    MaintenanceOrderDetailVo detail();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,197 @@
 | 
				
			||||||
 | 
					package com.hcy.front.service.order.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
				
			||||||
 | 
					import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
				
			||||||
 | 
					import com.hcy.common.constant.GlobalConstant;
 | 
				
			||||||
 | 
					import com.hcy.common.core.PageResult;
 | 
				
			||||||
 | 
					import com.hcy.common.dto.order.MaintenanceOrderDto;
 | 
				
			||||||
 | 
					import com.hcy.common.entity.client.Client;
 | 
				
			||||||
 | 
					import com.hcy.common.entity.client.Equipment;
 | 
				
			||||||
 | 
					import com.hcy.common.entity.fault.Fault;
 | 
				
			||||||
 | 
					import com.hcy.common.entity.order.MaintenanceOrder;
 | 
				
			||||||
 | 
					import com.hcy.common.entity.system.SystemAuthAdmin;
 | 
				
			||||||
 | 
					import com.hcy.common.entity.user.User;
 | 
				
			||||||
 | 
					import com.hcy.common.enums.order.MaintenanceOrderStatusEnum;
 | 
				
			||||||
 | 
					import com.hcy.common.enums.order.OrderStateEnum;
 | 
				
			||||||
 | 
					import com.hcy.common.exception.OperateException;
 | 
				
			||||||
 | 
					import com.hcy.common.mapper.client.ClientMapper;
 | 
				
			||||||
 | 
					import com.hcy.common.mapper.client.EquipmentMapper;
 | 
				
			||||||
 | 
					import com.hcy.common.mapper.fault.FaultMapper;
 | 
				
			||||||
 | 
					import com.hcy.common.mapper.order.MaintenanceOrderMapper;
 | 
				
			||||||
 | 
					import com.hcy.common.mapper.system.SystemAuthAdminMapper;
 | 
				
			||||||
 | 
					import com.hcy.common.mapper.user.UserMapper;
 | 
				
			||||||
 | 
					import com.hcy.common.utils.ToolsUtil;
 | 
				
			||||||
 | 
					import com.hcy.front.FrontThreadLocal;
 | 
				
			||||||
 | 
					import com.hcy.front.service.order.IMaintenanceOrderService;
 | 
				
			||||||
 | 
					import com.hcy.front.service.region.IDevRegionService;
 | 
				
			||||||
 | 
					import com.hcy.front.validate.PageParam;
 | 
				
			||||||
 | 
					import com.hcy.front.validate.order.MaintenanceOrderParam;
 | 
				
			||||||
 | 
					import com.hcy.front.vo.order.MaintenanceOrderDetailVo;
 | 
				
			||||||
 | 
					import com.hcy.front.vo.order.MaintenanceOrderListVo;
 | 
				
			||||||
 | 
					import com.hcy.front.vo.order.OrderStaffVo;
 | 
				
			||||||
 | 
					import org.springframework.beans.BeanUtils;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					import org.springframework.util.Assert;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Resource;
 | 
				
			||||||
 | 
					import java.math.BigDecimal;
 | 
				
			||||||
 | 
					import java.text.DecimalFormat;
 | 
				
			||||||
 | 
					import java.text.SimpleDateFormat;
 | 
				
			||||||
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 检修订单实现类
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					public class MaintenanceOrderServiceImpl implements IMaintenanceOrderService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    MaintenanceOrderMapper maintenanceOrderMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    ClientMapper clientMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    EquipmentMapper equipmentMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    SystemAuthAdminMapper systemAuthAdminMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    UserMapper userMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final DecimalFormat df = new DecimalFormat ("#.#");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 检修订单列表
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param maintenanceOrderParam    搜索参数
 | 
				
			||||||
 | 
					     * @return PageResult<MaintenanceOrderListVo>
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<MaintenanceOrderListVo> list(MaintenanceOrderParam maintenanceOrderParam) {
 | 
				
			||||||
 | 
					        MaintenanceOrderDto maintenanceOrderDto = new MaintenanceOrderDto();
 | 
				
			||||||
 | 
					        BeanUtils.copyProperties(maintenanceOrderParam,maintenanceOrderDto);
 | 
				
			||||||
 | 
					        //默认查询订单状态
 | 
				
			||||||
 | 
					        if(maintenanceOrderParam.getOrderStatus() == null){
 | 
				
			||||||
 | 
					            maintenanceOrderParam.setOrderStatus("1,2,7,8");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        List<MaintenanceOrderDto> maintenanceOrderList = maintenanceOrderMapper.list(maintenanceOrderDto);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<MaintenanceOrderListVo> returnData = new LinkedList<>();
 | 
				
			||||||
 | 
					        for (MaintenanceOrderDto item : maintenanceOrderList) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //判断抢单距离大于订单距离则返回订单
 | 
				
			||||||
 | 
					            double distance = ToolsUtil.getDistance(item.getLongitude(), item.getLatitude()
 | 
				
			||||||
 | 
					                    , maintenanceOrderParam.getLongitude(), maintenanceOrderParam.getLatitude());
 | 
				
			||||||
 | 
					            if(item.getOrderDistance().compareTo(BigDecimal.valueOf((distance / 1000))) >= 0){
 | 
				
			||||||
 | 
					                // 计算距离
 | 
				
			||||||
 | 
					                MaintenanceOrderListVo vo = new MaintenanceOrderListVo();
 | 
				
			||||||
 | 
					                BeanUtils.copyProperties(item, vo);
 | 
				
			||||||
 | 
					                vo.setDistance(String.valueOf(distance));
 | 
				
			||||||
 | 
					                returnData.add(vo);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(maintenanceOrderParam.getQueryType() == MaintenanceOrderStatusEnum.NEAREST_TO_ME.getStatus()){
 | 
				
			||||||
 | 
					            //按距离排序
 | 
				
			||||||
 | 
					            returnData = returnData.stream()
 | 
				
			||||||
 | 
					                    .sorted(Comparator.comparing(MaintenanceOrderListVo::getDistance))
 | 
				
			||||||
 | 
					                    .collect(Collectors.toList());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //将米数转换为km
 | 
				
			||||||
 | 
					            for (MaintenanceOrderListVo maintenanceOrderListVo : returnData) {
 | 
				
			||||||
 | 
					                double distance = Double.parseDouble(maintenanceOrderListVo.getDistance());
 | 
				
			||||||
 | 
					                if(distance < 1000){
 | 
				
			||||||
 | 
					                    maintenanceOrderListVo.setDistance(distance + "米");
 | 
				
			||||||
 | 
					                }else{
 | 
				
			||||||
 | 
					                    double km = distance / 1000;
 | 
				
			||||||
 | 
					                    maintenanceOrderListVo.setDistance(df.format(km) + "km");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return returnData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void grabTheOrder(MaintenanceOrderParam maintenanceOrderParam) {
 | 
				
			||||||
 | 
					        MaintenanceOrder maintenanceOrder = maintenanceOrderMapper.findMaintenanceOrderById(maintenanceOrderParam.getId());
 | 
				
			||||||
 | 
					        Assert.notNull(maintenanceOrder, "数据不存在");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(maintenanceOrder.getOrderStatus() == MaintenanceOrderStatusEnum.WAITING_LIST.getStatus()){
 | 
				
			||||||
 | 
					            maintenanceOrder.setReceiverId(FrontThreadLocal.getUserId().longValue());
 | 
				
			||||||
 | 
					            maintenanceOrder.setOrderStatus(MaintenanceOrderStatusEnum.CHECKING.getStatus());
 | 
				
			||||||
 | 
					            maintenanceOrder.setReceiverTime(new Date());
 | 
				
			||||||
 | 
					            maintenanceOrderMapper.updateById(maintenanceOrder);
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            throw new OperateException("订单已被其他人抢走");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void receivingOrder(MaintenanceOrderParam maintenanceOrderParam) {
 | 
				
			||||||
 | 
					        MaintenanceOrder maintenanceOrder = maintenanceOrderMapper.findMaintenanceOrderById(maintenanceOrderParam.getId());
 | 
				
			||||||
 | 
					        Assert.notNull(maintenanceOrder, "数据不存在");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(maintenanceOrder.getOrderStatus() == MaintenanceOrderStatusEnum.PENDING_ORDER.getStatus()){
 | 
				
			||||||
 | 
					            maintenanceOrder.setOrderStatus(MaintenanceOrderStatusEnum.CHECKING.getStatus());
 | 
				
			||||||
 | 
					            maintenanceOrder.setReceiverTime(new Date());
 | 
				
			||||||
 | 
					            maintenanceOrderMapper.updateById(maintenanceOrder);
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            throw new OperateException("订单状态不正确");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void checking(MaintenanceOrderParam maintenanceOrderParam) {
 | 
				
			||||||
 | 
					        MaintenanceOrder maintenanceOrder = maintenanceOrderMapper.findMaintenanceOrderById(maintenanceOrderParam.getId());
 | 
				
			||||||
 | 
					        Assert.notNull(maintenanceOrder, "数据不存在");
 | 
				
			||||||
 | 
					        Assert.notNull(maintenanceOrder.getCancelCause(), "接单原因不可为空");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(maintenanceOrder.getOrderStatus() == MaintenanceOrderStatusEnum.CHECKING.getStatus()){
 | 
				
			||||||
 | 
					            maintenanceOrder.setCancelOrderTime(new Date());
 | 
				
			||||||
 | 
					            maintenanceOrder.setOrderStatus(MaintenanceOrderStatusEnum.CHARGEBACK.getStatus());
 | 
				
			||||||
 | 
					            maintenanceOrder.setCancelCause(maintenanceOrderParam.getCancelCause());
 | 
				
			||||||
 | 
					            maintenanceOrderMapper.updateById(maintenanceOrder);
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            throw new OperateException("订单状态不正确");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public MaintenanceOrderDetailVo detail() {
 | 
				
			||||||
 | 
					        Integer userId = FrontThreadLocal.getUserId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        MaintenanceOrder maintenanceOrder = maintenanceOrderMapper.findMaintenanceOrderById(userId.longValue());
 | 
				
			||||||
 | 
					        Assert.notNull(maintenanceOrder, "数据不存在");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        MaintenanceOrderDetailVo vo = new MaintenanceOrderDetailVo();
 | 
				
			||||||
 | 
					        BeanUtils.copyProperties(maintenanceOrder, vo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //设置客户信息
 | 
				
			||||||
 | 
					        Client client = clientMapper.selectById(maintenanceOrder.getClientId());
 | 
				
			||||||
 | 
					        vo.setClientName(client.getClientName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //设置设备信息
 | 
				
			||||||
 | 
					        Equipment equipment = equipmentMapper.selectById(maintenanceOrder.getEquipmentId());
 | 
				
			||||||
 | 
					        vo.setEquipment(equipment);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //设置接收人姓名
 | 
				
			||||||
 | 
					        SystemAuthAdmin systemAuthAdmin = systemAuthAdminMapper.selectById(maintenanceOrder.getCreatorId());
 | 
				
			||||||
 | 
					        vo.setCreatorName(systemAuthAdmin.getNickname());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //设置接单人名称
 | 
				
			||||||
 | 
					        User user = userMapper.selectById(maintenanceOrder.getReceiverId());
 | 
				
			||||||
 | 
					        if(user != null){
 | 
				
			||||||
 | 
					            vo.setReceiverName(user.getNickname());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return vo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,111 @@
 | 
				
			||||||
 | 
					package com.hcy.front.validate.order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					import lombok.EqualsAndHashCode;
 | 
				
			||||||
 | 
					import lombok.experimental.Accessors;
 | 
				
			||||||
 | 
					import org.hibernate.validator.constraints.Length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.validation.constraints.DecimalMin;
 | 
				
			||||||
 | 
					import javax.validation.constraints.NotNull;
 | 
				
			||||||
 | 
					import java.io.Serializable;
 | 
				
			||||||
 | 
					import java.math.BigDecimal;
 | 
				
			||||||
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 检修订单参数
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					@EqualsAndHashCode(callSuper = false)
 | 
				
			||||||
 | 
					@Accessors(chain = true)
 | 
				
			||||||
 | 
					public class MaintenanceOrderParam implements Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public interface create{}
 | 
				
			||||||
 | 
					    public interface update{}
 | 
				
			||||||
 | 
					    public interface delete{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String orderNo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "orderSource参数缺失", groups = {create.class})
 | 
				
			||||||
 | 
					    @DecimalMin(value = "0", message = "orderSource参数值不能少于0", groups = {create.class})
 | 
				
			||||||
 | 
					    private Integer orderSource;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String orderStatus;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "clientId参数缺失", groups = {create.class})
 | 
				
			||||||
 | 
					    @DecimalMin(value = "0", message = "clientId参数值不能少于0", groups = {create.class})
 | 
				
			||||||
 | 
					    private Long clientId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "equipmentId参数缺失", groups = {create.class})
 | 
				
			||||||
 | 
					    @DecimalMin(value = "0", message = "equipmentId参数值不能少于0", groups = {create.class})
 | 
				
			||||||
 | 
					    private Long equipmentId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "faultId参数缺失", groups = {create.class, update.class})
 | 
				
			||||||
 | 
					    @DecimalMin(value = "0", message = "faultId参数值不能少于0", groups = {create.class, update.class})
 | 
				
			||||||
 | 
					    private Long faultId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String faultDescription;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String faultImg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull(message = "receiverType参数缺失", groups = {create.class, update.class})
 | 
				
			||||||
 | 
					    @DecimalMin(value = "0", message = "receiverType参数值不能少于0", groups = {create.class, update.class})
 | 
				
			||||||
 | 
					    private Long receiverType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long provinceId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long cityId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long districtId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private BigDecimal orderDistance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private BigDecimal totalAmount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private BigDecimal actualAmount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long receiverId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long repairId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Date receiverTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Date cancelOrderTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String cancelCause;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String refuseMaintenanceCause;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Length(max = 250, message = "remark参数不能超出250个字符", groups = {create.class, update.class})
 | 
				
			||||||
 | 
					    private String remark;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long creatorId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Date orderAccomplishTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long familiarFaultId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String familiarFaultDescription;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 订单去向 0-工单池 1-检修员
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @NotNull(message = "repairWorkOrderFlow参数缺失", groups = {create.class, update.class})
 | 
				
			||||||
 | 
					    private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String faultName; //故障名称
 | 
				
			||||||
 | 
					    private String equipmentNo; //设备编号
 | 
				
			||||||
 | 
					    private String equipmentName; //设备名称
 | 
				
			||||||
 | 
					    private String detailedAddress; //设备详情地址
 | 
				
			||||||
 | 
					    private String clientName; // 客户姓名
 | 
				
			||||||
 | 
					    private String creatorName; // 创建人姓名
 | 
				
			||||||
 | 
					    private String receiverName; // 接单人姓名
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private double longitude; // 经度
 | 
				
			||||||
 | 
					    private double latitude; // 纬度
 | 
				
			||||||
 | 
					    private Integer queryType; // 查询类型 0-离我最近 1-时间优先
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,52 @@
 | 
				
			||||||
 | 
					package com.hcy.front.vo.order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hcy.common.entity.client.Equipment;
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.Serializable;
 | 
				
			||||||
 | 
					import java.math.BigDecimal;
 | 
				
			||||||
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * MaintenanceOrderVo
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class MaintenanceOrderDetailVo implements Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long id; // id
 | 
				
			||||||
 | 
					    private String orderNo; // 订单编号
 | 
				
			||||||
 | 
					    private Long orderSource; // 订单来源 0-客户上报;1-系统创建;2-维修员创建;3-检修员创建;4-客服创建;5-维修主管创建
 | 
				
			||||||
 | 
					    private Long orderStatus; // 订单状态 0-待抢单;1-待接单;2-接单超时;3-检测中;4-待客户确认;5-维修中;6-已完成;7-已退单;8-已关闭
 | 
				
			||||||
 | 
					    private Long clientId; // 客户id
 | 
				
			||||||
 | 
					    private Long equipmentId; // 设备id
 | 
				
			||||||
 | 
					    private Long faultId; // 故障id
 | 
				
			||||||
 | 
					    private String faultDescription; // 故障描述
 | 
				
			||||||
 | 
					    private String faultImg; // 故障图片
 | 
				
			||||||
 | 
					    private Long receiverType; // 接单类型 0-区域派单;1-距离派单
 | 
				
			||||||
 | 
					    private Long provinceId; // 省id
 | 
				
			||||||
 | 
					    private Long cityId; // 市id
 | 
				
			||||||
 | 
					    private Long districtId; // 区id
 | 
				
			||||||
 | 
					    private BigDecimal orderDistance; // 订单距离
 | 
				
			||||||
 | 
					    private BigDecimal totalAmount; // 总金额
 | 
				
			||||||
 | 
					    private BigDecimal actualAmount; // 实际金额
 | 
				
			||||||
 | 
					    private Long receiverId; // 接单人id
 | 
				
			||||||
 | 
					    private Long repairId; // 返修id
 | 
				
			||||||
 | 
					    private Date receiverTime; // 接单时间
 | 
				
			||||||
 | 
					    private Date cancelOrderTime; // 取消订单时间
 | 
				
			||||||
 | 
					    private String cancelCause; // 取消原因
 | 
				
			||||||
 | 
					    private String refuseMaintenanceCause; // 拒绝维修原因
 | 
				
			||||||
 | 
					    private String remark; // 备注
 | 
				
			||||||
 | 
					    private Long creatorId; // 创建人id
 | 
				
			||||||
 | 
					    private Date orderAccomplishTime; // 订单完成时间
 | 
				
			||||||
 | 
					    private Long familiarFaultId; // 常见维修结论id
 | 
				
			||||||
 | 
					    private String familiarFaultDescription; // 常见维修结论描述
 | 
				
			||||||
 | 
					    private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String clientName; // 客户姓名
 | 
				
			||||||
 | 
					    private Equipment equipment; //设备信息
 | 
				
			||||||
 | 
					    private String faultName; //故障名称
 | 
				
			||||||
 | 
					    private String creatorName; // 创建人姓名
 | 
				
			||||||
 | 
					    private String receiverName; // 接单人姓名
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,56 @@
 | 
				
			||||||
 | 
					package com.hcy.front.vo.order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.Serializable;
 | 
				
			||||||
 | 
					import java.math.BigDecimal;
 | 
				
			||||||
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * MaintenanceOrderVo
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class MaintenanceOrderListVo implements Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Long id; // id
 | 
				
			||||||
 | 
					    private String orderNo; // 订单编号
 | 
				
			||||||
 | 
					    private Integer orderSource; // 订单来源 0-客户上报;1-系统创建;2-维修员创建;3-检修员创建;4-客服创建;5-维修主管创建
 | 
				
			||||||
 | 
					    private Integer orderStatus; // 订单状态 0-待抢单;1-待接单;2-接单超时;3-检测中;4-待客户确认;5-维修中;6-已完成;7-已退单;8-已关闭
 | 
				
			||||||
 | 
					    private Long clientId; // 客户id
 | 
				
			||||||
 | 
					    private Long equipmentId; // 设备id
 | 
				
			||||||
 | 
					    private Long faultId; // 故障id
 | 
				
			||||||
 | 
					    private String faultDescription; // 故障描述
 | 
				
			||||||
 | 
					    private String faultImg; // 故障图片
 | 
				
			||||||
 | 
					    private Long receiverType; // 接单类型 0-区域派单;1-距离派单
 | 
				
			||||||
 | 
					    private Long provinceId; // 省id
 | 
				
			||||||
 | 
					    private Long cityId; // 市id
 | 
				
			||||||
 | 
					    private Long districtId; // 区id
 | 
				
			||||||
 | 
					    private BigDecimal orderDistance; // 订单距离
 | 
				
			||||||
 | 
					    private BigDecimal totalAmount; // 总金额
 | 
				
			||||||
 | 
					    private BigDecimal actualAmount; // 实际金额
 | 
				
			||||||
 | 
					    private Long receiverId; // 接单人id
 | 
				
			||||||
 | 
					    private Long repairId; // 返修id
 | 
				
			||||||
 | 
					    private Date receiverTime; // 接单时间
 | 
				
			||||||
 | 
					    private Date cancelOrderTime; // 取消订单时间
 | 
				
			||||||
 | 
					    private String cancelCause; // 取消原因
 | 
				
			||||||
 | 
					    private String refuseMaintenanceCause; // 拒绝维修原因
 | 
				
			||||||
 | 
					    private String remark; // 备注
 | 
				
			||||||
 | 
					    private Long creatorId; // 创建人id
 | 
				
			||||||
 | 
					    private Date orderAccomplishTime; // 订单完成时间
 | 
				
			||||||
 | 
					    private Long familiarFaultId; // 常见维修结论id
 | 
				
			||||||
 | 
					    private String familiarFaultDescription; // 常见维修结论描述
 | 
				
			||||||
 | 
					    private Date createTime; // 创建时间
 | 
				
			||||||
 | 
					    private Date updateTime; // 更新时间
 | 
				
			||||||
 | 
					    private Integer repairWorkOrderFlow; //工单去向 0=工单池 1=检修员
 | 
				
			||||||
 | 
					    private String distance; //距离
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String faultName; //故障名称
 | 
				
			||||||
 | 
					    private String equipmentNo; //设备编号
 | 
				
			||||||
 | 
					    private String equipmentName; //设备名称
 | 
				
			||||||
 | 
					    private String detailedAddress; //设备详情地址
 | 
				
			||||||
 | 
					    private String clientName; // 客户姓名
 | 
				
			||||||
 | 
					    private String creatorName; // 创建人姓名
 | 
				
			||||||
 | 
					    private String receiverName; // 接单人姓名
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue