doum
3 天以前 3c7399c25c0f35c8aa7cb6af1935e31d1a3f0102
新增智能电表、空调管理
已添加1个文件
已修改12个文件
118 ■■■■ 文件已修改
admin/public/template/yw_device.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/business/OperaDeviceImportWindow.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/operation/components/deviceDetail.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/operation/components/deviceEdit.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/operation/device.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
h5/manifest.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
h5/pages/login.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
h5/utils/config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/db/business.yw_device.device_num.sql 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_admin/src/main/resources/bootstrap.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/admin/request/DeviceImport.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwDevice.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwDeviceServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/public/template/yw_device.xlsx
Binary files differ
admin/src/components/business/OperaDeviceImportWindow.vue
@@ -10,7 +10,7 @@
  >
    <p class="tip-warn"><i class="el-icon-warning"></i>导入说明:<br>
      1.请先下载文件模板,并按照模板要求填写表格内容;<br>
      2.带*为必填项,关联房源格式为:楼宇/楼层/房源;<br>
      2.带*为必填项(含*设备数量),关联房源格式为:楼宇/楼层/房源;<br>
      3.设备分类格式为:一级分类/二级分类;<br>
    </p>
    <el-form class="demo-form-inline">
admin/src/views/operation/components/deviceDetail.vue
@@ -23,6 +23,10 @@
            <div class="val">{{ info.name }}</div>
          </div>
          <div class="item">
            <div class="la">设备数量</div>
            <div class="val">{{ info.deviceNum || 1 }}</div>
          </div>
          <div class="item">
            <div class="la">设备型号</div>
            <div class="val">{{ info.modelNo }}</div>
          </div>
admin/src/views/operation/components/deviceEdit.vue
@@ -15,6 +15,11 @@
          </el-form-item>
        </div>
        <div style="width: 31%;">
          <el-form-item label="设备数量" prop="deviceNum">
            <el-input-number v-model="param.deviceNum" :min="1" :precision="0" controls-position="right" />
          </el-form-item>
        </div>
        <div style="width: 31%;">
          <el-form-item label="设备型号" prop="modelNo">
            <el-input v-model="param.modelNo" placeholder="请输入" v-trim />
          </el-form-item>
