فهرست منبع

完善一期用户

JX.Li 7 ماه پیش
والد
کامیت
4e2fef462a
30فایلهای تغییر یافته به همراه3408 افزوده شده و 0 حذف شده
  1. 290 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/controller/YqGAreaController.java
  2. 107 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/controller/YqGBuildingController.java
  3. 107 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/controller/YqGHouseController.java
  4. 107 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/controller/YqGUnitController.java
  5. 27 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GAreaExportVo.java
  6. 33 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GCensusVo.java
  7. 27 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GDownloadVo.java
  8. 33 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GExportVo.java
  9. 40 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GExportsVo.java
  10. 32 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GImportVo.java
  11. 82 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/YqGArea.java
  12. 55 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/YqGBuilding.java
  13. 64 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/YqGHouse.java
  14. 59 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/YqGUnit.java
  15. 54 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/mapper/YqGAreaMapper.java
  16. 26 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/mapper/YqGBuildingMapper.java
  17. 27 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/mapper/YqGHouseMapper.java
  18. 29 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/mapper/YqGUnitMapper.java
  19. 97 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/IYqGAreaService.java
  20. 58 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/IYqGBuildingService.java
  21. 61 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/IYqGHouseService.java
  22. 61 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/IYqGUnitService.java
  23. 974 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/impl/YqGAreaServiceImpl.java
  24. 158 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/impl/YqGBuildingServiceImpl.java
  25. 164 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/impl/YqGHouseServiceImpl.java
  26. 162 0
      ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/impl/YqGUnitServiceImpl.java
  27. 237 0
      ruoyi-yiqi/src/main/resources/mapper/YqGAreaMapper.xml
  28. 60 0
      ruoyi-yiqi/src/main/resources/mapper/YqGBuildingMapper.xml
  29. 101 0
      ruoyi-yiqi/src/main/resources/mapper/YqGHouseMapper.xml
  30. 76 0
      ruoyi-yiqi/src/main/resources/mapper/YqGUnitMapper.xml

+ 290 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/controller/YqGAreaController.java

