Administrator 1 год назад
Родитель
Сommit
788f1f8535

+ 11 - 2
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/pay/vo/XiaoyuanPayVo.java

@@ -1,7 +1,10 @@
 package org.dromara.system.domain.pay.vo;
 package org.dromara.system.domain.pay.vo;
 
 
+import cn.hutool.json.JSONArray;
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.fastjson2.JSONObject;
+import com.amazonaws.util.json.Jackson;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import io.github.linpeilie.annotations.AutoMapper;
 import io.github.linpeilie.annotations.AutoMapper;
 import lombok.Data;
 import lombok.Data;
@@ -9,6 +12,7 @@ import org.dromara.system.domain.pay.XiaoyuanPay;
 import java.io.Serial;
 import java.io.Serial;
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 
 
@@ -72,10 +76,15 @@ public class XiaoyuanPayVo implements Serializable {
     @ExcelProperty(value = "备注")
     @ExcelProperty(value = "备注")
     private String remark;
     private String remark;
     /**
     /**
-     * 返回 的动态表头数据
+     * 返回的动态表头数据
      */
      */
     @TableField(exist = false)
     @TableField(exist = false)
-    private Map<String,Object> map;
+    private JSONArray tableLabelJA;
+    /**
+     * 返回的动态数据
+     */
+    @TableField(exist = false)
+    private List<JSONObject> tableDataJO;
 
 
 
 
 
 

+ 33 - 9
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/pay/XiaoyuanPayServiceImpl.java

@@ -1,8 +1,12 @@
 package org.dromara.system.service.impl.pay;
 package org.dromara.system.service.impl.pay;
 
 
 import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.gson.JsonArray;
 import org.dromara.common.core.utils.DateUtils;
 import org.dromara.common.core.utils.DateUtils;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.core.utils.StringUtils;
@@ -49,29 +53,49 @@ public class XiaoyuanPayServiceImpl implements IXiaoyuanPayService {
      */
      */
     @Override
     @Override
     public Page<XiaoyuanPayVo> queryPageList(XiaoyuanPayBo bo, PageQuery pageQuery) {
     public Page<XiaoyuanPayVo> queryPageList(XiaoyuanPayBo bo, PageQuery pageQuery) {
-        Map<String,Object> map =new HashMap<>();
+
         LambdaQueryWrapper<XiaoyuanPay> lqw = buildQueryWrapper(bo);
         LambdaQueryWrapper<XiaoyuanPay> lqw = buildQueryWrapper(bo);
         Page<XiaoyuanPayVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
         Page<XiaoyuanPayVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
         //处理的返回值List
         //处理的返回值List
         List<XiaoyuanPayVo> resultList = new ArrayList<>();
         List<XiaoyuanPayVo> resultList = new ArrayList<>();
         XiaoyuanPayVo vo = new XiaoyuanPayVo();
         XiaoyuanPayVo vo = new XiaoyuanPayVo();
         List<XiaoyuanPayVo> records = result.getRecords();
         List<XiaoyuanPayVo> records = result.getRecords();
-        List<String> detailList = new ArrayList<>();
+        List<JSONObject> detailList = new ArrayList<>();
         if (records!= null && records.size()> 0){
         if (records!= null && records.size()> 0){
-            map.put("tableLabel",records.get(0).getTableHead());
             for (XiaoyuanPayVo record : records) {
             for (XiaoyuanPayVo record : records) {
                 String tableDetail = record.getTableDetail();
                 String tableDetail = record.getTableDetail();
-                tableDetail.replace("=",":");
-                detailList.add(tableDetail);
+                Map<String, String> stringMap = mapStringToMap(tableDetail);
+                detailList.add(new JSONObject(stringMap));
             }
             }
-            map.put("tableData",detailList);
+            //vo.setTableLabelJA(JSONUtil.parseArray(records.get(0).getTableHead()));
+            vo.setTableDataJO(detailList);
         }
         }
-        vo.setMap(map);
         resultList.add(vo);
         resultList.add(vo);
         result.setRecords(resultList);
         result.setRecords(resultList);
         return result;
         return result;
     }
     }
 
 
+    /**
+     * 将Map字符串转换为Map
+     *
+     * @param str Map字符串
+     * @return Map
+     */
+    public static Map<String,String> mapStringToMap(String str){
+        str = str.substring(1, str.length()-1);
+        String[] strs = str.split(",");
+        Map<String,String> map = new HashMap<String, String>();
+        for (String string : strs) {
+            String key = string.split("=")[0];
+            String value = string.split("=")[1];
+            // 去掉头部空格
+            String key1 = key.trim();
+            String value1 = value.trim();
+            map.put(key1, value1);
+        }
+        return map;
+    }
+
     /**
     /**
      * 查询教职工工资条列表
      * 查询教职工工资条列表
      */
      */
@@ -143,12 +167,12 @@ public class XiaoyuanPayServiceImpl implements IXiaoyuanPayService {
         //去字典值中匹配学科名称 sys_subject
         //去字典值中匹配学科名称 sys_subject
         List<SysDictDataVo> sysSubject = sysDictTypeService.selectDictDataByType("wages");
         List<SysDictDataVo> sysSubject = sysDictTypeService.selectDictDataByType("wages");
         //工资条所需要的所有表头信息
         //工资条所需要的所有表头信息
-        List<Map <String,Object>> sysDictList = new ArrayList<>();
+        List<JSONObject> sysDictList = new ArrayList<>();
         for (SysDictDataVo sysDictDataVo : sysSubject) {
         for (SysDictDataVo sysDictDataVo : sysSubject) {
             Map <String,Object> sysDictMap = new HashMap<>();
             Map <String,Object> sysDictMap = new HashMap<>();
             sysDictMap.put("label",sysDictDataVo.getDictLabel());
             sysDictMap.put("label",sysDictDataVo.getDictLabel());
             sysDictMap.put("prop",sysDictDataVo.getDictLabel());
             sysDictMap.put("prop",sysDictDataVo.getDictLabel());
-            sysDictList.add(sysDictMap);
+            sysDictList.add(new JSONObject(sysDictMap));
         }
         }
         List<XiaoyuanPayBo> boList = new ArrayList<>();
         List<XiaoyuanPayBo> boList = new ArrayList<>();
         for (Map<String, String> map : maps) {
         for (Map<String, String> map : maps) {