安装单维修单代码优化,安装单已完成后设备状态变为离线,设备表device加了repair_flag字段创建维修单时值为1,维修单已完成值为0,默认是0,修改小程序安装/维修上传图片存放的文件夹名称为deviceAdd,deviceRepair,创建维修单时对设备的查询根据设备的是否维修进行查询,查询出已维修的
9个文件已修改
113 ■■■■ 已修改文件
wumei-smart-master/springboot/wumei-admin/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/springboot/wumei-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/controller/DeviceOrderController.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/domain/Device.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/mapper/DeviceOrderMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/model/DeviceAllShortOutput.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/model/DeviceShortOutput.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/springboot/wumei-iot/src/main/resources/mapper/iot/DeviceMapper.xml 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/vue/src/views/equipmentManagement/maintenance.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wumei-smart-master/springboot/wumei-admin/src/main/resources/application.yml
@@ -11,7 +11,7 @@
  # 文件路径,以uploadPath结尾 示例( Windows配置 D:/uploadPath,Linux配置 /uploadPath)
  # /var/data/java/uploadPath
  # D:/uploadPath
  profile: D:/uploadPath
  profile: /var/data/java/uploadPath
  # 获取ip地址开关
  addressEnabled: true
wumei-smart-master/springboot/wumei-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
@@ -136,6 +136,6 @@
     * @return
     */
    public static String getDeviceOrderPath() {
        return getProfile() + "/deviceOrder";
        return getProfile() + "/deviceAdd";
    }
}
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/controller/DeviceOrderController.java
@@ -88,11 +88,25 @@
        } else {
            deviceOrder.setState(1);
        }
        //判断传过来的orderType的值是否为2-维修
        if ("2".equals(deviceOrder.getOrderType())) {
            Device device = new Device();
            device.setDeviceId(deviceOrder.getDeviceId());
            device.setRepairFlag(1);
            deviceService.updateDevice(device);
            log.info("orderType{}", deviceOrder.getOrderType());
            System.out.println(deviceOrder.getOrderType());
            //更新订单的用户信息
            SysUser sysUser = getLoginUser().getUser();
            deviceOrder.setCreateUserId(sysUser.getUserId());
            //插入维修单
            int rows = iDeviceOrderService.insertDeviceOrder(deviceOrder);
            if (rows > 0) {
                Device device1 = deviceService.selectDeviceByDeviceId(deviceOrder.getDeviceId());
                //更新当前设备的是否维修信息-未维修
                Device device = new Device();
                device.setDeviceId(deviceOrder.getDeviceId());
                device.setRepairFlag(1);
                device.setStatus(device1.getStatus());
                deviceService.updateDevice(device);
            }
            return toAjax(rows);
        }
        //更新订单的用户信息
        SysUser sysUser = getLoginUser().getUser();
@@ -121,16 +135,22 @@
    @Log(title = "修改设备订单信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DeviceOrder deviceOrder) throws Exception {
        //判断传过来的orderType的值是否为1-安装,并且安装单的状态为为已完成,修改设备的状态为离线状态
        if ("1".equals(deviceOrder.getOrderType()) && deviceOrder.getState() == 3) {
            Device device = new Device();
            device.setDeviceId(deviceOrder.getDeviceId());
            //修改设备的状态为离线
            device.setStatus(4);
            deviceService.updateDevice(device);
        }
        //判断传过来的orderType的值是否为2-维修,并且维修单的状态为为已完成,修改设备的是否为修为0-已维修
        if ("2".equals(deviceOrder.getOrderType()) && deviceOrder.getState() == 3) {
            Device device1 = deviceService.selectDeviceByDeviceId(deviceOrder.getDeviceId());
            Device device = new Device();
            device.setDeviceId(deviceOrder.getDeviceId());
            device.setRepairFlag(0);
            device.setStatus(device1.getStatus());
            deviceService.updateDevice(device);
        }
        //获取修改订单的用户信息
        SysUser sysUser = getLoginUser().getUser();
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/domain/Device.java
@@ -175,7 +175,7 @@
    private String delFlag;
    /**
     * 是否维修
     * 是否维修(1->未维修,0->已维修)
     */
    private Integer repairFlag;
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/mapper/DeviceOrderMapper.java
@@ -2,6 +2,7 @@
import com.ruoyi.iot.domain.DeviceOrder;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
@@ -20,6 +21,7 @@
     * @return
     * @throws Exception
     */
    public List<DeviceOrder> selectDeviceOrderList(DeviceOrder deviceOrder) throws Exception;
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/model/DeviceAllShortOutput.java
@@ -100,6 +100,11 @@
     */
    private Integer tDSA;
    /**
     * 是否维修(1->未维修,0->已维修)
     */
    private Integer repairFlag;
    public Integer getLocationWay() {
        return locationWay;
    }
@@ -235,4 +240,12 @@
    public void settDSA(Integer tDSA) {
        this.tDSA = tDSA;
    }
    public Integer getRepairFlag() {
        return repairFlag;
    }
    public void setRepairFlag(Integer repairFlag) {
        this.repairFlag = repairFlag;
    }
}
wumei-smart-master/springboot/wumei-iot/src/main/java/com/ruoyi/iot/model/DeviceShortOutput.java
@@ -146,6 +146,11 @@
     */
    private Integer tDSA;
    /**
     * 是否维修(1->未维修,0->已维修)
     */
    private Integer repairFlag;
    private List<StringModelOutput> stringList;
    private List<IntegerModelOutput> integerList;
    private List<DecimalModelOutput> decimalList;
