ソースを参照

住建-钢瓶

hanfucheng 1 年間 前
コミット
a5dc619818

+ 35 - 2
data-ui/src/views/data/housingconstruction/inspect/index.vue

@@ -158,6 +158,10 @@
                       :noResultsText="'空'" :noOptionsText="'空'"
                       placeholder="请选择部门" @select="hx"/>
         </el-form-item>
+        <el-form-item label="附件" prop="fileUrl">
+          <fileUpload :value="[form.fileUrl,form.fileName]" v-model="form.fileUrl" :setFileName="setFileName"
+                      :removeFileName="removeFileName" :limit="1"></fileUpload>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -173,10 +177,11 @@ import {treeselect} from "@/api/system/dept";
 import Treeselect from "@riophae/vue-treeselect";
 import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 import {format_date} from "@/views/data/common/dateExport";
+import fileUpload from '@/views/components/FileUpload/index.vue'
 
 export default {
   name: "Inspect",
-  components: {Treeselect},
+  components: {Treeselect,fileUpload},
   data() {
     return {
       deptOptions: undefined,
@@ -194,6 +199,7 @@ export default {
       total: 0,
       // 钢瓶年检表格数据
       inspectList: [],
+      fileNames: [],
       steelcylinderList:[],
       // 弹出层标题
       title: "",
@@ -215,7 +221,12 @@ export default {
         nextInspectTime: null
       },
       // 表单参数
-      form: {},
+      form: {
+        fileUrl: '',
+        fileName: '',
+        //fileUrlList: [],
+        //fileNameList: []
+      },
       // 表单校验
       rules: {
         steelcylinderId: [
@@ -236,6 +247,17 @@ export default {
     this.getSteelcylinderList();
   },
   methods: {
+    setFileName(fileName) {
+      let that = this
+      that.fileNames.push(fileName)
+    },
+    removeFileName(index) {
+      let that = this
+      that.fileNames.splice(index, 1);
+      let fileurls = that.form.fileUrl.split(",")
+      fileurls.splice(index, 1)
+      that.form.fileUrl = fileurls.toString()
+    },
     //钢瓶列表
     getSteelcylinderList() {
       getSteelcylinderList().then(response => {
@@ -287,6 +309,7 @@ export default {
         address: null,
         nextInspectTime: null
       };
+      this.fileNames = []
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
@@ -317,6 +340,13 @@ export default {
       this.reset();
       const id = row.id || this.ids
       getInspect(id).then(response => {
+        if (response.data.fileUrl !== ""&& response.data.fileUrl!=null) {
+          const list = response.data.fileUrl.split(',');
+          for (var a = 0; a < list.length; a++) {
+            let listurl = list[a].split('+')
+            this.fileNames.push(listurl[1])
+          }
+        }
         this.form = response.data;
         this.open = true;
         this.title = "修改钢瓶年检";
@@ -329,6 +359,9 @@ export default {
           this.form.steelcylinderName = this.steelcylinderList.filter((item) => {
             return this.form.steelcylinderId == item.id;
           })[0].name;
+          this.form.fileName = this.fileNames.toString()
+          //this.form.fileUrlList = Array.from(document.querySelectorAll('.el-upload-list__item')).map(item => item.querySelector('a').getAttribute('href'))
+          //this.form.fileNameList = this.fileNames;
           if (this.form.id != null) {
             updateInspect(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");

+ 24 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionInspect.java

@@ -1,9 +1,11 @@
 package com.sooka.sponest.data.housingconstruction.domain;
 
 import java.util.Date;
+import java.util.List;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.sooka.sponest.data.base.domain.BaseBusinessEntity;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.core.annotation.Excel;
@@ -71,6 +73,28 @@ public class CenterdataTHousingconstructionInspect extends BaseBusinessEntity {
     @Excel(name = "下次年检时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date nextInspectTime;
 
+    @ApiModelProperty(value = "文件路径", required = false)
+    private String fileUrl;
+
+    @ApiModelProperty(value = "文件名称", required = false)
+    private String fileName;
+
+    public String getFileUrl() {
+        return fileUrl;
+    }
+
+    public void setFileUrl(String fileUrl) {
+        this.fileUrl = fileUrl;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
     public void setId(String id) {
         this.id = id;
     }

+ 1 - 2
src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionAttachServiceImpl.java

@@ -127,11 +127,10 @@ public class CenterdataTHousingconstructionAttachServiceImpl implements ICenterd
     @Override
     public String getAttachPathToStr(String busId) {
         List<CenterdataTHousingconstructionAttach> attachPathToEntityArray = getAttachPathToEntityArray(busId);
-        String fileUrl = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey("fileUrl").getData();
         StringBuilder result = new StringBuilder();
         if (!attachPathToEntityArray.isEmpty()) {
             attachPathToEntityArray.forEach(attach -> {
-                result.append(fileUrl).append(attach.getAttachPath()).append(",");
+                result.append(attach.getAttachPath()).append(",");
             });
         }
 

+ 21 - 1
src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionInspectServiceImpl.java

@@ -1,14 +1,20 @@
 package com.sooka.sponest.data.housingconstruction.service.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.sooka.sponest.data.base.service.impl.BaseServiceImpl;
 import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionInspect;
+import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionPractitioner;
 import com.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionInspectMapper;
+import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionAttachService;
 import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionInspectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -24,6 +30,9 @@ public class CenterdataTHousingconstructionInspectServiceImpl extends BaseServic
     @Autowired
     private CenterdataTHousingconstructionInspectMapper centerdataTHousingconstructionInspectMapper;
 
+    @Autowired
+    private ICenterdataTHousingconstructionAttachService attachService;
+
     /**
      * 查询钢瓶年检
      *
@@ -32,7 +41,9 @@ public class CenterdataTHousingconstructionInspectServiceImpl extends BaseServic
      */
     @Override
     public CenterdataTHousingconstructionInspect selectCenterdataTHousingconstructionInspectById(String id) {
-        return centerdataTHousingconstructionInspectMapper.selectCenterdataTHousingconstructionInspectById(id);
+        CenterdataTHousingconstructionInspect inspect = centerdataTHousingconstructionInspectMapper.selectCenterdataTHousingconstructionInspectById(id);
+        inspect.setFileUrl(attachService.replasePathToFile(id,"file"));
+        return inspect;
     }
 
     /**
@@ -60,6 +71,7 @@ public class CenterdataTHousingconstructionInspectServiceImpl extends BaseServic
         centerdataTHousingconstructionInspect.setCreateBy(SecurityUtils.getUserId().toString());
         centerdataTHousingconstructionInspect.setCreateName(SecurityUtils.getLoginUser().getSysUser().getNickName());
         centerdataTHousingconstructionInspect.setCreateTime(DateUtils.getNowDate());
+        extracted(centerdataTHousingconstructionInspect);
         return centerdataTHousingconstructionInspectMapper.insertCenterdataTHousingconstructionInspect(centerdataTHousingconstructionInspect);
     }
 
@@ -74,9 +86,17 @@ public class CenterdataTHousingconstructionInspectServiceImpl extends BaseServic
         centerdataTHousingconstructionInspect.setUpdateBy(SecurityUtils.getUserId());
         centerdataTHousingconstructionInspect.setUpdateName(SecurityUtils.getLoginUser().getSysUser().getNickName());
         centerdataTHousingconstructionInspect.setUpdateTime(DateUtils.getNowDate());
+        extracted(centerdataTHousingconstructionInspect);
         return centerdataTHousingconstructionInspectMapper.updateCenterdataTHousingconstructionInspect(centerdataTHousingconstructionInspect);
     }
 
+    private void extracted(CenterdataTHousingconstructionInspect inspect) {
+        attachService.delAttachByBusId(inspect.getId());
+        if (StringUtils.isNotEmpty(inspect.getFileUrl())) {
+            attachService.addAttach(inspect.getFileUrl(), inspect.getId(),"file",null,inspect.getFileName());
+        }
+    }
+
     /**
      * 批量删除钢瓶年检
      *

+ 2 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionViewServiceImpl.java

@@ -238,6 +238,7 @@ public class CenterdataTHousingconstructionViewServiceImpl extends BaseServiceIm
                 setSookaDataBase(realnameuser);
                 realnameuser.setEnterpriseId(storagetank.getEnterpriseId());
                 mapList = centerdataTHousingconstructionRealnameuserMapper.getRealnameuserList(realnameuser);
+                break;
             case "3":
                 //车辆
                // mapList = centerdataTHousingconstructionViewMapper.getResourcePoint(storagetank);
@@ -247,6 +248,7 @@ public class CenterdataTHousingconstructionViewServiceImpl extends BaseServiceIm
                 setSookaDataBase(enterprise);
                 enterprise.setId(storagetank.getEnterpriseId());
                 mapList = centerdataTHousingconstructionEnterpriseMapper.getEnterpriseList(enterprise);
+                break;
             case "5":
                 //配送员
              //   mapList = centerdataTHousingconstructionViewMapper.getResourcePoint(storagetank);

+ 1 - 1
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionEnterpriseMapper.xml

@@ -161,7 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             latitude
         FROM
             centerdata_t_housingconstruction_enterprise a
-                LEFT JOIN onest_system.sys_dept d ON a.dept_id = d.dept_id
+                LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
      <where>
          <if test="id != null  and id != ''"> and a.id = #{id}</if>
          ${params.dataScope}

+ 14 - 11
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionRealnameuserMapper.xml

@@ -125,19 +125,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="getRealnameuserList" parameterType="CenterdataTHousingconstructionRealnameuser" resultType="map">
         SELECT
-            enterprise_user_type enterpriseUserType,
-            user_code userCode,
-            user_name userName,
-            gas_address gasAddress,
-            license_code licenseCode,
-            contact_number contactNumber,
-            account_open_time accountOpenTime,
-            longitude,
-            latitude
+        enterprise_user_type enterpriseUserType,
+        b.dict_label enterpriseUserTypeLabel,
+        user_code userCode,
+        user_name userName,
+        gas_address gasAddress,
+        license_code licenseCode,
+        contact_number contactNumber,
+        account_open_time accountOpenTime,
+        longitude,
+        latitude
         FROM
-            centerdata_t_housingconstruction_realnameuser a
-            LEFT JOIN onest_system.sys_dept d ON a.dept_id = d.dept_id
+        centerdata_t_housingconstruction_realnameuser a
+        left join ${database_system}.sys_dict_data b on a.enterprise_user_type = b.dict_value
+        LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
         <where>
+            b.dict_type = 'enterprise_user_type'
             <if test="enterpriseId != null  and enterpriseId != ''"> and enterprise_id = #{enterpriseId}</if>
         </where>
     </select>

+ 6 - 1
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionViewMapper.xml

@@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT
             a.dict_label type,
             IFNULL(b.num,0) num
-        from onest_system.sys_dict_data a
+        from ${database_system}.sys_dict_data a
         left join (
         SELECT
             a.standards,
@@ -320,6 +320,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT
             a.`name`,
             a.steelcylinder_number steelcylinderNumber,
+            z.dict_label standardsLabel,
+            a.enterprise_name enterpriseName,
             c.gas_address gasAddress,
             c.longitude,
             c.latitude,
@@ -328,6 +330,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             centerdata_t_housingconstruction_steelcylinder a
             LEFT JOIN centerdata_t_housingconstruction_steelcylinder_log b ON a.id = b.steelcylinder_id AND recycling_time IS NULL
             LEFT JOIN centerdata_t_housingconstruction_realnameuser c ON b.join_house_id = c.id
+            left join ${database_system}.sys_dict_data z on a.standards = z.dict_value
             left join (SELECT
                         a.steelcylinder_id,
                         GROUP_CONCAT(b.gas_address ORDER BY a.sign_time desc SEPARATOR '@_@') address
@@ -335,8 +338,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                         centerdata_t_housingconstruction_steelcylinder_log a
                         LEFT JOIN centerdata_t_housingconstruction_realnameuser b ON a.join_house_id = b.id
                         GROUP BY a.steelcylinder_id) d on a.id = d.steelcylinder_id
+            left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
         WHERE
             a.state = 'state_4'
+            and z.dict_type = 'steelcylinder_type'
             <if test="enterpriseId != null  and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
             ${params.dataScope}
         GROUP BY a.id