@@ -187,6 +192,7 @@
      param: {
        code: '',
        name: '',
        deviceNum: 1,
        modelNo: '',
        cateIds: '',
        userId: '',
@@ -310,7 +316,11 @@
        if (valid) {
          let fn = param.id ? updateById : create
          this.subLoading = true
          fn(param).then(res => {
          const payload = {
            ...param,
            deviceNum: !param.deviceNum || param.deviceNum < 1 ? 1 : param.deviceNum
          }
          fn(payload).then(res => {
            this.subLoading = false
            this.$emit('success')
            Message.success('保存成功')
@@ -324,6 +334,7 @@
    getDetail(id) {
      detailById(id).then(res => {
        this.param = res
        this.param.deviceNum = res.deviceNum || 1
        this.param.rooms = [res.projectId, res.buildingId, res.floorId, res.roomId]
        console.log(this.param.rooms)
        if (res.multifileList && res.multifileList.length > 0) {
admin/src/views/operation/device.vue
@@ -10,6 +10,7 @@
    <el-table v-loading="loading" :data="list" stripe>
      <el-table-column prop="code" label="设备编号" min-width="100" show-overflow-tooltip />
      <el-table-column prop="name" label="设备名称" min-width="100" show-overflow-tooltip />
      <el-table-column prop="deviceNum" label="设备数量" min-width="90" show-overflow-tooltip />
      <el-table-column prop="categoryName" label="设备分类" min-width="100" show-overflow-tooltip />
      <el-table-column prop="modelNo" label="设备型号" min-width="100" show-overflow-tooltip />
      <el-table-column prop="realName" label="管理员" min-width="100" show-overflow-tooltip />
h5/manifest.json
@@ -1,6 +1,6 @@
{
    "name" : "laborVisitors",
    "appid" : "__UNI__BCCF400",
    "name" : "阜宁运维系统",
    "appid" : "__UNI__E3BA820",
    "description" : "",
    "versionName" : "1.0.0",
    "versionCode" : "100",
@@ -86,7 +86,7 @@
    "quickapp" : {},
    /* å°ç¨‹åºç‰¹æœ‰ç›¸å…³ */
    "mp-weixin" : {
        "appid" : "wx4d7c10bdec51942b",
        "appid" : "wx15dfdae9a19177f3",
        "setting" : {
            "urlCheck" : false,
            "es6" : true,
h5/pages/login.vue
@@ -116,10 +116,10 @@
                    }
                })
            } else {
                // let url = 'https://zhcg.fnwtzx.com/yunwei_h5'
                let url = 'https://zhcg.fnwtzx.com/fn_h5'
                // const appID = 'wx95ac1efb67f0330d'
                let url = 'https://dmtest.ahapp.net/yunwei_h5'
                const appID = 'wx4d7c10bdec51942b'
                                //let url = 'https://dmtest.ahapp.net/yunwei_h5'
                const appID = 'wx15dfdae9a19177f3'
                let uri = encodeURIComponent(url)
                let authURL =
                    `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appID}&redirect_uri=${uri}&response_type=code&scope=snsapi_base#wechat_redirect`
h5/utils/config.js
@@ -1,6 +1,6 @@
 // export const baseUrl = 'gateway_interface/'
export const baseUrl = 'http://localhost:10010/gateway_interface/'
// export const baseUrl = 'https://zhcg.fnwtzx.com/gateway_interface/'
//export const baseUrl = 'http://localhost:10010/gateway_interface/'
export const baseUrl = 'https://zhcg.fnwtzx.com/gateway_interface/'
//export const baseUrl = 'https://dmtest.ahapp.net/gateway_interface/'
export const uploadAvatar = `${baseUrl}visitsAdmin/cloudService/web/public/uploadFtp.do`
server/db/business.yw_device.device_num.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
-- è¿ç»´è®¾å¤‡ï¼šè®¾å¤‡æ•°é‡
SET @db := DATABASE();
SET @sql := IF(
  (SELECT COUNT(*) FROM information_schema.COLUMNS
   WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'yw_device' AND COLUMN_NAME = 'device_num') = 0,
  'ALTER TABLE `yw_device` ADD COLUMN `device_num` int NOT NULL DEFAULT 1 COMMENT ''设备数量'' AFTER `name`',
  'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
server/visits/dmvisit_admin/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@
spring:
  profiles:
    active: dev
    active: pro
  application:
    name: visitsAdmin
    # å®‰å…¨é…ç½®
server/visits/dmvisit_service/src/main/java/com/doumee/dao/admin/request/DeviceImport.java
@@ -17,48 +17,51 @@
    @ExcelColumn(name = "*设备名称", value = "name", index = 1)
    private String name;
    @ExcelColumn(name = "*设备分类", value = "categoryPath", index = 2)
    @ExcelColumn(name = "*设备数量", value = "deviceNum", index = 2)
    private String deviceNum;
    @ExcelColumn(name = "*设备分类", value = "categoryPath", index = 3)
    private String categoryPath;
    @ExcelColumn(name = "设备型号", value = "modelNo", index = 3)
    @ExcelColumn(name = "设备型号", value = "modelNo", index = 4)
    private String modelNo;
    @ExcelColumn(name = "设备管理员", value = "adminUserName", index = 4)
    @ExcelColumn(name = "设备管理员", value = "adminUserName", index = 5)
    private String adminUserName;
    @ExcelColumn(name = "所在位置", value = "addr", index = 5)
    @ExcelColumn(name = "所在位置", value = "addr", index = 6)
    private String addr;
    @ExcelColumn(name = "*所属项目", value = "projectName", index = 6)
    @ExcelColumn(name = "*所属项目", value = "projectName", index = 7)
    private String projectName;
    @ExcelColumn(name = "*关联房源", value = "roomPath", index = 7)
    @ExcelColumn(name = "*关联房源", value = "roomPath", index = 8)
    private String roomPath;
    @ExcelColumn(name = "购入时间", value = "buyDate", index = 8)
    @ExcelColumn(name = "购入时间", value = "buyDate", index = 9)
    private String buyDate;
    @ExcelColumn(name = "设备状态", value = "statusText", index = 9)
    @ExcelColumn(name = "设备状态", value = "statusText", index = 10)
    private String statusText;
    @ExcelColumn(name = "运维内容", value = "content", index = 10)
    @ExcelColumn(name = "运维内容", value = "content", index = 11)
    private String content;
    @ExcelColumn(name = "设备供应商", value = "supplier", index = 11)
    @ExcelColumn(name = "设备供应商", value = "supplier", index = 12)
    private String supplier;
    @ExcelColumn(name = "供应商联系人", value = "supplierLinker", index = 12)
    @ExcelColumn(name = "供应商联系人", value = "supplierLinker", index = 13)
    private String supplierLinker;
    @ExcelColumn(name = "供应商联系方式", value = "supplierPhone", index = 13)
    @ExcelColumn(name = "供应商联系方式", value = "supplierPhone", index = 14)
    private String supplierPhone;
    @ExcelColumn(name = "维保负责人", value = "maintenanceUserName", index = 14)
    @ExcelColumn(name = "维保负责人", value = "maintenanceUserName", index = 15)
    private String maintenanceUserName;
    @ExcelColumn(name = "维保到期日", value = "maintenanceOverDate", index = 15)
    @ExcelColumn(name = "维保到期日", value = "maintenanceOverDate", index = 16)
    private String maintenanceOverDate;
    @ExcelColumn(name = "维保说明", value = "maintenanceContent", index = 16)
    @ExcelColumn(name = "维保说明", value = "maintenanceContent", index = 17)
    private String maintenanceContent;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwDevice.java
@@ -55,6 +55,10 @@
    @ExcelColumn(name="名称")
    private String name;
    @ApiModelProperty(value = "设备数量")
    @ExcelColumn(name = "设备数量")
    private Integer deviceNum;
    @ApiModelProperty(value = "备注")
    @ExcelColumn(name="备注")
    private String remark;
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwDeviceServiceImpl.java
@@ -99,6 +99,7 @@
        if(ywDeviceMapper.selectCount(new QueryWrapper<YwDevice>().lambda().eq(YwDevice::getIsdeleted,Constants.ZERO).eq(YwDevice::getCode,ywDevice.getCode()))>Constants.ZERO){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"设备编号重复!");
        }
        ywDevice.setDeviceNum(normalizeDeviceNum(ywDevice.getDeviceNum()));
        ywDevice.setCreateDate(new Date());
        ywDevice.setCreator(loginUserInfo.getId());
        ywDevice.setIsdeleted(Constants.ZERO);
@@ -187,6 +188,7 @@
                .ne(YwDevice::getId,ywDevice.getId()))>Constants.ZERO){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"设备编号重复!");
        }
        ywDevice.setDeviceNum(normalizeDeviceNum(ywDevice.getDeviceNum()));
        ywDevice.setEditDate(new Date());
        ywDevice.setEditor(loginUserInfo.getId());
        ywDeviceMapper.updateById(ywDevice);
@@ -504,6 +506,7 @@
    private boolean isImportBlankRow(DeviceImport row) {
        return StringUtils.isBlank(row.getCode())
                && StringUtils.isBlank(row.getName())
                && StringUtils.isBlank(row.getDeviceNum())
                && StringUtils.isBlank(row.getProjectName())
                && StringUtils.isBlank(row.getRoomPath());
    }
@@ -612,6 +615,7 @@
        if (StringUtils.isBlank(row.getName())) {
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,第" + rowNum + "行设备名称不能为空,请检查表格内容!");
        }
        Integer deviceNum = parseImportDeviceNum(row.getDeviceNum(), rowNum);
        if (StringUtils.isBlank(row.getProjectName())) {
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,第" + rowNum + "行所属项目不能为空,请检查表格内容!");
        }
@@ -668,6 +672,7 @@
        YwDevice device = new YwDevice();
        device.setCode(code);
        device.setName(row.getName().trim());
        device.setDeviceNum(deviceNum);
        device.setCateId(cateId);
        device.setModelNo(StringUtils.trimToNull(row.getModelNo()));
        device.setUserId(userId);
@@ -697,6 +702,32 @@
        return device;
    }
    private Integer normalizeDeviceNum(Integer deviceNum) {
        if (deviceNum == null || deviceNum <= 0) {
            return 1;
        }
        return deviceNum;
    }
    private Integer parseImportDeviceNum(String deviceNumText, int rowNum) {
        if (StringUtils.isBlank(deviceNumText)) {
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,第" + rowNum + "行设备数量不能为空,请检查表格内容!");
        }
        String text = deviceNumText.trim();
        if (StringUtils.endsWith(text, ".0")) {
            text = StringUtils.substringBefore(text, ".0");
        }
        try {
            double value = Double.parseDouble(text);
            if (value <= 0 || value != Math.floor(value)) {
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,第" + rowNum + "行设备数量必须为正整数,请检查表格内容!");
            }
            return (int) value;
        } catch (NumberFormatException e) {
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,第" + rowNum + "行设备数量必须为正整数,请检查表格内容!");
        }
    }
    private Integer resolveInternalUserId(String userName, int rowNum, String fieldLabel, DeviceImportCache cache) {
        if (StringUtils.isBlank(userName)) {
            return null;