@@ -377,4 +382,12 @@
    public void settDSA(Integer tDSA) {
        this.tDSA = tDSA;
    }
    public Integer getRepairFlag() {
        return repairFlag;
    }
    public void setRepairFlag(Integer repairFlag) {
        this.repairFlag = repairFlag;
    }
}
wumei-smart-master/springboot/wumei-iot/src/main/resources/mapper/iot/DeviceMapper.xml
@@ -59,6 +59,7 @@
        <result property="assignTime" column="assign_time"/>
        <result property="tDSP" column="tds_p"/>
        <result property="tDSA" column="tds_a"/>
        <result property="repairFlag" column="repair_flag"/>
    </resultMap>
    <resultMap type="com.ruoyi.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
@@ -79,6 +80,7 @@
        <result property="isOwner" column="is_owner"/>
        <result property="tDSP" column="tds_p"/>
        <result property="tDSA" column="tds_a"/>
        <result property="repairFlag" column="repair_flag"/>
    </resultMap>
    <resultMap type="com.ruoyi.iot.model.ProductAuthenticateModel" id="DeviceAuthenticateResult">
@@ -329,22 +331,44 @@
        from iot_device d
        inner join iot_device_user u on u.device_id = d.device_id
        inner join sys_user su on su.user_id = d.tenant_id
        <if test="groupId != null and groupId !=0  ">left join iot_device_group g on g.device_id=d.device_id</if>
        <if test="groupId != null and groupId !=0  ">
            left join iot_device_group g on g.device_id=d.device_id
        </if>
        <where>
            <if test="groupId != null and groupId !=0  ">and g.group_id = #{groupId}</if>
            <if test="userId != null and userId != 0">and u.user_id = #{userId}</if>
            <if test="tenantId != null and tenantId != 0">and d.tenant_id = #{tenantId}</if>
            <if test="deviceName != null  and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
            <if test="groupId != null and groupId !=0  ">
                and g.group_id = #{groupId}
            </if>
            <if test="productId != null ">and d.product_id = #{productId}</if>
            <if test="productName != null  and productName != ''">and d.product_name like concat('%', #{productName},
            <if test="userId != null and userId != 0">
                and u.user_id = #{userId}
            </if>
            <if test="tenantId != null and tenantId != 0">
                and d.tenant_id = #{tenantId}
            </if>
            <if test="deviceName != null  and deviceName != ''">
                and d.device_name like concat('%', #{deviceName}, '%')
            </if>
            <if test="productId != null ">
                and d.product_id = #{productId}
            </if>
            <if test="productName != null  and productName != ''">
                and d.product_name like concat('%', #{productName},
                '%')
            </if>
            <if test="userName != null  and userName != ''">and d.user_name like concat('%', #{userName}, '%')</if>
            <if test="tenantName != null  and tenantName != ''">and d.tenant_name like concat('%', #{tenantName}, '%')
            <if test="userName != null  and userName != ''">
                and d.user_name like concat('%', #{userName}, '%')
            </if>
            <if test="serialNumber != null  and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
            <if test="status != null ">and d.status = #{status}</if>
            <if test="tenantName != null  and tenantName != ''">
                and d.tenant_name like concat('%', #{tenantName}, '%')
            </if>
            <if test="serialNumber != null  and serialNumber != ''">
                and d.serial_number = #{serialNumber}
            </if>
            <if test="status != null ">
                and d.status = #{status}
            </if>
            <if test=" repairFlag != null">
                and d.repair_flag = #{repairFlag}
            </if>
            <if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''">
                and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}
            </if>
wumei-smart-master/vue/src/views/equipmentManagement/maintenance.vue
@@ -288,7 +288,7 @@
        // 获取设备列表
        getDeviceList() {
            let data = {
                // status: 1
                repairFlag: 0
            }
            request({
                url: '/iot/device/shortList',
@@ -402,7 +402,8 @@
                appointmentTime: this.form.appointmentTime,
                description: this.form.description,
                state: this.form.state,
                orderType: '2'
                orderType: '2',
                repairFlag:1,
            }
            if (this.form.receiveTime) {
                data.receiveTime = this.form.receiveTime