Browse Source

导出字典优化

heguanxun 3 months ago
parent
commit
328d81ae17

+ 4 - 0
snowy-plugin/snowy-plugin-biz/pom.xml

@@ -38,5 +38,9 @@
             <groupId>vip.xiaonuo</groupId>
             <artifactId>snowy-plugin-dev-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>vip.xiaonuo</groupId>
+            <artifactId>snowy-plugin-dev</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 71 - 1
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecord/controller/QyRecordController.java

@@ -13,7 +13,11 @@
 package vip.xiaonuo.biz.modular.qyrecord.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.URLUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
@@ -38,6 +42,11 @@ import java.util.List;
 import java.io.IOException;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson.JSON;
+import vip.xiaonuo.dev.modular.dict.entity.DevDict;
+import vip.xiaonuo.dev.modular.dict.param.DevDictListParam;
+import vip.xiaonuo.dev.modular.dict.param.DevDictPageParam;
+import vip.xiaonuo.dev.modular.dict.service.DevDictService;
+
 import java.net.URLEncoder;
 import java.util.HashMap;
 
@@ -54,7 +63,8 @@ public class QyRecordController {
 
     @Resource
     private QyRecordService qyRecordService;
-
+    @Resource
+    private DevDictService devDictService;
     /**
      * 获取企业资质备案分页
      *
@@ -111,6 +121,66 @@ public class QyRecordController {
     public void export(@RequestBody @Valid QyRecordPageParam qyRecordPageParam, HttpServletResponse response) {
         Page<QyRecord> page =  qyRecordService.page(qyRecordPageParam);
         List<QyRecord> records = page.getRecords();
+        if (CollectionUtil.isNotEmpty(records)){
+            records.stream().forEach(item ->{
+                DevDict devDict;
+                String parentId;
+                //单据状态
+                String status = item.getStatus();
+                parentId = "1808713764030787586";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,status));
+                if (devDict != null){
+                    item.setStatus(devDict.getDictLabel());
+                }
+                //申报类型
+                String applyType = item.getApplyType();
+                parentId = "1808704091340812290";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,applyType));
+                if (devDict != null){
+                    item.setApplyType(devDict.getDictLabel());
+                }
+                //备案类型
+                String baType = item.getBaType();
+                parentId = "1808704091340812290";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,baType));
+                if (devDict != null){
+                    item.setBaType(devDict.getDictLabel());
+                }
+                //资质类型
+                String zzType = item.getZzType();
+                parentId = "1808701224940875777";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,zzType));
+                if (devDict != null){
+                    item.setZzType(devDict.getDictLabel());
+                }
+                //享惠类型
+                String applyXhType = item.getApplyXhType();
+                parentId = "1808709469835243522";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,applyXhType));
+                if (devDict != null){
+                    item.setApplyXhType(devDict.getDictLabel());
+                }
+                //企业类型
+                String companyType = item.getCompanyType();
+                parentId = "1808704761401847810";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,companyType));
+                if (devDict != null){
+                    item.setCompanyType(devDict.getDictLabel());
+                }
+            });
+        }
         exportExcel(response,QyRecord.class,records,"企业资质备案");
     }
 

+ 47 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecordinfo/controller/QyRecordInfoController.java

@@ -16,6 +16,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.URLUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -45,6 +46,8 @@ import java.io.IOException;
 
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson.JSON;
+import vip.xiaonuo.dev.modular.dict.entity.DevDict;
+import vip.xiaonuo.dev.modular.dict.service.DevDictService;
 
 import java.net.URLEncoder;
 import java.util.HashMap;
@@ -62,6 +65,8 @@ public class QyRecordInfoController {
 
     @Resource
     private QyRecordInfoService qyRecordInfoService;
+    @Resource
+    private DevDictService devDictService;
 
     /**
      * 获取企业备案信息分页
@@ -158,6 +163,48 @@ public class QyRecordInfoController {
     public void export(@RequestBody @Valid QyRecordInfoPageParam qyRecordInfoPageParam, HttpServletResponse response) {
         Page<QyRecordInfo> page = qyRecordInfoService.page(qyRecordInfoPageParam);
         List<QyRecordInfo> records = page.getRecords();
+        if (CollectionUtil.isNotEmpty(records)) {
+            records.stream().forEach(item -> {
+                DevDict devDict;
+                String parentId;
+                //单据状态
+                String status = item.getStatus();
+                parentId = "1808713764030787586";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue, status));
+                if (devDict != null) {
+                    item.setStatus(devDict.getDictLabel());
+                }
+                //申报类型
+                String applyType = item.getApplyType();
+                parentId = "1808704091340812290";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,applyType));
+                if (devDict != null){
+                    item.setApplyType(devDict.getDictLabel());
+                }
+                //台账性质
+                String tzType = item.getTzType();
+                parentId = "1809412445293973506";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,tzType));
+                if (devDict != null){
+                    item.setTzType(devDict.getDictLabel());
+                }
+                //企业类型
+                String companyType = item.getCompanyType();
+                parentId = "1808704761401847810";
+                devDict = devDictService.getOne(new QueryWrapper<DevDict>().checkSqlInjection().lambda()
+                        .eq(DevDict::getParentId, parentId)
+                        .eq(DevDict::getDictValue,companyType));
+                if (devDict != null){
+                    item.setCompanyType(devDict.getDictLabel());
+                }
+            });
+        }
         exportExcel(response, QyRecordInfo.class, records, "企业备案信息");
     }
 

+ 4 - 0
snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/dict/param/DevDictPageParam.java

@@ -50,6 +50,10 @@ public class DevDictPageParam {
     @Schema(description = "字典分类")
     private String category;
 
+    /** dicValue */
+    @Schema(description = "dicValue")
+    private String dicValue;
+
     /** 字典文字关键词 */
     @Schema(description = "字典文字关键词")
     private String searchKey;