@@ -0,0 +1,290 @@
+package com.ruoyi.yiqi.controller;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.convert.ExcelBigNumberConvert;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.validate.AddGroup;
+import com.ruoyi.common.core.validate.EditGroup;
+import com.ruoyi.common.core.validate.QueryGroup;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.file.FileUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.obs.ObsService;
+import com.ruoyi.yiqi.entity.*;
+import com.ruoyi.yiqi.service.IYqGAreaService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * 小区Controller
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Validated
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/yq/gas/area")
+public class YqGAreaController extends BaseController {
+
+    private final IYqGAreaService iGAreaService;
+
+    private final ObsService obsService;
+
+    private String bfb="0";
+    private String message;
+
+    /**
+     * 查询小区列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo<YqGArea> list(@Validated(QueryGroup.class) YqGArea bo) {
+        return iGAreaService.queryPageList(bo);
+    }
+
+    /**
+     * 导出小区列表
+     */
+    @Log(title = "小区", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public void export(@Validated YqGArea bo, HttpServletResponse response) {
+        List<GExportVo> list = iGAreaService.getExportList();
+        ExcelUtil.exportExcel(list, "小区", GExportVo.class, response);
+    }
+    /**
+     * 导出小区列表
+     */
+    @Log(title = "小区", businessType = BusinessType.EXPORT)
+    @GetMapping("/exports")
+    public void exports(@Validated YqGArea bo, HttpServletResponse response) {
+        String filename = "";
+        filename = iGAreaService.getDictNameOfAffiliatedPackage(bo);
+        List<GExportsVo> list = iGAreaService.getExport(bo);
+        try {
+            response.reset();
+            FileUtils.setAttachmentResponseHeader(response, filename+ ".xlsx");
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
+            ServletOutputStream os = response.getOutputStream();
+            EasyExcel.write(os, GExportsVo.class)
+                    .autoCloseStream(false)
+                    // 自动适配
+                    .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    // 大数值自动转换 防止失真
+                    .registerConverter(new ExcelBigNumberConvert())
+                    .sheet(filename).doWrite(list);
+        } catch (IOException e) {
+            throw new RuntimeException("导出Excel异常");
+        }
+
+    }
+    @PostMapping("/importData")
+    public synchronized R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
+        List<GImportVo> listVo = ExcelUtil.importExcel(file.getInputStream(), GImportVo.class);
+        List<GImportVo> list = BeanUtil.copyToList(listVo, GImportVo.class);
+        String operName = getUsername();
+        if(Double.valueOf(bfb)<=0){
+            forImportData(list,true,operName,0,0);
+        }
+        return R.ok(message);
+    }
+
+    public void forImportData(List<GImportVo> list, Boolean isUpdateSupport, String operName,int n,int okNum) throws Exception
+    {
+        try{
+            Map<String,Object> ret = iGAreaService.importUser(list, isUpdateSupport, operName,n,okNum);//list, updateSupport, operName,第几条
+            if(Boolean.valueOf(ret.get("is_ok").toString())){
+                bfb = ret.get("bfb").toString();
+                forImportData(list,isUpdateSupport,operName,Integer.valueOf(ret.get("n").toString()),Integer.valueOf(ret.get("okNum").toString()));
+            }else{
+                message = ret.get("okMsg").toString();
+            }
+        } catch (Exception e) {
+            message = e.getMessage();
+        }
+    }
+
+    /**
+     * 进度条刷新,
+     */
+    @GetMapping(value = "/flushProgress")
+    public R<Map> flushProgress() throws Exception
+    {
+        Map<String,String> ret = new HashMap<>();
+        ret.put("bfb",bfb);
+        ret.put("message",message);
+        return R.ok(ret);
+    }
+
+    /**
+     * 结束进度条刷新,
+     */
+    @GetMapping(value = "/clearFlushProgress")
+    public R<Void> clearFlushProgress() throws Exception
+    {
+        bfb="0";
+        message="";
+        return R.ok();
+    }
+
+
+    @PostMapping("/importApprovalExcel")
+    public R<Void> importApprovalExcel(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
+        List<GImportVo> listVo = ExcelUtil.importExcel(file.getInputStream(), GImportVo.class);
+        List<GImportVo> list = BeanUtil.copyToList(listVo, GImportVo.class);
+        String operName = getUsername();
+        String message = iGAreaService.importApprovalExcel(list, updateSupport, operName);
+        return R.ok(message);
+    }
+    @PostMapping("/importDataA")
+    public R<Void> importDataA(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
+        List<GImportVo> listVo = ExcelUtil.importExcel(file.getInputStream(), GImportVo.class);
+        List<GImportVo> list = BeanUtil.copyToList(listVo, GImportVo.class);
+        String operName = getUsername();
+        String message = iGAreaService.importUserA(list, updateSupport, operName);
+        return R.ok(message);
+    }
+    @GetMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response) {
+        ExcelUtil.exportExcel(new ArrayList<>(), "小区", GImportVo.class, response);
+    }
+    /**
+     * 获取小区详细信息
+     */
+    @GetMapping("/{id}")
+    public R<YqGArea> getInfo(@NotNull(message = "主键不能为空")
+                                                  @PathVariable("id") Long id) {
+        return R.ok(iGAreaService.queryById(id));
+    }
+
+    /**
+     * 新增小区
+     */
+    @Log(title = "小区", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Boolean> add(@Validated(AddGroup.class) @RequestBody YqGArea bo) {
+        return R.ok(iGAreaService.insertByBo(bo));
+//        return toAjax(iGAreaService.insertByBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改小区
+     */
+    @Log(title = "小区", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody YqGArea bo) {
+        return toAjax(iGAreaService.updateByBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 删除小区
+     */
+    @Log(title = "小区" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                                       @PathVariable Long[] ids) {
+        return toAjax(iGAreaService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
+    }
+
+    /**
+     * 小区列表查询
+     * @param bo
+     * @return
+     */
+    @GetMapping("/getList")
+    public TableDataInfo<YqGArea> getList(@Validated(QueryGroup.class) YqGArea bo) {
+        return iGAreaService.getList(bo);
+    }
+
+    /**
+     * 小区下拉
+     * @return
+     */
+    @GetMapping("/getArea")
+    public R getArea() {
+        return R.ok(iGAreaService.getArea());
+    }
+
+    /**
+     *合格/不合格统计-小区
+     * @param areaId
+     * @return
+     */
+    @GetMapping("/getExamineArea")
+    public R getExamineArea(Long areaId) {
+        return R.ok(iGAreaService.getExamineArea(areaId));
+    }
+
+    /**
+     * 服务统计-针对小区
+     * @param id
+     * @return
+     */
+    @GetMapping("/getExamineServe")
+    public R getExamineServe(Long id) {
+        return R.ok(iGAreaService.getExamineServe(id));
+    }
+
+    /**
+     * 批量下载生成文件夹打压缩包
+     */
+    @GetMapping("/upload")
+    @Log(title = "小区照片下载", businessType = BusinessType.EXPORT)
+    public void upload(HttpServletRequest request, HttpServletResponse response, @RequestParam Long id) throws Exception {
+        iGAreaService.upload(request, response, id);
+    }
+
+    /**
+     * 小区汇总统计
+     * @param areaId
+     * @return
+     */
+    @GetMapping("/getAreaSum")
+    public R getAreaSum(Long areaId) {
+        return R.ok(iGAreaService.getAreaSum(areaId));
+    }
+
+    @GetMapping("/releaseIs")
+    public R releaseIs(Long id) {
+        iGAreaService.releaseIs(id);
+        // 小区下所有照片
+        List<String> list = iGAreaService.getPhoto(id);
+        obsService.deleteFiles(list);
+        iGAreaService.deleteDirectory(iGAreaService.getById(id).getName());
+        return R.ok();
+    }
+
+    /**
+     *小区唯一校验
+     * @param name
+     * @return
+     */
+    @GetMapping("/getForName")
+    public R getForName(String name,String id) {
+        return R.ok(iGAreaService.getForName(name,id));
+    }
+
+    @GetMapping("/getExportHouse")
+    public void getExportHouse(Long areaId, HttpServletResponse response) {
+        List<GAreaExportVo> list = iGAreaService.getExportHouse(areaId);
+        ExcelUtil.exportExcel(list, "小区完工率", GAreaExportVo.class, response);
+    }
+}

+ 107 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/controller/YqGBuildingController.java

@@ -0,0 +1,107 @@
+package com.ruoyi.yiqi.controller;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.validate.AddGroup;
+import com.ruoyi.common.core.validate.EditGroup;
+import com.ruoyi.common.core.validate.QueryGroup;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.yiqi.entity.YqGBuilding;
+import com.ruoyi.yiqi.service.IYqGBuildingService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 楼宇Controller
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Validated
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/yq/gas/building")
+public class YqGBuildingController extends BaseController {
+
+    private final IYqGBuildingService iGBuildingService;
+
+    /**
+     * 查询楼宇列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo<YqGBuilding> list(@Validated(QueryGroup.class) YqGBuilding bo) {
+        return iGBuildingService.queryPageList(bo);
+    }
+
+    /**
+     * 导出楼宇列表
+     */
+    @Log(title = "楼宇", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public void export(@Validated YqGBuilding bo, HttpServletResponse response) {
+        List<YqGBuilding> list = iGBuildingService.queryList(bo);
+        ExcelUtil.exportExcel(list, "楼宇", YqGBuilding.class, response);
+    }
+
+    /**
+     * 获取楼宇详细信息
+     */
+    @GetMapping("/{id}")
+    public R<YqGBuilding> getInfo(@NotNull(message = "主键不能为空")
+                                                  @PathVariable("id") Long id) {
+        return R.ok(iGBuildingService.queryById(id));
+    }
+
+    /**
+     * 新增楼宇
+     */
+    @Log(title = "楼宇", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Boolean> add(@Validated(AddGroup.class) @RequestBody YqGBuilding bo) {
+        return R.ok(iGBuildingService.insertByBo(bo));
+//        return toAjax(iGBuildingService.insertByBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改楼宇
+     */
+    @Log(title = "楼宇", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody YqGBuilding bo) {
+        return toAjax(iGBuildingService.updateByBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 删除楼宇
+     */
+    @Log(title = "楼宇" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                                       @PathVariable Long[] ids) {
+        return toAjax(iGBuildingService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
+    }
+
+    @GetMapping("/getList")
+    public TableDataInfo<YqGBuilding> getList(@Validated(QueryGroup.class) YqGBuilding bo) {
+        return iGBuildingService.getList(bo);
+    }
+
+    @GetMapping("/getBuilding")
+    public R getBuilding(Long areaId) {
+        return R.ok(iGBuildingService.getBuilding(areaId));
+    }
+}

+ 107 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/controller/YqGHouseController.java

@@ -0,0 +1,107 @@
+package com.ruoyi.yiqi.controller;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.validate.AddGroup;
+import com.ruoyi.common.core.validate.EditGroup;
+import com.ruoyi.common.core.validate.QueryGroup;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.yiqi.entity.YqGHouse;
+import com.ruoyi.yiqi.service.IYqGHouseService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 房屋Controller
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Validated
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/yq/gas/house")
+public class YqGHouseController extends BaseController {
+
+    private final IYqGHouseService iGHouseService;
+
+    /**
+     * 查询房屋列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo<YqGHouse> list(@Validated(QueryGroup.class) YqGHouse bo) {
+        return iGHouseService.queryPageList(bo);
+    }
+
+    /**
+     * 导出房屋列表
+     */
+    @Log(title = "房屋", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public void export(@Validated YqGHouse bo, HttpServletResponse response) {
+        List<YqGHouse> list = iGHouseService.queryList(bo);
+        ExcelUtil.exportExcel(list, "房屋", YqGHouse.class, response);
+    }
+
+    /**
+     * 获取房屋详细信息
+     */
+    @GetMapping("/{id}")
+    public R<YqGHouse> getInfo(@NotNull(message = "主键不能为空")
+                                                  @PathVariable("id") Long id) {
+        return R.ok(iGHouseService.getById(id));
+    }
+
+    /**
+     * 新增房屋
+     */
+    @Log(title = "房屋", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Boolean> add(@Validated(AddGroup.class) @RequestBody YqGHouse bo) {
+        return R.ok(iGHouseService.insertByBo(bo));
+//        return toAjax(iGHouseService.insertByBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改房屋
+     */
+    @Log(title = "房屋", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody YqGHouse bo) {
+        return toAjax(iGHouseService.updateByBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 删除房屋
+     */
+    @Log(title = "房屋" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                                       @PathVariable Long[] ids) {
+        return toAjax(iGHouseService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
+    }
+
+    @GetMapping("/getList")
+    public TableDataInfo<YqGHouse> getList(@Validated(QueryGroup.class) YqGHouse bo) {
+        return iGHouseService.getList(bo);
+    }
+
+    @GetMapping("/getHouse")
+    public R getHouse(Long unitId) {
+        return R.ok(iGHouseService.getHouse(unitId));
+    }
+}

+ 107 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/controller/YqGUnitController.java

@@ -0,0 +1,107 @@
+package com.ruoyi.yiqi.controller;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.validate.AddGroup;
+import com.ruoyi.common.core.validate.EditGroup;
+import com.ruoyi.common.core.validate.QueryGroup;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.yiqi.entity.YqGUnit;
+import com.ruoyi.yiqi.service.IYqGUnitService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 单元Controller
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Validated
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/yq/gas/unit")
+public class YqGUnitController extends BaseController {
+
+    private final IYqGUnitService iGUnitService;
+
+    /**
+     * 查询单元列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo<YqGUnit> list(@Validated(QueryGroup.class) YqGUnit bo) {
+        return iGUnitService.queryPageList(bo);
+    }
+
+    /**
+     * 导出单元列表
+     */
+    @Log(title = "单元", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public void export(@Validated YqGUnit bo, HttpServletResponse response) {
+        List<YqGUnit> list = iGUnitService.queryList(bo);
+        ExcelUtil.exportExcel(list, "单元", YqGUnit.class, response);
+    }
+
+    /**
+     * 获取单元详细信息
+     */
+    @GetMapping("/{id}")
+    public R<YqGUnit> getInfo(@NotNull(message = "主键不能为空")
+                                                  @PathVariable("id") Long id) {
+        return R.ok(iGUnitService.getById(id));
+    }
+
+    /**
+     * 新增单元
+     */
+    @Log(title = "单元", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Boolean> add(@Validated(AddGroup.class) @RequestBody YqGUnit bo) {
+        return R.ok(iGUnitService.insertByBo(bo));
+//        return toAjax(iGUnitService.insertByBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改单元
+     */
+    @Log(title = "单元", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody YqGUnit bo) {
+        return toAjax(iGUnitService.updateByBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 删除单元
+     */
+    @Log(title = "单元" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                                       @PathVariable Long[] ids) {
+        return toAjax(iGUnitService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
+    }
+
+    @GetMapping("/getList")
+    public TableDataInfo<YqGUnit> getList(@Validated(QueryGroup.class) YqGUnit bo) {
+        return iGUnitService.getList(bo);
+    }
+
+    @GetMapping("/getUnit")
+    public R getUnit(Long buildingId) {
+        return R.ok(iGUnitService.getUnit(buildingId));
+    }
+}

+ 27 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GAreaExportVo.java

@@ -0,0 +1,27 @@
+package com.ruoyi.yiqi.entity;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+
+/**
+ * 小区视图对象 g_area
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class GAreaExportVo {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+
+	@ExcelProperty(value = "房屋")
+	private String houseName;
+	@ExcelProperty(value = "是否完工")
+	private String status;
+
+}

+ 33 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GCensusVo.java

@@ -0,0 +1,33 @@
+package com.ruoyi.yiqi.entity;
+
+
+/**
+ * 统计图
+ *
+ * @author ruoyi
+ * @date 2021-11-12
+ */
+
+public class GCensusVo {
+
+
+
+	private int value;
+	private String name;
+
+	public int getValue() {
+		return value;
+	}
+
+	public void setValue(int value) {
+		this.value = value;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+}

+ 27 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GDownloadVo.java

@@ -0,0 +1,27 @@
+package com.ruoyi.yiqi.entity;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import lombok.Data;
+
+
+/**
+ * 工程管理视图对象 g_order
+ *
+ * @author ruoyi
+ * @date 2021-11-16
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class GDownloadVo {
+
+	private static final long serialVersionUID = 1L;
+
+	private String picUrl;
+
+	private String house;
+	private String unit;
+	private String building;
+	private String area;
+
+
+}

+ 33 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GExportVo.java

@@ -0,0 +1,33 @@
+package com.ruoyi.yiqi.entity;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+
+/**
+ * 小区视图对象 g_area
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class GExportVo {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+
+	@ExcelProperty(value = "小区")
+	private String areaName;
+	@ExcelProperty(value = "楼宇")
+	private String buildName;
+	@ExcelProperty(value = "单元")
+	private String unitName;
+	@ExcelProperty(value = "房屋")
+	private String houseName;
+
+
+
+}

+ 40 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GExportsVo.java

@@ -0,0 +1,40 @@
+package com.ruoyi.yiqi.entity;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.ruoyi.common.annotation.ExcelDictFormat;
+import com.ruoyi.common.convert.ExcelDictConvert;
+import lombok.Data;
+
+
+/**
+ * 小区视图对象 g_area
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class GExportsVo {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+
+	@ExcelProperty(value = "小区")
+	private String areaName;
+	@ExcelProperty(value = "行政区", converter = ExcelDictConvert.class)
+	@ExcelDictFormat(dictType = "district")
+	private String district;
+	@ExcelProperty(value = "核算行政区", converter = ExcelDictConvert.class)
+	@ExcelDictFormat(dictType = "district")
+	private String calculateDistrictName;
+	@ExcelProperty(value = "小区规模")
+	private String areaSize;
+	@ExcelProperty(value = "实际规模")
+	private String count;
+	@ExcelProperty(value = "所属包", converter = ExcelDictConvert.class)
+	@ExcelDictFormat(dictType = "affiliated_package")
+	private String affiliatedPackage;
+
+}

+ 32 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/GImportVo.java

@@ -0,0 +1,32 @@
+package com.ruoyi.yiqi.entity;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 导入VO
+ *
+ * @author Lion Li
+ */
+
+@Data
+@NoArgsConstructor
+// @Accessors(chain = true) // 导入不允许使用 会找不到set方法
+public class GImportVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ExcelProperty(value = "行政区")
+    private String district;
+    @ExcelProperty(value = "小区")
+    private String areaName;
+    @ExcelProperty(value = "楼宇")
+    private String buildName;
+    @ExcelProperty(value = "单元")
+    private String unitName;
+    @ExcelProperty(value = "房屋")
+    private String houseName;
+
+}

+ 82 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/YqGArea.java

@@ -0,0 +1,82 @@
+package com.ruoyi.yiqi.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 小区对象 g_area
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Data
+@TableName("yq_g_area")
+public class YqGArea extends BaseEntity {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id")
+    private Long id;
+    /**
+     * 小区名
+     */
+    private String name;
+    /**
+     * 负责工长
+     */
+    private Long userId;
+    /**
+     * 删除标志
+     */
+    @TableLogic
+    private String delFlag;
+    /**
+     *是否释放
+     */
+    private String releaseIs;
+    /**
+     * 释放人
+     */
+    private String releaseBy;
+    /**
+     * 行政区
+     */
+    private String district;
+    /**
+     * 核算行政区
+     */
+    private String calculateDistrictId;
+    /**
+     /**
+     * 核算行政区
+     */
+    private String calculateDistrictName;
+    /**
+     * 小区规模
+     */
+    private Double areaSize;
+    /**
+     * 所属包
+     */
+    private String affiliatedPackage;
+    /**
+     * 分页大小
+     */
+    @TableField(exist = false)
+    private Integer pageSize;
+    @TableField(exist = false)
+    private String rate;
+    /**
+     * 当前页数
+     */
+    @TableField(exist = false)
+    private Integer pageNum;
+}

+ 55 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/YqGBuilding.java

@@ -0,0 +1,55 @@
+package com.ruoyi.yiqi.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 楼宇对象 g_building
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Data
+@TableName("yq_g_building")
+public class YqGBuilding extends BaseEntity {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id")
+    private Long id;
+    /**
+     * 楼宇名
+     */
+    private String name;
+    /**
+     * 小区id
+     */
+    private Long areaId;
+    /**
+     * 删除标志
+     */
+    @TableLogic
+    private String delFlag;
+
+    /**
+     * 分页大小
+     */
+    @TableField(exist = false)
+    private Integer pageSize;
+
+    /**
+     * 当前页数
+     */
+    @TableField(exist = false)
+    private Integer pageNum;
+    @TableField(exist = false)
+    private String areaName;
+}

+ 64 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/YqGHouse.java

@@ -0,0 +1,64 @@
+package com.ruoyi.yiqi.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 房屋对象 g_house
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Data
+@TableName("yq_g_house")
+public class YqGHouse extends BaseEntity {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id")
+    private Long id;
+    /**
+     * 房屋名
+     */
+    private String name;
+    /**
+     * 单元id
+     */
+    private Long unitId;
+    @TableField(exist = false)
+    private Long buildingId;
+    @TableField(exist = false)
+    private Long areaId;
+
+    @TableField(exist = false)
+    private String unitName;
+    @TableField(exist = false)
+    private String buildingName;
+    @TableField(exist = false)
+    private String areaName;
+    /**
+     * 删除标志
+     */
+    @TableLogic
+    private String delFlag;
+
+    /**
+     * 分页大小
+     */
+    @TableField(exist = false)
+    private Integer pageSize;
+
+    /**
+     * 当前页数
+     */
+    @TableField(exist = false)
+    private Integer pageNum;
+}

+ 59 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/entity/YqGUnit.java

@@ -0,0 +1,59 @@
+package com.ruoyi.yiqi.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 单元对象 g_unit
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Data
+@TableName("yq_g_unit")
+public class YqGUnit extends BaseEntity {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id")
+    private Long id;
+    /**
+     * 单元名
+     */
+    private String name;
+    /**
+     * 楼宇id
+     */
+    private Long buildingId;
+    @TableField(exist = false)
+    private Long areaId;
+    @TableField(exist = false)
+    private String buildingName;
+    @TableField(exist = false)
+    private String areaName;
+    /**
+     * 删除标志
+     */
+    @TableLogic
+    private String delFlag;
+
+    /**
+     * 分页大小
+     */
+    @TableField(exist = false)
+    private Integer pageSize;
+
+    /**
+     * 当前页数
+     */
+    @TableField(exist = false)
+    private Integer pageNum;
+}

+ 54 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/mapper/YqGAreaMapper.java

@@ -0,0 +1,54 @@
+package com.ruoyi.yiqi.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.mapper.BaseMapperPlus;
+import com.ruoyi.yiqi.entity.*;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 小区Mapper接口
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+public interface YqGAreaMapper extends BaseMapperPlus<YqGAreaMapper, YqGArea, YqGArea> {
+
+    Page<YqGArea> getList(@Param("p") YqGArea bo, Page<?> page);
+
+    //小区下拉
+    List<YqGArea> getArea();
+
+    //小区户数
+    int getHouse(Long id);
+
+    //合格/不合格统计-小区
+    List<GCensusVo> getExamineArea(Long areaId);
+//小区服务统计
+    List<GCensusVo> getExamineServe(Long id);
+
+    List<GExportVo> getExportList();
+    List<GExportsVo> getExport(YqGArea bo);
+    String getDictNameOfAffiliatedPackage(YqGArea bo);
+
+    //导入 查询是否已存在
+    YqGArea getByName(String name);
+
+    List<GCensusVo> getConform(Long areaId);
+
+    int getInConform(Long areaId);
+
+    int getHouseCount(Long areaId);
+
+    YqGArea getForName(@Param("name") String name, @Param("id") String id);
+
+    List<String> getPhoto(Long id);
+
+    //导出小区完成率
+    List<GAreaExportVo> getAllHouse(Long areaId);
+    List<GAreaExportVo> getOrderHouse(Long areaId);
+
+    Long checkDataList(@Param("p") YqGArea bo);
+
+}

+ 26 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/mapper/YqGBuildingMapper.java

@@ -0,0 +1,26 @@
+package com.ruoyi.yiqi.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.mapper.BaseMapperPlus;
+import com.ruoyi.yiqi.entity.YqGBuilding;
+import com.ruoyi.yiqi.entity.YqGUnit;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 楼宇Mapper接口
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+public interface YqGBuildingMapper extends BaseMapperPlus<YqGBuildingMapper, YqGBuilding, YqGBuilding> {
+
+    Page<YqGBuilding> getList(@Param("p") YqGBuilding bo, Page<?> page);
+    List<YqGBuilding> getBuilding(Long areaId);
+    //导入 查询是否已存在
+    YqGBuilding getByName(@Param("name")String name,@Param("areaId")Long areaId);
+    List<YqGBuilding> getByNameList(@Param("name")String name,@Param("areaId")Long areaId);
+    Long checkDataList(@Param("p") YqGBuilding bo);
+
+}

+ 27 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/mapper/YqGHouseMapper.java

@@ -0,0 +1,27 @@
+package com.ruoyi.yiqi.mapper;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.mapper.BaseMapperPlus;
+import com.ruoyi.yiqi.entity.YqGHouse;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 房屋Mapper接口
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+public interface YqGHouseMapper extends BaseMapperPlus<YqGHouseMapper, YqGHouse, YqGHouse> {
+
+    Page<YqGHouse> getList(@Param("p") YqGHouse bo, Page<?> page);
+    YqGHouse getById(Long id);
+    List<YqGHouse> getHouse(Long unitId);
+    YqGHouse getByName(@Param("name")String name,@Param("unitId")Long unitId);
+    List<YqGHouse> getByNameList(@Param("name")String name,@Param("unitId")Long unitId);
+    Long checkDataList(@Param("p") YqGHouse bo);
+    int updateDelFlagById(@Param("id") Long id);
+
+}

+ 29 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/mapper/YqGUnitMapper.java

@@ -0,0 +1,29 @@
+package com.ruoyi.yiqi.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.mapper.BaseMapperPlus;
+import com.ruoyi.yiqi.entity.YqGUnit;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 单元Mapper接口
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+public interface YqGUnitMapper extends BaseMapperPlus<YqGUnitMapper, YqGUnit, YqGUnit> {
+
+    Page<YqGUnit> getList(@Param("p") YqGUnit bo, Page<?> page);
+
+    YqGUnit getById(Long id);
+
+    List<YqGUnit> getUnit(Long buildingId);
+
+    YqGUnit getByName(@Param("name") String name, @Param("buildingId") Long buildingId);
+
+    List<YqGUnit> getByNameList(@Param("name") String name, @Param("buildingId") Long buildingId);
+
+    Long checkDataList(@Param("p") YqGUnit bo);
+}

+ 97 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/IYqGAreaService.java

@@ -0,0 +1,97 @@
+package com.ruoyi.yiqi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.yiqi.entity.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 小区Service接口
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+public interface IYqGAreaService extends IService<YqGArea> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	YqGArea queryById(Long id);
+
+	/**
+	 * 查询列表
+	 */
+    TableDataInfo<YqGArea> queryPageList(YqGArea bo);
+
+	/**
+	 * 查询列表
+	 */
+	List<YqGArea> queryList(YqGArea bo);
+
+	/**
+	 * 根据新增业务对象插入小区
+	 * @param bo 小区新增业务对象
+	 * @return
+	 */
+	Boolean insertByBo(YqGArea bo);
+
+	/**
+	 * 根据编辑业务对象修改小区
+	 * @param bo 小区编辑业务对象
+	 * @return
+	 */
+	Boolean updateByBo(YqGArea bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	TableDataInfo<YqGArea> getList(YqGArea bo);
+	List<YqGArea> getArea();
+
+	List<GCensusVo> getExamineArea(Long areaId);
+	List<GCensusVo> getExamineServe(Long id);
+	List<GExportVo> getExportList();
+	List<GExportsVo> getExport(YqGArea bo);
+	String getDictNameOfAffiliatedPackage(YqGArea bo);
+	/**
+	 * 导入用户数据
+	 *
+	 * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
+	 * @param operName        操作用户
+	 * @return 结果
+	 */
+	Map<String,Object> importUser(List<GImportVo> list, Boolean isUpdateSupport, String operName, int n, int successNum);
+	String importApprovalExcel(List<GImportVo> list, Boolean isUpdateSupport, String operName);
+	String importUserA(List<GImportVo> list, Boolean isUpdateSupport, String operName);
+
+    void write(List<Long> ids);
+
+	List<GCensusVo> getAreaSum(Long areaId);
+
+	void upload(HttpServletRequest request, HttpServletResponse response, Long id);
+
+	Boolean releaseIs(Long id);
+
+	List<String> getPhoto(Long id);
+
+	Boolean getForName(String name,String id);
+
+	/**
+	 * 导出小区完工率
+	 * @param areaId
+	 * @return
+	 */
+	List<GAreaExportVo> getExportHouse(Long areaId);
+
+    void deleteDirectory(String name);
+}

+ 58 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/IYqGBuildingService.java

@@ -0,0 +1,58 @@
+package com.ruoyi.yiqi.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.yiqi.entity.YqGBuilding;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 楼宇Service接口
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+public interface IYqGBuildingService extends IService<YqGBuilding> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	YqGBuilding queryById(Long id);
+
+	/**
+	 * 查询列表
+	 */
+    TableDataInfo<YqGBuilding> queryPageList(YqGBuilding bo);
+
+	/**
+	 * 查询列表
+	 */
+	List<YqGBuilding> queryList(YqGBuilding bo);
+
+	/**
+	 * 根据新增业务对象插入楼宇
+	 * @param bo 楼宇新增业务对象
+	 * @return
+	 */
+	Boolean insertByBo(YqGBuilding bo);
+
+	/**
+	 * 根据编辑业务对象修改楼宇
+	 * @param bo 楼宇编辑业务对象
+	 * @return
+	 */
+	Boolean updateByBo(YqGBuilding bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	TableDataInfo<YqGBuilding> getList(YqGBuilding bo);
+	List<YqGBuilding> getBuilding(Long areaId);
+}

+ 61 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/IYqGHouseService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.yiqi.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.yiqi.entity.YqGHouse;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 房屋Service接口
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+public interface IYqGHouseService extends IService<YqGHouse> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	YqGHouse queryById(Long id);
+
+	/**
+	 * 查询列表
+	 */
+    TableDataInfo<YqGHouse> queryPageList(YqGHouse bo);
+
+	/**
+	 * 查询列表
+	 */
+	List<YqGHouse> queryList(YqGHouse bo);
+
+	/**
+	 * 根据新增业务对象插入房屋
+	 * @param bo 房屋新增业务对象
+	 * @return
+	 */
+	Boolean insertByBo(YqGHouse bo);
+
+	/**
+	 * 根据编辑业务对象修改房屋
+	 * @param bo 房屋编辑业务对象
+	 * @return
+	 */
+	Boolean updateByBo(YqGHouse bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	TableDataInfo<YqGHouse> getList(YqGHouse bo);
+
+	YqGHouse getById(Long id);
+
+	List<YqGHouse> getHouse(Long unitId);
+}

+ 61 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/IYqGUnitService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.yiqi.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.yiqi.entity.YqGUnit;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 单元Service接口
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+public interface IYqGUnitService extends IService<YqGUnit> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	YqGUnit queryById(Long id);
+
+	/**
+	 * 查询列表
+	 */
+    TableDataInfo<YqGUnit> queryPageList(YqGUnit bo);
+
+	/**
+	 * 查询列表
+	 */
+	List<YqGUnit> queryList(YqGUnit bo);
+
+	/**
+	 * 根据新增业务对象插入单元
+	 * @param bo 单元新增业务对象
+	 * @return
+	 */
+	Boolean insertByBo(YqGUnit bo);
+
+	/**
+	 * 根据编辑业务对象修改单元
+	 * @param bo 单元编辑业务对象
+	 * @return
+	 */
+	Boolean updateByBo(YqGUnit bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	TableDataInfo<YqGUnit> getList(YqGUnit bo);
+
+	YqGUnit getById(Long id);
+
+	List<YqGUnit> getUnit(Long buildingId);
+}

+ 974 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/impl/YqGAreaServiceImpl.java

@@ -0,0 +1,974 @@
+package com.ruoyi.yiqi.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.helper.LoginHelper;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.obs.FileUtil;
+import com.ruoyi.framework.obs.ObsService;
+import com.ruoyi.system.mapper.SysDictDataMapper;
+import com.ruoyi.yiqi.entity.*;
+import com.ruoyi.yiqi.enums.Constants;
+import com.ruoyi.yiqi.mapper.YqGAreaMapper;
+import com.ruoyi.yiqi.mapper.YqGBuildingMapper;
+import com.ruoyi.yiqi.mapper.YqGHouseMapper;
+import com.ruoyi.yiqi.mapper.YqGUnitMapper;
+import com.ruoyi.yiqi.service.IYqGAreaService;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.math.BigDecimal;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Function;
+
+/**
+ * 小区Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Service
+@Slf4j
+public class YqGAreaServiceImpl implements IYqGAreaService {
+
+
+    private final static String path = "/zdsz/temporary/";
+
+    @Resource
+    private YqGAreaMapper gAreaMapper;
+    @Resource
+    private YqGBuildingMapper gBuildingMapper;
+    @Resource
+    private YqGUnitMapper gUnitMapper;
+    @Resource
+    private YqGHouseMapper gHouseMapper;
+//    @Autowired
+//    private YqGOrderMapper gOrderMapper;
+//
+//    @Autowired
+//    private IGOrderPhotoService orderPhotoService;
+
+    @Autowired
+    private ObsService obsService;
+    @Resource
+    private SysDictDataMapper sysDictDataMapper;
+
+    @Override
+    public YqGArea queryById(Long id) {
+        return gAreaMapper.selectVoById(id);
+    }
+
+    @Override
+    public TableDataInfo<YqGArea> queryPageList(YqGArea bo) {
+        Page<YqGArea> page = new Page<>(bo.getPageNum(), bo.getPageSize());
+        Page<YqGArea> result = gAreaMapper.getList(bo,page);
+        return PageUtils.buildDataInfo(result);
+    }
+
+    @Override
+    public List<YqGArea> queryList(YqGArea bo) {
+        return gAreaMapper.selectVoList(buildQueryWrapper(bo));
+    }
+
+    private LambdaQueryWrapper<YqGArea> buildQueryWrapper(YqGArea bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<YqGArea> lqw = Wrappers.lambdaQuery();
+        lqw.like(StringUtils.isNotBlank(bo.getName()), YqGArea::getName, bo.getName());
+        lqw.eq(bo.getUserId() != null, YqGArea::getUserId, bo.getUserId());
+        return lqw;
+    }
+
+    @Override
+    public Boolean insertByBo(YqGArea bo) {
+        bo.setReleaseIs("001");
+        YqGArea add = BeanUtil.toBean(bo, YqGArea.class);
+        validEntityBeforeSave(add);
+        boolean flag = false;
+        Long count = gAreaMapper.checkDataList(bo);
+        if(count == 0){
+            flag = save(add);
+            if (flag) {
+                bo.setId(add.getId());
+            }
+        }
+        return flag;
+    }
+
+    @Override
+    public Boolean updateByBo(YqGArea bo) {
+        YqGArea update = BeanUtil.toBean(bo, YqGArea.class);
+        validEntityBeforeSave(update);
+        return updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(YqGArea entity) {
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if (isValid) {
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return removeByIds(ids);
+    }
+
+    @Override
+    public TableDataInfo<YqGArea> getList(YqGArea bo) {
+        Page<YqGArea> page = new Page<>(bo.getPageNum(), bo.getPageSize());
+        Page<YqGArea> list = gAreaMapper.getList(bo, page);
+        DecimalFormat df = new DecimalFormat("0.00%");
+        list.getRecords().forEach(i -> {
+            //小区户数
+            BigDecimal house = BigDecimal.valueOf(gAreaMapper.getHouse(i.getId()));
+            //小区订单完成数
+//            BigDecimal order = BigDecimal.valueOf(gOrderMapper.getCount(i.getId()));
+//            if (house.compareTo(BigDecimal.ZERO) != 0 && order.compareTo(BigDecimal.ZERO) != 0) {
+//                String rate = df.format(order.divide(house, 2, BigDecimal.ROUND_HALF_UP));
+//                i.setRate(rate);
+//            } else {
+//                i.setRate("0.00%");
+//            }
+        });
+
+        return PageUtils.buildDataInfo(list);
+    }
+
+    @Override
+    public List<YqGArea> getArea() {
+        return gAreaMapper.getArea();
+    }
+
+    @Override
+    public List<GCensusVo> getExamineArea(Long areaId) {
+        List<GCensusVo> list = gAreaMapper.getExamineArea(areaId);
+        list.forEach(i -> {
+            if (Constants.Dict.EXAMINE_STATUS001.getItemValue().equals(i.getName())) {
+                i.setName(Constants.Dict.EXAMINE_STATUS001.getItemName());
+            }
+            if (Constants.Dict.EXAMINE_STATUS002.getItemValue().equals(i.getName())) {
+                i.setName(Constants.Dict.EXAMINE_STATUS002.getItemName());
+            }
+        });
+        return list;
+    }
+
+    @Override
+    public List<GCensusVo> getExamineServe(Long id) {
+        List<GCensusVo> list = gAreaMapper.getExamineServe(id);
+        list.forEach(i -> {
+            if (Constants.Dict.SERVICE_TYPE001.getItemValue().equals(i.getName())) {
+                i.setName(Constants.Dict.SERVICE_TYPE001.getItemName());
+            }
+            if (Constants.Dict.SERVICE_TYPE002.getItemValue().equals(i.getName())) {
+                i.setName(Constants.Dict.SERVICE_TYPE002.getItemName());
+            }
+            if (Constants.Dict.SERVICE_TYPE003.getItemValue().equals(i.getName())) {
+                i.setName(Constants.Dict.SERVICE_TYPE003.getItemName());
+            }
+        });
+        return list;
+    }
+
+    @Override
+    public List<GExportVo> getExportList() {
+        return gAreaMapper.getExportList();
+    }
+
+
+    @Override
+    public List<GExportsVo> getExport(YqGArea bo) {
+        return gAreaMapper.getExport(bo);
+    }
+    @Override
+    public String getDictNameOfAffiliatedPackage(YqGArea bo){
+        return gAreaMapper.getDictNameOfAffiliatedPackage(bo);
+    }
+    /**
+     * 导入用户数据
+     *
+     * @param list            数据列表
+     * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
+     * @param operName        操作用户
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public Map<String,Object> importUser(List<GImportVo> list, Boolean isUpdateSupport, String operName, int n, int successNum) {
+        if (ObjectUtils.isEmpty(list) || list.size() == 0) {
+            throw new ServiceException("导入数据不能为空!");
+        }
+        Map<String,Object> ret = new HashMap<>();
+        StringBuilder successMsg = new StringBuilder();
+        for (int i=n ;i< list.size() ;i++) {
+            GImportVo vo = list.get(i);
+
+            String districtValue = sysDictDataMapper.queryValueTextByKey("district",vo.getDistrict());
+            if(StringUtils.isBlank(districtValue)){
+                throw new ServiceException("" + "第" + (n+1) + "行行政区填写错误,导入失败!");
+            }
+//        }
+//        for (GImportVo vo : list) {
+            try {
+                n++;
+                // 验证是否存在这个小区
+                if (StringUtils.isNotEmpty(vo.getAreaName())) {
+                    YqGArea area = gAreaMapper.getByName(vo.getAreaName());
+                    YqGBuilding building = new YqGBuilding();
+                    YqGUnit unit = new YqGUnit();
+                    YqGHouse house = new YqGHouse();
+                    if (!ObjectUtils.isEmpty(area)) {
+                        area = new YqGArea();
+                        //小区zDsZ1a2b3c4d%1234!
+                        area.setName(vo.getAreaName());
+                        area.setCreateBy(operName);
+                        area.setCreateTime(new Date());
+                        area.setDistrict(districtValue);
+                        gAreaMapper.insert(area);
+                        if (!ObjectUtils.isEmpty(vo.getBuildName())) {
+                            //楼宇
+                            building.setName(vo.getBuildName());
+                            building.setAreaId(area.getId());
+                            building.setCreateBy(operName);
+                            building.setCreateTime(new Date());
+                            gBuildingMapper.insert(building);
+                            if (!ObjectUtils.isEmpty(vo.getUnitName())) {
+                                //单元
+                                unit.setName(vo.getUnitName());
+                                unit.setBuildingId(building.getId());
+                                unit.setCreateBy(operName);
+                                unit.setCreateTime(new Date());
+                                gUnitMapper.insert(unit);
+                                if (!ObjectUtils.isEmpty(vo.getHouseName())) {
+                                    //房屋
+                                    house.setName(vo.getHouseName());
+                                    house.setUnitId(unit.getId());
+                                    house.setCreateBy(operName);
+                                    house.setCreateTime(new Date());
+                                    gHouseMapper.insert(house);
+                                    successNum++;
+                                } else {
+                                    throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                                }
+                            } else {
+                                throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                            }
+                        } else {
+                            throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                        }
+                    } else if (isUpdateSupport) {
+//                        area.setUpdateBy(operName);
+//                        area.setUpdateTime(new Date());
+//                        gAreaMapper.updateById(area);
+                        if (!ObjectUtils.isEmpty(vo.getBuildName())) {
+                            building = gBuildingMapper.getByName(vo.getBuildName(), area.getId());
+                            if (!ObjectUtils.isEmpty(building)) {
+                                building = new YqGBuilding();
+                                //楼宇
+                                building.setName(vo.getBuildName());
+                                building.setAreaId(area.getId());
+                                building.setCreateBy(operName);
+                                building.setCreateTime(new Date());
+                                gBuildingMapper.insert(building);
+                                if (!ObjectUtils.isEmpty(vo.getUnitName())) {
+                                    //单元
+                                    unit.setName(vo.getUnitName());
+                                    unit.setBuildingId(building.getId());
+                                    unit.setCreateBy(operName);
+                                    unit.setCreateTime(new Date());
+                                    gUnitMapper.insert(unit);
+                                    if (!ObjectUtils.isEmpty(vo.getHouseName())) {
+                                        //房屋
+                                        house.setName(vo.getHouseName());
+                                        house.setUnitId(unit.getId());
+                                        house.setCreateBy(operName);
+                                        house.setCreateTime(new Date());
+                                        gHouseMapper.insert(house);
+                                        successNum++;
+                                    } else {
+                                        throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                                    }
+                                } else {
+                                    throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                                }
+                            } else {
+//                                building.setUpdateBy(operName);
+//                                building.setUpdateTime(new Date());
+//                                gBuildingMapper.updateById(building);
+                                if (!ObjectUtils.isEmpty(vo.getUnitName())) {
+                                    unit = gUnitMapper.getByName(vo.getUnitName(), building.getId());
+                                    if (!ObjectUtils.isEmpty(unit)) {
+                                        unit = new YqGUnit();
+                                        //单元
+                                        unit.setName(vo.getUnitName());
+                                        unit.setBuildingId(building.getId());
+                                        unit.setCreateBy(operName);
+                                        unit.setCreateTime(new Date());
+                                        gUnitMapper.insert(unit);
+                                        if (!ObjectUtils.isEmpty(vo.getHouseName())) {
+                                            //房屋
+                                            house.setName(vo.getHouseName());
+                                            house.setUnitId(unit.getId());
+                                            house.setCreateBy(operName);
+                                            house.setCreateTime(new Date());
+                                            gHouseMapper.insert(house);
+                                            successNum++;
+                                        }else{
+                                            throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                                        }
+                                    } else {
+//                                        unit.setUpdateBy(operName);
+//                                        unit.setUpdateTime(new Date());
+//                                        gUnitMapper.updateById(unit);
+                                        if (!ObjectUtils.isEmpty(vo.getHouseName())) {
+                                            house = gHouseMapper.getByName(vo.getHouseName(), unit.getId());
+                                            if (!ObjectUtils.isEmpty(house)) {
+                                                house = new YqGHouse();
+                                                //房屋
+                                                house.setName(vo.getHouseName());
+                                                house.setUnitId(unit.getId());
+                                                house.setCreateBy(operName);
+                                                house.setCreateTime(new Date());
+                                                gHouseMapper.insert(house);
+                                                successNum++;
+//                                            } else {
+//                                                house.setUpdateBy(operName);
+//                                                house.setUpdateTime(new Date());
+//                                                gHouseMapper.updateById(house);
+                                            }
+                                        }else{
+                                            throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                                        }
+                                    }
+                                }else{
+                                    throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                                }
+                            }
+                        }else{
+                            throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                        }
+                    }
+                } else {
+                    throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+                }
+            } catch (Exception e) {
+                throw new ServiceException("" + "第" + (n+1) + "行格式错误,导入失败!");
+            }
+            ret.put("bfb",String.format("%.2f",(Double.valueOf((n+1))/Double.valueOf(list.size()))*100));
+            ret.put("n",n);
+            ret.put("is_success",true);
+            ret.put("successMsg","");
+            ret.put("successNum",successNum);
+            return ret;
+        }
+        successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条");
+        ret.put("bfb",String.format("%.2f",(Double.valueOf((n+1))/Double.valueOf(list.size()))*100));
+        ret.put("n",n);
+        ret.put("is_success",false);
+        ret.put("successMsg",successMsg.toString());
+        return ret;
+    }
+
+    /**
+     * 导入用户数据
+     *
+     * @param list            数据列表
+     * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
+     * @param operName        操作用户
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public String importApprovalExcel(List<GImportVo> list, Boolean isUpdateSupport, String operName) {
+        if (!ObjectUtils.isEmpty(list) || list.size() == 0) {
+            throw new ServiceException("导入数据不能为空!");
+        }
+        int successNum = 0;
+        int n = 1;
+        StringBuilder successMsg = new StringBuilder();
+        for (GImportVo vo : list) {
+            try {
+                n++;
+                // 验证是否存在这个小区
+                if (!ObjectUtils.isEmpty(vo.getAreaName())) {
+                    YqGArea area = gAreaMapper.getByName(vo.getAreaName());
+                    YqGBuilding building = new YqGBuilding();
+                    YqGUnit unit = new YqGUnit();
+                    YqGHouse house = new YqGHouse();
+                    if (!ObjectUtils.isEmpty(area)) {
+                        building = gBuildingMapper.getByName(vo.getBuildName(), area.getId());
+                        if (!ObjectUtils.isEmpty(building)) {
+                            unit = gUnitMapper.getByName(vo.getUnitName(), building.getId());
+                            if (!ObjectUtils.isEmpty(unit)) {
+                                house = gHouseMapper.getByName(vo.getHouseName(), unit.getId());
+                                if (!ObjectUtils.isEmpty(house)) {
+                                    Long id = house.getId();
+//                                    GOrder gOrder = gOrderMapper.getByHouseId(id);
+//                                    if(!ObjectUtils.isEmpty(gOrder)){
+//                                        gOrder.setServiceType("002");
+//                                        gOrder.setOrderStatus("002");
+//                                        gOrder.setExamineStatus("001");
+//                                        String time = "2021-12-01 00:00:00";
+//                                        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//                                        Date date = sf.parse(time);
+//                                        gOrder.setTime(date);
+//                                        gOrderMapper.updateById(gOrder);
+//                                    }else{
+//                                        GOrder order = new GOrder();
+//                                        order.setOrderNum(String.valueOf(ProfileUtil.getAtomicCounter()));
+//                                        order.setServiceType("002");
+//                                        order.setHouseId(house.getId());
+//                                        order.setOrderStatus("002");
+//                                        order.setExamineStatus("001");
+//                                        String time = "2021-12-01 00:00:00";
+//                                        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//                                        Date date = sf.parse(time);
+//                                        order.setTime(date);
+//                                        gOrderMapper.insert(order);
+//                                    }
+                                    successNum++;
+                                }else{
+                                    throw new ServiceException("" + "第" + n + "行房间不存在,导入审批失败!");
+                                }
+                            }else{
+                                throw new ServiceException("" + "第" + n + "行单元不存在,导入审批失败!");
+                            }
+                        }else{
+                            throw new ServiceException("" + "第" + n + "行楼栋不存在,导入审批失败!");
+                        }
+                    }else{
+                        throw new ServiceException("" + "第" + n + "行小区不存在,导入审批失败!");
+                    }
+                }else{
+                    throw new ServiceException("" + "第" + n + "行小区名称未填写,导入审批失败!");
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        successMsg.insert(0, "恭喜您,数据已审批成功!共 " + successNum + " 条");
+        return successMsg.toString();
+    }
+
+
+    @Transactional
+    @Override
+    public String importUserA(List<GImportVo> list, Boolean isUpdateSupport, String operName) {
+        if (!ObjectUtils.isEmpty(list) || list.size() == 0) {
+            throw new ServiceException("导入数据不能为空!");
+        }
+        int successNum = 0;
+        int n = 1;
+        StringBuilder successMsg = new StringBuilder();
+        for (GImportVo vo : list) {
+            try {
+                n++;
+                // 验证是否存在这个小区
+                if (!ObjectUtils.isEmpty(vo.getAreaName())) {
+                    YqGArea area = gAreaMapper.getByName(vo.getAreaName());
+                    YqGBuilding building = new YqGBuilding();
+                    YqGUnit unit = new YqGUnit();
+                    YqGHouse house = new YqGHouse();
+//                    GOrder order = new GOrder();
+                    if (!ObjectUtils.isEmpty(area)) {
+                        area = new YqGArea();
+                        //小区
+                        area.setName(vo.getAreaName());
+                        area.setCreateBy(operName);
+                        area.setCreateTime(new Date());
+                        gAreaMapper.insert(area);
+                        if (!ObjectUtils.isEmpty(vo.getBuildName())) {
+                            //楼宇
+                            building.setName(vo.getBuildName());
+                            building.setAreaId(area.getId());
+                            building.setCreateBy(operName);
+                            building.setCreateTime(new Date());
+                            gBuildingMapper.insert(building);
+                            if (!ObjectUtils.isEmpty(vo.getUnitName())) {
+                                //单元
+                                unit.setName(vo.getUnitName());
+                                unit.setBuildingId(building.getId());
+                                unit.setCreateBy(operName);
+                                unit.setCreateTime(new Date());
+                                gUnitMapper.insert(unit);
+                                if (!ObjectUtils.isEmpty(vo.getHouseName())) {
+                                    //房屋
+                                    house.setName(vo.getHouseName());
+                                    house.setUnitId(unit.getId());
+                                    house.setCreateBy(operName);
+                                    house.setCreateTime(new Date());
+                                    gHouseMapper.insert(house);
+                                    successNum++;
+//                                    order.setOrderNum(String.valueOf(ProfileUtil.getAtomicCounter()));
+//                                    order.setServiceType("002");
+//                                    order.setHouseId(house.getId());
+//                                    order.setOrderStatus("002");
+//                                    order.setExamineStatus("001");
+                                    String time = "2021-12-01 00:00:00";
+                                    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                                    Date date = sf.parse(time);
+//                                    order.setTime(date);
+//                                    gOrderMapper.insert(order);
+
+                                } else {
+                                    throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                                }
+                            } else {
+                                throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                            }
+                        } else {
+                            throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                        }
+                    } else if (isUpdateSupport) {
+                        area.setUpdateBy(operName);
+                        area.setUpdateTime(new Date());
+                        gAreaMapper.updateById(area);
+                        if (!ObjectUtils.isEmpty(vo.getBuildName())) {
+                            building = gBuildingMapper.getByName(vo.getBuildName(), area.getId());
+                            if (!ObjectUtils.isEmpty(building)) {
+                                building = new YqGBuilding();
+                                //楼宇
+                                building.setName(vo.getBuildName());
+                                building.setAreaId(area.getId());
+                                building.setCreateBy(operName);
+                                building.setCreateTime(new Date());
+                                gBuildingMapper.insert(building);
+                                if (!ObjectUtils.isEmpty(vo.getUnitName())) {
+                                    //单元
+                                    unit.setName(vo.getUnitName());
+                                    unit.setBuildingId(building.getId());
+                                    unit.setCreateBy(operName);
+                                    unit.setCreateTime(new Date());
+                                    gUnitMapper.insert(unit);
+                                    if (!ObjectUtils.isEmpty(vo.getHouseName())) {
+                                        //房屋
+                                        house.setName(vo.getHouseName());
+                                        house.setUnitId(unit.getId());
+                                        house.setCreateBy(operName);
+                                        house.setCreateTime(new Date());
+                                        gHouseMapper.insert(house);
+                                        successNum++;
+//                                        order.setOrderNum(String.valueOf(ProfileUtil.getAtomicCounter()));
+//                                        order.setServiceType("002");
+//                                        order.setHouseId(house.getId());
+//                                        order.setOrderStatus("002");
+//                                        order.setExamineStatus("001");
+                                        String time = "2021-12-01 00:00:00";
+                                        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                                        Date date = sf.parse(time);
+//                                        order.setTime(date);
+//                                        gOrderMapper.insert(order);
+                                    } else {
+                                        throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                                    }
+                                } else {
+                                    throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                                }
+                            } else {
+                                building.setUpdateBy(operName);
+                                building.setUpdateTime(new Date());
+                                gBuildingMapper.updateById(building);
+                                if (!ObjectUtils.isEmpty(vo.getUnitName())) {
+                                    unit = gUnitMapper.getByName(vo.getUnitName(), building.getId());
+                                    if (!ObjectUtils.isEmpty(unit)) {
+                                        unit = new YqGUnit();
+                                        //单元
+                                        unit.setName(vo.getUnitName());
+                                        unit.setBuildingId(building.getId());
+                                        unit.setCreateBy(operName);
+                                        unit.setCreateTime(new Date());
+                                        gUnitMapper.insert(unit);
+                                        if (!ObjectUtils.isEmpty(vo.getHouseName())) {
+                                            //房屋
+                                            house.setName(vo.getHouseName());
+                                            house.setUnitId(unit.getId());
+                                            house.setCreateBy(operName);
+                                            house.setCreateTime(new Date());
+                                            gHouseMapper.insert(house);
+                                            successNum++;
+//                                            order.setOrderNum(String.valueOf(ProfileUtil.getAtomicCounter()));
+//                                            order.setServiceType("002");
+//                                            order.setHouseId(house.getId());
+//                                            order.setOrderStatus("002");
+//                                            order.setExamineStatus("001");
+                                            String time = "2021-12-01 00:00:00";
+                                            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                                            Date date = sf.parse(time);
+//                                            order.setTime(date);
+//                                            gOrderMapper.insert(order);
+                                        }else{
+                                            throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                                        }
+                                    } else {
+                                        unit.setUpdateBy(operName);
+                                        unit.setUpdateTime(new Date());
+                                        gUnitMapper.updateById(unit);
+                                        if (!ObjectUtils.isEmpty(vo.getHouseName())) {
+                                            house = gHouseMapper.getByName(vo.getHouseName(), unit.getId());
+                                            if (!ObjectUtils.isEmpty(house)) {
+                                                house = new YqGHouse();
+                                                //房屋
+                                                house.setName(vo.getHouseName());
+                                                house.setUnitId(unit.getId());
+                                                house.setCreateBy(operName);
+                                                house.setCreateTime(new Date());
+                                                gHouseMapper.insert(house);
+                                                successNum++;
+//                                                order.setOrderNum(String.valueOf(ProfileUtil.getAtomicCounter()));
+//                                                order.setServiceType("002");
+//                                                order.setHouseId(house.getId());
+//                                                order.setOrderStatus("002");
+//                                                order.setExamineStatus("001");
+                                                String time = "2021-12-01 00:00:00";
+                                                SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                                                Date date = sf.parse(time);
+//                                                order.setTime(date);
+//                                                gOrderMapper.insert(order);
+                                            } else {
+                                                house.setUpdateBy(operName);
+                                                house.setUpdateTime(new Date());
+                                                gHouseMapper.updateById(house);
+//                                                order = gOrderMapper.getByHouseId(house.getId());
+//                                                if (!ObjectUtils.isEmpty(order)){
+//                                                    order = new GOrder();
+//                                                    order.setOrderNum(String.valueOf(ProfileUtil.getAtomicCounter()));
+//                                                    order.setServiceType("002");
+//                                                    order.setHouseId(house.getId());
+//                                                    order.setOrderStatus("002");
+//                                                    order.setExamineStatus("001");
+//                                                    String time = "2021-12-01 00:00:00";
+//                                                    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//                                                    Date date = sf.parse(time);
+//                                                    order.setTime(date);
+//                                                    gOrderMapper.insert(order);
+//                                                }
+                                            }
+                                        }else{
+                                            throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                                        }
+                                    }
+                                }else{
+                                    throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                                }
+                            }
+                        }else{
+                            throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                        }
+                    } else {
+                        throw new ServiceException("" + "第" + n + "行小区已存在,导入失败!");
+                    }
+                } else {
+                    throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+                }
+            } catch (Exception e) {
+                throw new ServiceException("" + "第" + n + "行格式错误,导入失败!");
+            }
+        }
+        successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条");
+        return successMsg.toString();
+    }
+
+    @Async
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void write(List<Long> ids) {
+//        List<GDownloadVo> list = orderPhotoService.getAll(ids);
+//        list.forEach(x -> {
+//            if (!ObjectUtils.isEmpty(x.getPicUrl())) {
+//                // 创建最外层文件夹
+//                File file = new File(path);
+//                if (!file.exists()) {
+//                    file.mkdirs();
+//                }
+//                // 创建小区
+//                File headFile = new File(file.getPath() + "/" + x.getArea());
+//                if (!headFile.exists()) {
+//                    headFile.mkdirs();
+//                }
+//                // 小区下再次创建小区,本级用于导出
+//                File areaFile = new File(headFile.getPath() + "/" + x.getArea());
+//                if (!areaFile.exists()) {
+//                    areaFile.mkdirs();
+//                }
+//                // 楼
+//                File buildingFile = new File(areaFile.getPath() + "/" + x.getBuilding());
+//                if (!buildingFile.exists()) {
+//                    buildingFile.mkdirs();
+//                }
+//                // 单元
+//                File unitFile = new File(buildingFile.getPath() + "/" + x.getUnit());
+//                if (!unitFile.exists()) {
+//                    unitFile.mkdirs();
+//                }
+//                // 房间
+//                File houseFile = new File(unitFile.getPath() + "/" + x.getHouse());
+//                if (!houseFile.exists()) {
+//                    houseFile.mkdirs();
+//                }
+//                try {
+//                    obsService.download(houseFile.getPath(), x.getPicUrl().substring(x.getPicUrl().lastIndexOf("/") + 1));
+//                    System.out.println("22222222222222222222222222");
+//                } catch (IOException e) {
+//                    e.printStackTrace();
+//                }
+//            }
+//        });
+    }
+
+    @Override
+    public void upload(HttpServletRequest request, HttpServletResponse response, Long id) {
+        YqGArea po = gAreaMapper.selectById(id);
+        // 设置文件夹时间戳和路径位置
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+        String format = sdf.format(new Date());
+        // 文件夹的路径,写入服务器的 /tmp 文件夹下
+        String filePath = path + po.getName();
+//        String filePath = "D:\\zhsq_qk\\御景名都B";
+        // 导出的zip路径
+        String zipFilePath = path + "tmp_" + format + ".zip";
+        // 导出的zip名字
+        String zipName = "PHOTO_" + format + ".zip";
+
+        // 调用工具类压缩文件夹
+        FileOutputStream fileOutputStream = null;
+        try {
+            fileOutputStream = new FileOutputStream(new File(zipFilePath));
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+        FileUtil.toZip(filePath, fileOutputStream, true);
+
+        // 调用工具类设置响应格式
+        try {
+            FileUtil.downLoadFile(request, response, zipName, zipFilePath);
+        } catch (UnsupportedEncodingException e) {
+            log.warn("下载小区压缩文件service:"+e);
+            log.error("用户:{}导出SQL压缩包失败{}" + e);
+            throw new RuntimeException("导出失败~");
+        }
+//        deleteDirectory(filePath);
+    }
+
+    @Override
+    public Boolean releaseIs(Long id) {
+        YqGArea bo = new YqGArea();
+        bo.setId(id);
+        bo.setReleaseBy(LoginHelper.getLoginUser().getUsername());
+        bo.setReleaseIs("002");
+        YqGArea update = BeanUtil.toBean(bo, YqGArea.class);
+        validEntityBeforeSave(update);
+        return updateById(update);
+    }
+
+    @Override
+    public List<String> getPhoto(Long id) {
+        return gAreaMapper.getPhoto(id);
+    }
+
+    @Override
+    public Boolean getForName(String name, String id) {
+        YqGArea vo = gAreaMapper.getForName(name, id);
+        if (vo == null) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public List<GAreaExportVo> getExportHouse(Long areaId) {
+        //全部房屋
+        List<GAreaExportVo> allHouse = gAreaMapper.getAllHouse(areaId);
+        //已完工
+        List<GAreaExportVo> orderHouse = gAreaMapper.getOrderHouse(areaId);
+        allHouse.stream().forEach(i->{
+            if (orderHouse.stream().filter(x -> x.getId().equals(i.getId())).findFirst().orElse(null) != null) {
+                i.setStatus("已完工");
+            }else{
+                i.setStatus("未完工");
+            }
+        });
+        return allHouse;
+    }
+
+    @Override
+    public List<GCensusVo> getAreaSum(Long areaId) {
+        List<GCensusVo> list = gAreaMapper.getConform(areaId);
+        AtomicInteger aa = new AtomicInteger(gAreaMapper.getHouseCount(areaId));
+        list.forEach(i -> {
+            if (Constants.Dict.SERVICE_TYPE002.getItemValue().equals(i.getName())) {
+                i.setName(Constants.Dict.SERVICE_TYPE002.getItemName());
+            }
+            if (Constants.Dict.SERVICE_TYPE003.getItemValue().equals(i.getName())) {
+                i.setName(Constants.Dict.SERVICE_TYPE003.getItemName());
+            }
+//            if (Constants.Dict.SERVICE_TYPE004.getItemValue().equals(i.getName())) {
+//                i.setName(Constants.Dict.SERVICE_TYPE004.getItemName());
+//            }
+//            if (Constants.Dict.SERVICE_TYPE005.getItemValue().equals(i.getName())) {
+//                i.setName(Constants.Dict.SERVICE_TYPE005.getItemName());
+//            }
+//            if (Constants.Dict.SERVICE_TYPE006.getItemValue().equals(i.getName())) {
+//                i.setName(Constants.Dict.SERVICE_TYPE006.getItemName());
+//            }
+            aa.set(aa.get() - i.getValue());
+        });
+        GCensusVo vo = new GCensusVo();
+        vo.setName("未施工");
+        vo.setValue(aa.get());
+        list.add(vo);
+        return list;
+    }
+
+    /**
+     * 将图片写入到磁盘
+     *
+     * @param img      图片数据流
+     * @param fileName 文件保存时的名称
+     */
+
+    public void writeImageToDisk(String path, byte[] img, String fileName) {
+        try {
+            File file = new File(path + fileName);
+
+            FileOutputStream fops = new FileOutputStream(file);
+
+            fops.write(img);
+
+            fops.flush();
+
+            fops.close();
+
+            log.info("图片已经写入到C盘");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+
+    }
+
+    /**
+     * 从输入流中获取数据
+     *
+     * @param inStream 输入流
+     * @return
+     * @throws Exception
+     */
+
+    public static byte[] readInputStream(InputStream inStream) throws Exception {
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        while ((len = inStream.read(buffer)) != -1) {
+            outStream.write(buffer, 0, len);
+
+        }
+        inStream.close();
+        return outStream.toByteArray();
+    }
+    private void deleteFile(File file) {
+        if (file.exists()) {
+            if (file.isFile()) {
+                file.delete();
+            } else if (file.isDirectory()) {
+                File[] files = file.listFiles();
+                for (File f : files) {
+                    this.deleteFile(f);
+                }
+            }
+            file.delete();
+        } else {
+            System.out.println("所删除的" + file.getAbsolutePath() + "不存在!");
+        }
+    }
+    /**
+     * 删除目录及目录下的文件
+     *
+     * @param dir:要删除的目录的文件路径
+     * @return 目录删除成功返回true,否则返回false
+     */
+    @Async
+    @Override
+    public void deleteDirectory(String dir) {
+        deleteFile(new File(path + dir));
+    }
+
+    @Override
+    public boolean saveBatch(Collection<YqGArea> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean saveOrUpdateBatch(Collection<YqGArea> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean updateBatchById(Collection<YqGArea> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean saveOrUpdate(YqGArea entity) {
+        return false;
+    }
+
+    @Override
+    public YqGArea getOne(Wrapper<YqGArea> queryWrapper, boolean throwEx) {
+        return null;
+    }
+
+    @Override
+    public Optional<YqGArea> getOneOpt(Wrapper<YqGArea> queryWrapper, boolean throwEx) {
+        return Optional.empty();
+    }
+
+    @Override
+    public Map<String, Object> getMap(Wrapper<YqGArea> queryWrapper) {
+        return new HashMap<>();
+    }
+
+    @Override
+    public <V> V getObj(Wrapper<YqGArea> queryWrapper, Function<? super Object, V> mapper) {
+        return null;
+    }
+
+    @Override
+    public BaseMapper<YqGArea> getBaseMapper() {
+        return null;
+    }
+
+    @Override
+    public Class<YqGArea> getEntityClass() {
+        return null;
+    }
+}

+ 158 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/impl/YqGBuildingServiceImpl.java

@@ -0,0 +1,158 @@
+package com.ruoyi.yiqi.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.page.PagePlus;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.yiqi.entity.YqGBuilding;
+import com.ruoyi.yiqi.entity.YqGUser;
+import com.ruoyi.yiqi.mapper.YqGBuildingMapper;
+import com.ruoyi.yiqi.service.IYqGBuildingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.function.Function;
+
+/**
+ * 楼宇Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Service
+public class YqGBuildingServiceImpl implements IYqGBuildingService {
+    @Autowired
+    private YqGBuildingMapper gBuildingMapper;
+    @Override
+    public YqGBuilding queryById(Long id){
+        return gBuildingMapper.selectVoById(id);
+    }
+
+    @Override
+    public TableDataInfo<YqGBuilding> queryPageList(YqGBuilding bo) {
+        Page<YqGBuilding> page = new Page<>(bo.getPageNum(), bo.getPageSize());
+        Page<YqGBuilding> list = gBuildingMapper.getList(bo,page);
+        return PageUtils.buildDataInfo(list);
+    }
+
+    @Override
+    public List<YqGBuilding> queryList(YqGBuilding bo) {
+        return gBuildingMapper.selectList(buildQueryWrapper(bo));
+    }
+
+    private LambdaQueryWrapper<YqGBuilding> buildQueryWrapper(YqGBuilding bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<YqGBuilding> lqw = Wrappers.lambdaQuery();
+        lqw.like(StringUtils.isNotBlank(bo.getName()), YqGBuilding::getName, bo.getName());
+        lqw.eq(bo.getAreaId() != null, YqGBuilding::getAreaId, bo.getAreaId());
+        return lqw;
+    }
+
+    @Override
+    public Boolean insertByBo(YqGBuilding bo) {
+        YqGBuilding add = BeanUtil.toBean(bo, YqGBuilding.class);
+        validEntityBeforeSave(add);
+        boolean flag = false;
+        Long count = gBuildingMapper.checkDataList(bo);
+        if(count == 0){
+            flag = save(add);
+            if (flag) {
+                bo.setId(add.getId());
+            }
+        }
+        return flag;
+    }
+
+    @Override
+    public boolean saveBatch(Collection<YqGBuilding> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean saveOrUpdateBatch(Collection<YqGBuilding> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean updateBatchById(Collection<YqGBuilding> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean saveOrUpdate(YqGBuilding entity) {
+        return false;
+    }
+
+    @Override
+    public YqGBuilding getOne(Wrapper<YqGBuilding> queryWrapper, boolean throwEx) {
+        return null;
+    }
+
+    @Override
+    public Optional<YqGBuilding> getOneOpt(Wrapper<YqGBuilding> queryWrapper, boolean throwEx) {
+        return Optional.empty();
+    }
+
+    @Override
+    public Map<String, Object> getMap(Wrapper<YqGBuilding> queryWrapper) {
+        return new HashMap<>();
+    }
+
+    @Override
+    public <V> V getObj(Wrapper<YqGBuilding> queryWrapper, Function<? super Object, V> mapper) {
+        return null;
+    }
+
+    @Override
+    public BaseMapper<YqGBuilding> getBaseMapper() {
+        return null;
+    }
+
+    @Override
+    public Class<YqGBuilding> getEntityClass() {
+        return null;
+    }
+
+    @Override
+    public Boolean updateByBo(YqGBuilding bo) {
+        YqGBuilding update = BeanUtil.toBean(bo, YqGBuilding.class);
+        validEntityBeforeSave(update);
+        return updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(YqGBuilding entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return removeByIds(ids);
+    }
+
+    @Override
+    public TableDataInfo<YqGBuilding> getList(YqGBuilding bo) {
+        Page<YqGBuilding> page = new Page<>(bo.getPageNum(), bo.getPageSize());
+        Page<YqGBuilding> list = gBuildingMapper.getList(bo,page);
+        return PageUtils.buildDataInfo(list);
+    }
+
+    @Override
+    public List<YqGBuilding> getBuilding(Long areaId) {
+        return gBuildingMapper.getBuilding(areaId);
+    }
+}

+ 164 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/impl/YqGHouseServiceImpl.java

@@ -0,0 +1,164 @@
+package com.ruoyi.yiqi.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.yiqi.entity.YqGHouse;
+import com.ruoyi.yiqi.entity.YqGUnit;
+import com.ruoyi.yiqi.mapper.YqGHouseMapper;
+import com.ruoyi.yiqi.service.IYqGHouseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.function.Function;
+
+/**
+ * 房屋Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Service
+public class YqGHouseServiceImpl implements IYqGHouseService {
+    @Resource
+    private YqGHouseMapper gHouseMapper;
+    @Override
+    public YqGHouse queryById(Long id){
+        return gHouseMapper.selectVoById(id);
+    }
+
+    @Override
+    public TableDataInfo<YqGHouse> queryPageList(YqGHouse bo) {
+        Page<YqGHouse> page = new Page<>(bo.getPageNum(), bo.getPageSize());
+        Page<YqGHouse> result = gHouseMapper.getList(bo, page);
+        return PageUtils.buildDataInfo(result);
+    }
+
+    @Override
+    public List<YqGHouse> queryList(YqGHouse bo) {
+        return gHouseMapper.selectVoList(buildQueryWrapper(bo));
+    }
+
+    private LambdaQueryWrapper<YqGHouse> buildQueryWrapper(YqGHouse bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<YqGHouse> lqw = Wrappers.lambdaQuery();
+        lqw.like(StringUtils.isNotBlank(bo.getName()), YqGHouse::getName, bo.getName());
+        lqw.eq(bo.getUnitId() != null, YqGHouse::getUnitId, bo.getUnitId());
+        return lqw;
+    }
+
+    @Override
+    public Boolean insertByBo(YqGHouse bo) {
+        YqGHouse add = BeanUtil.toBean(bo, YqGHouse.class);
+        validEntityBeforeSave(add);
+        boolean flag = false;
+        Long count = gHouseMapper.checkDataList(bo);
+        if(count == 0){
+            flag = save(add);
+            if (flag) {
+                bo.setId(add.getId());
+            }
+        }
+
+        return flag;
+    }
+
+    @Override
+    public Boolean updateByBo(YqGHouse bo) {
+        YqGHouse update = BeanUtil.toBean(bo, YqGHouse.class);
+        validEntityBeforeSave(update);
+        return updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(YqGHouse entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return removeByIds(ids);
+    }
+
+    @Override
+    public TableDataInfo<YqGHouse> getList(YqGHouse bo) {
+        Page<YqGHouse> page = new Page<>(bo.getPageNum(), bo.getPageSize());
+        Page<YqGHouse> list = gHouseMapper.getList(bo,page);
+        return PageUtils.buildDataInfo(list);
+    }
+
+    @Override
+    public YqGHouse getById(Long id) {
+        return gHouseMapper.getById(id);
+    }
+
+    @Override
+    public List<YqGHouse> getHouse(Long unitId) {
+        return gHouseMapper.getHouse(unitId);
+    }
+
+    @Override
+    public boolean saveBatch(Collection<YqGHouse> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean saveOrUpdateBatch(Collection<YqGHouse> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean updateBatchById(Collection<YqGHouse> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean saveOrUpdate(YqGHouse entity) {
+        return false;
+    }
+
+    @Override
+    public YqGHouse getOne(Wrapper<YqGHouse> queryWrapper, boolean throwEx) {
+        return null;
+    }
+
+    @Override
+    public Optional<YqGHouse> getOneOpt(Wrapper<YqGHouse> queryWrapper, boolean throwEx) {
+        return Optional.empty();
+    }
+
+    @Override
+    public Map<String, Object> getMap(Wrapper<YqGHouse> queryWrapper) {
+        return new HashMap<>();
+    }
+
+    @Override
+    public <V> V getObj(Wrapper<YqGHouse> queryWrapper, Function<? super Object, V> mapper) {
+        return null;
+    }
+
+    @Override
+    public BaseMapper<YqGHouse> getBaseMapper() {
+        return null;
+    }
+
+    @Override
+    public Class<YqGHouse> getEntityClass() {
+        return null;
+    }
+}

+ 162 - 0
ruoyi-yiqi/src/main/java/com/ruoyi/yiqi/service/impl/YqGUnitServiceImpl.java

@@ -0,0 +1,162 @@
+package com.ruoyi.yiqi.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.yiqi.entity.YqGUnit;
+import com.ruoyi.yiqi.mapper.YqGUnitMapper;
+import com.ruoyi.yiqi.service.IYqGUnitService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.function.Function;
+
+/**
+ * 单元Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2021-11-15
+ */
+@Service
+public class YqGUnitServiceImpl implements IYqGUnitService {
+
+    @Resource
+    private YqGUnitMapper gUnitMapper;
+
+    private LambdaQueryWrapper<YqGUnit> buildQueryWrapper(YqGUnit bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<YqGUnit> lqw = Wrappers.lambdaQuery();
+        lqw.like(StringUtils.isNotEmpty(bo.getName()), YqGUnit::getName, bo.getName());
+        lqw.eq(bo.getBuildingId() != null, YqGUnit::getBuildingId, bo.getBuildingId());
+        return lqw;
+    }
+
+    @Override
+    public Boolean insertByBo(YqGUnit bo) {
+        YqGUnit add = BeanUtil.toBean(bo, YqGUnit.class);
+        boolean flag = false;
+        Long count = gUnitMapper.checkDataList(bo);
+        if (count == 0) {
+            flag = save(add);
+            if (flag) {
+                bo.setId(add.getId());
+            }
+        }
+
+        return flag;
+    }
+
+    @Override
+    public Boolean updateByBo(YqGUnit bo) {
+        YqGUnit update = BeanUtil.toBean(bo, YqGUnit.class);
+        validEntityBeforeSave(update);
+        return updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(YqGUnit entity) {
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if (isValid) {
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return removeByIds(ids);
+    }
+
+    @Override
+    public TableDataInfo<YqGUnit> getList(YqGUnit bo) {
+        Page<YqGUnit> page = new Page<>(bo.getPageNum(), bo.getPageSize());
+        Page<YqGUnit> list = gUnitMapper.getList(bo, page);
+        return PageUtils.buildDataInfo(list);
+    }
+
+    @Override
+    public YqGUnit getById(Long id) {
+        return gUnitMapper.getById(id);
+    }
+
+    @Override
+    public List<YqGUnit> getUnit(Long buildingId) {
+        return gUnitMapper.getUnit(buildingId);
+    }
+
+    @Override
+    public YqGUnit queryById(Long id) {
+        return null;
+    }
+
+    @Override
+    public TableDataInfo<YqGUnit> queryPageList(YqGUnit bo) {
+        return null;
+    }
+
+    @Override
+    public List<YqGUnit> queryList(YqGUnit bo) {
+        return new ArrayList<>();
+    }
+
+    @Override
+    public boolean saveBatch(Collection<YqGUnit> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean saveOrUpdateBatch(Collection<YqGUnit> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean updateBatchById(Collection<YqGUnit> entityList, int batchSize) {
+        return false;
+    }
+
+    @Override
+    public boolean saveOrUpdate(YqGUnit entity) {
+        return false;
+    }
+
+    @Override
+    public YqGUnit getOne(Wrapper<YqGUnit> queryWrapper, boolean throwEx) {
+        return null;
+    }
+
+    @Override
+    public Optional<YqGUnit> getOneOpt(Wrapper<YqGUnit> queryWrapper, boolean throwEx) {
+        return Optional.empty();
+    }
+
+    @Override
+    public Map<String, Object> getMap(Wrapper<YqGUnit> queryWrapper) {
+        return new HashMap<>();
+    }
+
+    @Override
+    public <V> V getObj(Wrapper<YqGUnit> queryWrapper, Function<? super Object, V> mapper) {
+        return null;
+    }
+
+    @Override
+    public BaseMapper<YqGUnit> getBaseMapper() {
+        return null;
+    }
+
+    @Override
+    public Class<YqGUnit> getEntityClass() {
+        return null;
+    }
+}

+ 237 - 0
ruoyi-yiqi/src/main/resources/mapper/YqGAreaMapper.xml

@@ -0,0 +1,237 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.yiqi.mapper.YqGAreaMapper">
+    <resultMap type="com.ruoyi.yiqi.entity.YqGArea" id="GAreaResult">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="userId" column="user_id"/>
+        <result property="releaseIs" column="release_is"/>
+        <result property="releaseBy" column="release_by"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="district" column="district"/>
+        <result property="calculateDistrictId" column="calculate_district_id"/>
+        <result property="calculateDistrictName" column="calculate_district_name"/>
+        <result property="areaSize" column="area_size"/>
+        <result property="affiliatedPackage" column="affiliated_package"/>
+    </resultMap>
+    <select id="getList" resultType="com.ruoyi.yiqi.entity.YqGArea">
+        select a.id as id,
+        a.name as name,
+        (select b.name from yq_g_user b where b.id = a.user_id) as userName,
+        a.release_is as releaseIs,
+        a.calculate_district_id as calculateDistrictId,
+        a.calculate_district_name as calculateDistrictName,
+        a.area_size as areaSize,
+        a.affiliated_package as affiliatedPackage,
+        a.district as district
+        from yq_g_area a
+        <where>
+            a.del_flag = '0'
+            <if test="p.name != null  and p.name != ''">
+                and a.name LIKE CONCAT('%',#{p.name},'%')
+            </if>
+            <if test="p.userId != null  and p.userId != ''">
+                and a.user_id = #{p.userId}
+            </if>
+            <if test="p.district != null  and p.district != ''">
+                and a.district = #{p.district}
+            </if>
+            <if test="p.calculateDistrictId != null  and p.calculateDistrictId != ''">
+                and a.calculate_district_id = #{p.calculateDistrictId}
+            </if>
+        </where>
+    </select>
+    <select id="getArea" resultType="com.ruoyi.yiqi.entity.YqGArea">
+        select id   as id,
+               name as name
+        from yq_g_area
+        where del_flag = '0'
+    </select>
+    <select id="getHouse" resultType="java.lang.Integer">
+        select count(a.id)
+        from yq_g_house a
+                     left join yq_g_unit b on (a.unit_id = b.id  and b.del_flag = '0')
+                     left join yq_g_building c on (b.building_id = c.id  and c.del_flag = '0')
+                     left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
+        where
+           a.del_flag = '0'  and  d.id = #{id}
+    </select>
+    <select id="getExamineArea" resultType="com.ruoyi.yiqi.entity.GCensusVo">
+        select count( o.house_id) as value,
+        o.examine_status as name
+        from yq_g_order o
+        left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
+        left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
+        left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
+        left join yq_g_area d on (c.area_id = d.id  and d.del_flag = '0')
+        where o.order_status = '002'
+        and o.service_type = '002'
+        and o.del_flag = '0'
+        <if test="areaId != null  and areaId != ''">
+            and d.id = #{areaId}
+        </if>
+        group by name
+    </select>
+    <select id="getExamineServe" resultType="com.ruoyi.yiqi.entity.GCensusVo">
+        select count( o.id) as value,
+        o.service_type as name
+        from yq_g_order o
+        left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
+        left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
+        left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
+        left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
+        where o.del_flag = '0'
+        and o.service_type = ''
+        or o.service_type = '001'
+        or o.service_type = '002'
+        or o.service_type = '003'
+        <if test="id != null  and id != ''">
+            and d.id = #{id}
+        </if>
+        group by o.service_type
+    </select>
+    <select id="getExportList" resultType="com.ruoyi.yiqi.entity.GExportVo">
+        select a.id   as id,
+               d.name as areaName,
+               c.name as buildName,
+               b.name as unitName,
+               d.calculate_district_name as calculateDistrictName,
+               d.area_size as areaSize,
+               d.affiliated_package as affiliatedPackage,
+               a.name as houseName
+        from yq_g_area d
+                 left join yq_g_building c on (d.id = c.area_id and c.del_flag = '0')
+                 left join yq_g_unit b on (c.id = b.building_id and b.del_flag = '0')
+                 left join  yq_g_house a on (b.id = a.unit_id and a.del_flag = '0')
+        where d.del_flag = '0'
+    </select>
+    <select id="getExport" resultType="com.ruoyi.yiqi.entity.GExportsVo">
+        SELECT a.name                  AS areaName,
+               a.district              AS district,
+               a.calculate_district_id AS calculateDistrictName,
+               a.area_size             AS areaSize,
+               a.affiliated_package    AS affiliatedPackage,
+               COUNT(b.area_id) AS count
+        FROM yq_g_area a
+            LEFT JOIN yq_g_order b ON (b.area_id = a.id AND b.del_flag = '0')
+        WHERE a.del_flag = '0'
+          AND a.calculate_district_id = #{calculateDistrictId}
+          AND a.affiliated_package = #{affiliatedPackage}
+        GROUP BY b.area_id
+
+    </select>
+    <select id="getDictNameOfAffiliatedPackage" resultType="string">
+        SELECT
+            CONCAT(a.dict_label,'-工程任务单(',b.dict_label,')') AS name
+        FROM `yq_sys_dict_data` a
+                 LEFT JOIN yq_sys_dict_data b ON (b.dict_type = 'affiliated_package' AND b.dict_value = #{affiliatedPackage})
+        WHERE a.dict_type = 'district' AND a.dict_value = #{calculateDistrictId}
+    </select>
+    <select id="getByName" resultType="com.ruoyi.yiqi.entity.YqGArea">
+        select * from yq_g_area
+        where name = #{name}
+        and del_flag = '0'
+    </select>
+    <select id="getConform" resultType="com.ruoyi.yiqi.entity.GCensusVo">
+        select count( o.house_id) as value,
+        o.service_type as name
+        from yq_g_order o
+        left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
+        left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
+        left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
+        left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
+        where o.del_flag = '0'
+        and o.service_type = '002' or o.service_type = '003' or o.service_type = ''
+        <if test="areaId != null  and areaId != ''">
+            and d.id = #{areaId}
+        </if>
+        group by name
+    </select>
+    <select id="getInConform" resultType="java.lang.Integer">
+        select count( o.house_id)
+        from yq_g_order o
+        left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
+        left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
+        left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
+        left join yq_g_area d on (c.area_id = d.id  and d.del_flag = '0')
+        where o.service_type = '003'
+        and o.del_flag = '0'
+        <if test="areaId != null  and areaId != ''">
+            and d.id = #{areaId}
+        </if>
+    </select>
+    <select id="getHouseCount" resultType="java.lang.Integer">
+        select count( a.id)
+        from yq_g_house a
+        left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
+        left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
+        left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
+        where a.del_flag = '0'
+        <if test="areaId != null  and areaId != ''">
+            and d.id = #{areaId}
+        </if>
+    </select>
+    <select id="getForName" resultType="com.ruoyi.yiqi.entity.YqGArea">
+        select * from yq_g_area
+        where name = #{name}
+        and del_flag = '0'
+        <if test="id != null  and id!= ''">
+            and id != #{id}
+        </if>
+        limit 1
+    </select>
+    <select id="getPhoto" resultType="java.lang.String">
+        select a.pic_url
+        from yq_g_order_photo a
+                     left join yq_g_order b on (a.order_id = b.id and b.service_type = '002' and b.examine_status = '001')
+                     left join yq_g_house c on b.house_id = c.id
+                     left join yq_g_unit d on c.unit_id = d.id
+                     left join yq_g_building e on d.building_id=e.id
+                     left join yq_g_area f on e.area_id = f.id
+        where f.id = #{id}
+    </select>
+    <select id="getAllHouse" resultType="com.ruoyi.yiqi.entity.GAreaExportVo">
+        select b.id as id,
+                CONCAT(e.name,'-',d.name,'-',c.name,'-',b.name) as houseName
+        FROM
+            yq_g_house b
+                LEFT JOIN yq_g_unit c ON  b.unit_id = c.id
+                LEFT JOIN yq_g_building d ON  c.building_id = d.id
+                LEFT JOIN yq_g_area e ON  d.area_id = e.id
+        WHERE
+            b.del_flag = '0'
+          AND c.del_flag = '0'
+          AND d.del_flag = '0'
+          AND e.del_flag = '0'
+          AND e.id = #{areaId}
+    </select>
+    <select id="getOrderHouse" resultType="com.ruoyi.yiqi.entity.GAreaExportVo">
+        select a.house_id as id,
+               CONCAT(e.name,'-',d.name,'-',c.name,'-',b.name) as houseName
+        from yq_g_order a
+                     left join yq_g_house b on (a.house_id = b.id and b.del_flag = '0')
+                     left join yq_g_unit c on (b.unit_id = c.id and c.del_flag = '0')
+                     left join yq_g_building d on (c.building_id = d.id and d.del_flag = '0')
+                     left join yq_g_area e on (d.area_id = e.id  and e.del_flag = '0')
+        where
+         a.del_flag = '0'
+        and a.service_type = '002'
+        and a.examine_status = '001'
+        and e.id = #{areaId}
+    </select>
+
+    <select id="checkDataList" resultType="java.lang.Long">
+        select IFNULL(count(d.id) ,0) AS OrderAverage
+        from yq_g_area d
+        where
+        d.del_flag = '0'
+        and d.name = #{p.name}
+
+    </select>
+</mapper>

+ 60 - 0
ruoyi-yiqi/src/main/resources/mapper/YqGBuildingMapper.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.yiqi.mapper.YqGBuildingMapper">
+
+    <resultMap type="com.ruoyi.yiqi.entity.YqGBuilding" id="GBuildingResult">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="areaId" column="area_id"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+    <select id="getList" resultType="com.ruoyi.yiqi.entity.YqGBuilding">
+        select a.id as id,
+        a.name as name,
+        (select b.name from yq_g_area b where b.id = a.area_id) as areaName
+        from yq_g_building a
+        <where>
+            a.del_flag = '0'
+            <if test="p.name != null  and p.name != ''">
+                and a.name LIKE CONCAT('%',#{p.name},'%')
+            </if>
+            <if test="p.areaId != null  and p.areaId != ''">
+                and a.area_id = #{p.areaId}
+            </if>
+        </where>
+    </select>
+    <select id="getBuilding" resultType="com.ruoyi.yiqi.entity.YqGBuilding">
+        select id   as id,
+               name as name
+        from yq_g_building
+        where area_id = #{areaId} and del_flag = '0'
+    </select>
+    <select id="getByName" resultType="com.ruoyi.yiqi.entity.YqGBuilding">
+        select * from yq_g_building
+        where name = #{name} and area_id = #{areaId}
+          and del_flag = '0'
+          order by id
+          LIMIT 1
+    </select>
+    <select id="getByNameList" resultType="com.ruoyi.yiqi.entity.YqGBuilding">
+        select * from yq_g_building
+        where name = #{name} and area_id = #{areaId}
+          and del_flag = '0'
+    </select>
+
+    <select id="checkDataList" resultType="java.lang.Long">
+        select IFNULL(count(c.id) ,0) AS OrderAverage
+        from  g_building c
+        left join yq_g_area d on c.area_id = d.id
+        where
+        c.del_flag = '0'
+        and c.name = #{p.name}
+        and c.area_id = #{p.areaId}
+    </select>
+</mapper>

+ 101 - 0
ruoyi-yiqi/src/main/resources/mapper/YqGHouseMapper.xml

@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.yiqi.mapper.YqGHouseMapper">
+    <resultMap type="com.ruoyi.yiqi.entity.YqGHouse" id="GHouseResult">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="unitId" column="unit_id"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <select id="getList" resultType="com.ruoyi.yiqi.entity.YqGHouse">
+        select a.id as id,
+        a.name as name,
+        b.name as unitName,
+        c.name as buildingName,
+        d.name as areaName
+        from yq_g_house a
+        left join yq_g_unit b on a.unit_id = b.id
+        left join yq_g_building c on b.building_id = c.id
+        left join yq_g_area d on c.area_id = d.id
+        <where>
+            a.del_flag = '0'
+            <if test="p.name != null  and p.name != ''">
+                and a.name LIKE CONCAT('%',#{p.name},'%')
+            </if>
+            <if test="p.areaId != null  and p.areaId != ''">
+                and c.area_id= #{p.areaId}
+            </if>
+            <if test="p.buildingId != null  and p.buildingId != ''">
+                and b.building_id = #{p.buildingId}
+            </if>
+            <if test="p.unitId != null  and p.unitId != ''">
+                and a.unit_id = #{p.unitId}
+            </if>
+        </where>
+    </select>
+    <select id="getById" resultType="com.ruoyi.yiqi.entity.YqGHouse">
+        select *
+        from yq_g_house a
+                     left join g_unit b on a.unit_id = b.id
+                     left join g_building c on b.building_id = c.id
+        where a.id = #{id}
+          and a.del_flag = '0'
+    </select>
+    <select id="getHouse" resultType="com.ruoyi.yiqi.entity.YqGHouse">
+        SELECT a.id   AS id,
+               a.NAME AS NAME
+        FROM yq_g_house a
+        WHERE a.unit_id = #{unitId}
+          AND a.del_flag = '0'
+<!--          AND a.id NOT IN (-->
+<!--                SELECT b.house_id-->
+<!--                FROM g_order b-->
+<!--                WHERE b.del_flag = '0'-->
+<!--                  and b.house_id = a.id-->
+<!--                  AND ((b.order_status = '001' and b.service_type!='001') or (b.examine_status = '001')))-->
+    </select>
+    <select id="getByName" resultType="com.ruoyi.yiqi.entity.YqGHouse">
+        select *
+        from yq_g_house
+        where name = #{name}
+          and unit_id = #{unitId}
+          and del_flag = '0'
+          order by id
+          LIMIT 1
+    </select>
+    <select id="getByNameList" resultType="com.ruoyi.yiqi.entity.YqGHouse">
+        select *
+        from yq_g_house
+        where name = #{name}
+          and unit_id = #{unitId}
+          and del_flag = '0'
+    </select>
+    <select id="checkDataList" resultType="java.lang.Long">
+        select IFNULL(count(a.id) ,0) AS OrderAverage
+        from yq_g_house a
+        left join yq_g_unit b on a.unit_id = b.id
+        left join yq_g_building c on b.building_id = c.id
+        left join yq_g_area d on c.area_id = d.id
+        where
+        a.del_flag = '0'
+
+        and a.name = #{p.name}
+
+        and c.area_id= #{p.areaId}
+
+        and b.building_id = #{p.buildingId}
+
+        and a.unit_id = #{p.unitId}
+
+    </select>
+    <update id="updateDelFlagById" parameterType="java.lang.Long">
+        update yq_g_house set del_flag = '2' where id=#{id}
+    </update>
+</mapper>

+ 76 - 0
ruoyi-yiqi/src/main/resources/mapper/YqGUnitMapper.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.yiqi.mapper.YqGUnitMapper">
+
+    <resultMap type="com.ruoyi.yiqi.entity.YqGUnit" id="GUnitResult">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="buildingId" column="building_id"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+    <select id="getList" resultType="com.ruoyi.yiqi.entity.YqGUnit">
+        select a.id as id,
+        a.name as name,
+        b.name as buildingName,
+        c.name as areaName
+        from yq_g_unit a
+        left join yq_g_building b on a.building_id = b.id
+        left join yq_g_area c on b.area_id = c.id
+        <where>
+            a.del_flag = '0'
+            <if test="p.name != null  and p.name != ''">
+                and a.name LIKE CONCAT('%',#{p.name},'%')
+            </if>
+            <if test="p.areaId != null  and p.areaId != ''">
+                and  b.area_id= #{p.areaId}
+            </if>
+            <if test="p.buildingId != null  and p.buildingId != ''">
+                and a.building_id = #{p.buildingId}
+            </if>
+        </where>
+    </select>
+    <select id="getById" resultType="com.ruoyi.yiqi.entity.YqGUnit">
+        select * from yq_g_unit a
+        left join yq_g_building b on a.building_id = b.id
+        where a.id = #{id} and a.del_flag = '0'
+    </select>
+    <select id="getUnit" resultType="com.ruoyi.yiqi.entity.YqGUnit">
+        select id   as id,
+               name as name
+        from yq_g_unit
+        where building_id = #{buildingId} and del_flag = '0'
+    </select>
+    <select id="getByName" resultType="com.ruoyi.yiqi.entity.YqGUnit">
+        select * from yq_g_unit
+        where name = #{name} and building_id = #{buildingId}
+          and del_flag = '0'
+          order by id
+          LIMIT 1
+    </select>
+    <select id="getByNameList" resultType="com.ruoyi.yiqi.entity.YqGUnit">
+        select * from yq_g_unit
+        where name = #{name} and building_id = #{buildingId}
+          and del_flag = '0'
+    </select>
+    <select id="checkDataList" resultType="java.lang.Long">
+        select IFNULL(count(b.id) ,0) AS OrderAverage
+        from yq_g_unit b
+        left join yq_g_building c on b.building_id = c.id
+        left join yq_g_area d on c.area_id = d.id
+        where
+        b.del_flag = '0'
+
+        and b.name = #{p.name}
+
+        and c.area_id= #{p.areaId}
+
+        and b.building_id = #{p.buildingId}
+
+    </select>
+</mapper>