Просмотр исходного кода

Merge branch 'master' of https://gitee.com/antai-wuliu/ANTAI-API

dengpan 1 год назад
Родитель
Сommit
ca147b56cb

+ 12 - 0
pom.xml

@@ -157,6 +157,18 @@
             <artifactId>poi-ooxml-schemas</artifactId>
             <version>3.17</version>
         </dependency>
+        <!--EasyExcel相关依赖-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.0.5</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
 
         <dependency>
             <groupId>fr.opensagres.xdocreport</groupId>

+ 14 - 0
src/main/java/com/steerinfo/dil/annotaion/EnableExport.java

@@ -0,0 +1,14 @@
+package com.steerinfo.dil.annotaion;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+/**
+ * 设置允许导出
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EnableExport {
+    String fileName();
+}

+ 16 - 0
src/main/java/com/steerinfo/dil/annotaion/EnableExportField.java

@@ -0,0 +1,16 @@
+package com.steerinfo.dil.annotaion;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+/**
+ * 设置该字段允许导出
+ * 并且可以设置宽度
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EnableExportField {
+    int colWidth() default 100;
+    String colName();
+}

+ 15 - 0
src/main/java/com/steerinfo/dil/annotaion/ImportIndex.java

@@ -0,0 +1,15 @@
+package com.steerinfo.dil.annotaion;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 导入时索引
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ImportIndex {
+    int index() ;
+}

+ 26 - 0
src/main/java/com/steerinfo/dil/controller/BackgroundProcessingController.java

@@ -106,5 +106,31 @@ public class BackgroundProcessingController extends BaseRESTfulController {
     }
 
 
+    @ApiOperation("重置密码")
+    @PostMapping("/resetPwd")
+    public RESTfulResult  resetPwd(@RequestBody Map<String,Object> map) {
+        try {
+            if(map.get("ssoId") == null || map.get("ssoId").equals("")){
+                throw new Exception("用户账号不存在,请先联系管理员注册!");
+            }
+            return success(ssoUtil.resetPwd(map.get("ssoId").toString(),map.get("ssoCode").toString()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return  failed(map,e.getMessage());
+        }
+    }
 
+    @ApiOperation("解锁用户")
+    @PostMapping("/unlockUser")
+    public RESTfulResult  unlockUser(@RequestBody Map<String,Object> map) {
+        try {
+            if(map.get("ssoId") == null || map.get("ssoId").equals("")){
+                throw new Exception("用户账号不存在,请先联系管理员注册!");
+            }
+            return success(ssoUtil.unlockUser(map.get("ssoId").toString(),map.get("ssoCode").toString()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return  failed(map,e.getMessage());
+        }
+    }
 }

+ 11 - 4
src/main/java/com/steerinfo/dil/controller/SystemFileController.java

@@ -25,10 +25,7 @@ import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import java.awt.*;
 import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.math.BigDecimal;
@@ -425,4 +422,14 @@ public class SystemFileController extends BaseRESTfulController {
     //
     //    return watermarkedStream;
     //}
+    //读取文件
+    @PostMapping("/readExcel")
+    public RESTfulResult readExcel(@RequestParam String path) {
+        File file = new File(path);
+
+        return success();
+    }
+
+
+
 }

+ 41 - 8
src/main/java/com/steerinfo/dil/controller/UniversalController.java

@@ -1,16 +1,17 @@
 package com.steerinfo.dil.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.google.common.collect.Maps;
 import com.steerinfo.dil.config.ImageFileUtils;
 import com.steerinfo.dil.mapper.UniversalMapper;
 import com.steerinfo.dil.service.impl.UniversalServiceImpl;
-import com.steerinfo.dil.util.BaseRESTfulController;
-import com.steerinfo.dil.util.ColumnDataUtil;
-import com.steerinfo.dil.util.DataChange;
-import com.steerinfo.dil.util.PageListAdd;
+import com.steerinfo.dil.util.*;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
 import io.swagger.annotations.*;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -22,14 +23,16 @@ import org.springframework.web.multipart.MultipartRequest;
 
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.OutputStream;
+import java.io.*;
 import java.math.BigDecimal;
 import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
+import static com.steerinfo.dil.util.EasyExcelUitl.exportExcelFile;
+import static com.steerinfo.dil.util.HTTPRequestUtils.getJsonData;
+import static com.steerinfo.dil.util.HTTPRequestUtils.sendPost;
+
 /**
  * @ author    :TXF
  * @ time      :2021/10/19 18:06
@@ -339,4 +342,34 @@ public class UniversalController extends BaseRESTfulController {
         return success(universalMapper.getRequireByLike(map));
     }
 
+
+    @ApiOperation("通用导出")
+    @PostMapping("/excleExport")
+    public RESTfulResult excleExport(@RequestBody Map<String,Object> map) throws IOException {
+        JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(map));
+        jsonObject.putAll( JSONObject.parseObject(JSONObject.toJSONString(map.get("requestQuery"))));
+        String url  =  "http://172.16.90.202:80"+map.get("requestUrl").toString() + "&pageNum=1&pageSize=10000";
+        JSONObject json = HttpUtil.sendPost(url,jsonObject);
+        Map<String, Object> data = (Map<String, Object>) json.get("data");
+        String listStr = data.get("list").toString();
+        String columnDataStr=data.get("columnData").toString();
+        List<Map<String,Object>> listMap = JSON.parseObject(listStr,new TypeReference<List<Map<String,Object>>>(){});
+        List<Map<String,Object>> columnData = JSON.parseObject(columnDataStr,new TypeReference<List<Map<String,Object>>>(){});
+        LinkedHashMap<String, String> columnMaps = Maps.newLinkedHashMap();
+        for (int i = 0; i <columnData.size() ; i++) {
+            columnMaps.put(columnData.get(i).get("prop").toString(),columnData.get(i).get("label").toString());
+        }
+        byte[] stream1 = exportExcelFile(columnMaps, listMap);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String path = "/data/file/"+  map.get("userName") + "-" + simpleDateFormat.format(new Date()) + "-" + map.get("exclename").toString() + ".xlsx";
+        FileOutputStream outputStream1 = new FileOutputStream(new File(path));
+        outputStream1.write(stream1);
+        outputStream1.flush();
+        outputStream1.close();
+        Map<String, Object> response = new HashMap<>();
+        response.put("fileName",map.get("userName") + "-" + simpleDateFormat.format(new Date()) + "-" + map.get("exclename").toString() + ".xlsx");
+        response.put("filePath",path);
+        return success(response);
+    }
+
 }

+ 25 - 0
src/main/java/com/steerinfo/dil/feign/SSOFeign.java

@@ -49,6 +49,31 @@ public interface SSOFeign {
     JSONObject deleteUser(@RequestHeader("Authorization") String token,
                           @PathVariable String userId);
 
+
+    @PutMapping("/v1/sysusers/resetPassword/{userId}")
+    JSONObject resetPassword(@RequestHeader("Authorization") String token,
+                       @PathVariable String userId,
+                       @RequestParam String password,
+                       @RequestBody(required = true) Map<String,Object> map);
+
+    @PutMapping("/v1/sysuserlogins/resetLoginInfo/{userCode}")
+    JSONObject resetLoginInfo(@RequestHeader("Authorization") String token,
+                             @PathVariable String userCode);
+
+    /**
+     * 激活账号
+     * @param token
+     * @param userId
+     * @param status 1-启用
+     * @param loginStatus 1-激活
+     * @return
+     */
+    @PostMapping("/v1/sysusers/updateUser/{userId}")
+    JSONObject reActive(@RequestHeader("Authorization") String token,
+                              @PathVariable String userId,
+                              @RequestParam(defaultValue = "1") String status,
+                              @RequestParam(defaultValue = "1") String loginStatus);
+
     @GetMapping("/v1/sysroles/getRolesUser")
     JSONObject getRolesUser(@RequestHeader("Authorization") String token,
                        @RequestParam String companyId);

+ 138 - 0
src/main/java/com/steerinfo/dil/util/EasyExcelUitl.java

@@ -0,0 +1,138 @@
+package com.steerinfo.dil.util;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.beust.jcommander.internal.Lists;
+import com.itextpdf.text.log.Logger;
+import com.itextpdf.text.log.LoggerFactory;
+import com.steerinfo.framework.utils.collection.MapUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class EasyExcelUitl {
+    private static final Logger log = LoggerFactory.getLogger(EasyExcelUitl.class);
+
+    private static final String DEFAULT_SHEET_NAME = "sheet1";
+
+
+    /**
+     * 生成文件
+     * @param excelHead
+     * @param excelRows
+     * @return
+     */
+    private static byte[] createExcelFile(List<List<String>> excelHead, List<List<Object>> excelRows){
+        try {
+            if(CollectionUtils.isNotEmpty(excelHead)){
+                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+                EasyExcel.write(outputStream).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                        .head(excelHead)
+                        .sheet(DEFAULT_SHEET_NAME)
+                        .doWrite(excelRows);
+                return outputStream.toByteArray();
+            }
+        } catch (Exception e) {
+            log.error("动态生成excel文件失败,headColumns:" + JSONArray.toJSONString(excelHead) + ",excelRows:" + JSONArray.toJSONString(excelRows), e);
+        }
+        return null;
+    }
+    /**
+     * 生成文件(自定义头部排列)
+     * @param rowHeads
+     * @param excelRows
+     * @return
+     */
+    public static byte[] customerExportExcelFile(List<List<String>> rowHeads, List<List<Object>> excelRows){
+        //将行头部转成easyexcel能识别的部分
+        List<List<String>> excelHead = transferHead(rowHeads);
+        return createExcelFile(excelHead, excelRows);
+    }
+
+
+    /**
+     * 动态生成导出模版(单表头)
+     * @param headColumns 列名称
+     * @return            excel文件流
+     */
+    public static byte[] exportTemplateExcelFile(List<String> headColumns){
+        List<List<String>> excelHead = Lists.newArrayList();
+        headColumns.forEach(columnName -> { excelHead.add(Lists.newArrayList(columnName)); });
+        byte[] stream = createExcelFile(excelHead, new ArrayList<>());
+        return stream;
+    }
+
+    /**
+     * 动态生成模版(复杂表头)
+     * @param excelHead   列名称
+     * @return
+     */
+    public static byte[] exportTemplateExcelFileCustomHead(List<List<String>> excelHead){
+        byte[] stream = createExcelFile(excelHead, new ArrayList<>());
+        return stream;
+    }
+
+    /**
+     * 将行头部转成easyexcel能识别的部分
+     * @param rowHeads
+     * @return
+     */
+    public static List<List<String>> transferHead(List<List<String>> rowHeads){
+        //将头部列进行反转
+        List<List<String>> realHead = new ArrayList<>();
+        if(CollectionUtils.isNotEmpty(rowHeads)){
+            Map<Integer, List<String>> cellMap = new LinkedHashMap<>();
+            //遍历行
+            for (List<String> cells : rowHeads) {
+                //遍历列
+                for (int i = 0; i < cells.size(); i++) {
+                    if(cellMap.containsKey(i)){
+                        cellMap.get(i).add(cells.get(i));
+                    } else {
+                        cellMap.put(i, Lists.newArrayList(cells.get(i)));
+                    }
+                }
+            }
+            //将列一行一行加入realHead
+            cellMap.entrySet().forEach(item -> realHead.add(item.getValue()));
+        }
+        return realHead;
+    }
+
+    /**
+     * 动态导出文件(通过map方式计算)
+     * @param headColumnMap  有序列头部
+     * @param dataList       数据体
+     * @return
+     */
+    public static byte[] exportExcelFile(LinkedHashMap<String, String> headColumnMap, List<Map<String, Object>> dataList){
+        //获取列名称
+        List<List<String>> excelHead = new ArrayList<>();
+        if(MapUtils.isNotEmpty(headColumnMap)){
+            //key为匹配符,value为列名,如果多级列名用逗号隔开
+            headColumnMap.entrySet().forEach(entry -> {
+                excelHead.add(Lists.newArrayList(entry.getValue().split(",")));
+            });
+        }
+        List<List<Object>> excelRows = new ArrayList<>();
+        if(MapUtils.isNotEmpty(headColumnMap) && CollectionUtils.isNotEmpty(dataList)){
+            for (Map<String, Object> dataMap : dataList) {
+                List<Object> rows = new ArrayList<>();
+                headColumnMap.entrySet().forEach(headColumnEntry -> {
+                    if(dataMap.containsKey(headColumnEntry.getKey())){
+                        Object data = dataMap.get(headColumnEntry.getKey());
+                        rows.add(data);
+                    }
+                });
+                excelRows.add(rows);
+            }
+        }
+        byte[] stream = createExcelFile(excelHead, excelRows);
+        return stream;
+    }
+}

+ 65 - 2
src/main/java/com/steerinfo/dil/util/HTTPRequestUtils.java

@@ -15,6 +15,7 @@ import org.apache.http.util.EntityUtils;
 import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.net.URLConnection;
 
 public class HTTPRequestUtils {
     /**
@@ -85,7 +86,7 @@ public class HTTPRequestUtils {
             // 设置文件长度
             conn.setRequestProperty("Content-Length", String.valueOf(data.length));
             // 设置文件类型:
-            conn.setRequestProperty("contentType", "application/json");
+            conn.setRequestProperty("Content-Type", "application/json");
             // 开始连接请求
             conn.connect();
             OutputStream out = new DataOutputStream(conn.getOutputStream()) ;
@@ -116,11 +117,73 @@ public class HTTPRequestUtils {
                 System.out.println("error++");
             }
         } catch (Exception e) {
-
+            e.printStackTrace();
         }
         return sb.toString();
 
     }
 
+    /**
+     * 向指定 URL 发送POST方法的请求
+     *
+     * @param url
+     *            发送请求的 URL
+     * @param param
+     *            请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
+     * @return 所代表远程资源的响应结果
+     */
+    public static String sendPost(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("charsert", "utf-8");
+            conn.setRequestProperty("Content-Type", "application/json");
+//            conn.setRequestProperty("user-agent",
+//                    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            // 发送请求参数
+            out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 POST 请求出现异常!"+e);
+            e.printStackTrace();
+        }
+        //使用finally块来关闭输出流、输入流
+        finally{
+            try{
+                if(out!=null){
+                    out.close();
+                }
+                if(in!=null){
+                    in.close();
+                }
+            }
+            catch(IOException ex){
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+
 
 }

+ 124 - 0
src/main/java/com/steerinfo/dil/util/HttpUtil.java

@@ -0,0 +1,124 @@
+package com.steerinfo.dil.util;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.*;
+import org.apache.commons.httpclient.params.HttpMethodParams;
+
+import java.io.IOException;
+
+public class HttpUtil {
+    public static JSONObject post(PostMethod postMethod, int connectTimeout, int socketTimeout) throws Exception {
+        // 创建httpClient实例对象
+        HttpClient httpClient = new HttpClient();
+        // 设置httpClient连接主机服务器超时时间
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectTimeout);
+        // 设置socket.timeout时间
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(socketTimeout);
+        if(postMethod.getRequestHeader("Content-Type") == null){
+            postMethod.addRequestHeader("Content-Type", "application/json;charset=utf-8");
+        }
+        httpClient.executeMethod(postMethod);
+        String result = postMethod.getResponseBodyAsString();
+        postMethod.releaseConnection();//释放连接
+        return JSONObject.parseObject(result);
+    }
+
+    public static JSONObject delete(DeleteMethod deleteMethod, int connectTimeout, int socketTimeout) throws Exception {
+        HttpClient httpClient = new HttpClient();
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectTimeout);
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(socketTimeout);
+        if(deleteMethod.getRequestHeader("Content-Type") == null){
+            deleteMethod.addRequestHeader("Content-Type", "application/json;charset=utf-8");
+        }
+        httpClient.executeMethod(deleteMethod);
+        String result = deleteMethod.getResponseBodyAsString();
+        deleteMethod.releaseConnection();//释放连接
+        return JSONObject.parseObject(result);
+    }
+
+
+    public static JSONObject sendPost(String url,JSONObject param) throws HttpException, IOException {
+        // 创建httpClient实例对象
+        HttpClient httpClient = new HttpClient();
+        // 设置httpClient连接/执行超时时间(ms)
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(1000);
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(15000);
+        // 创建post请求方法实例对象
+        PostMethod postMethod = new PostMethod(url);
+        postMethod.addRequestHeader("Content-Type", "application/json;charset=utf-8");
+        postMethod.setRequestHeader("Cookie","rootCompanyMap=; urlFlag=null; icore.icp-Authorization=zym; icore.icp-username=%E5%BC%A0%E7%A6%B9%E9%93%AD; accessToken=eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJqd3QiLCJpYXQiOjE3MTk0NzY5OTgsInN1YiI6IntcImlkXCI6XCIxMTc5NDU0Nzc0ODMyMTQwMjg4XCIsXCJ1c2VyQ29kZVwiOlwienltXCIsXCJ1c2VyTmFtZVwiOlwi5byg56a56ZOtXCIsXCJwYXNzd29yZFwiOlwiN2M0YThkMDljYTM3NjJhZjYxZTU5NTIwOTQzZGMyNjQ5NGY4OTQxYlwiLFwib3JnQ29kZVwiOlwiMTAwMDBcIn0iLCJpc3MiOiJzdGVlciIsImV4cCI6MTcyMDA4MTc5OH0.GVRWAqphggeKN7f2MeerOkIzBAAFJkHJEKRGEr4dzbs; refreshToken=eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJRT1hZSjdWNFduRWRReWNkRnFndFM3VTVodUVaMlhsb1A1VVRwNFZ2bG5rPSIsImlhdCI6MTcxOTQ3Njk5OCwic3ViIjoiXCIxMTc5NDU0Nzc0ODMyMTQwMjg4XCIiLCJpc3MiOiJzdGVlciIsImV4cCI6MTcyMTI5MTM5OH0.inSO_CsI4-JESCFZbU21T884cmbXGQXyOgobLe7DoNE; orgCode=10000; userId=1179454774832140288; userName=%E5%BC%A0%E7%A6%B9%E9%93%AD; appId=821034072422879232; loginId=1179454774832140288; loginName=zym; roleCodes=%5B%22superadmin%22%2C%22superadminApp%22%5D; dilCompanyList=%5B%5D; JSESSIONID=839C89FB4DBDB193971AFD0F14E8C84A");
+        // 构建参数
+        RequestEntity entity = new StringRequestEntity(param.toJSONString(),"application/json", "UTF-8");
+        postMethod.setRequestEntity(entity);
+        //执行并处理返回
+        httpClient.executeMethod(postMethod);
+        String result = postMethod.getResponseBodyAsString();
+        postMethod.releaseConnection();
+        return JSONObject.parseObject(result);
+    }
+
+    public static JSONObject sendPostObject(String url,JSONObject param,String accessToken) throws HttpException, IOException {
+        // 创建httpClient实例对象
+        HttpClient httpClient = new HttpClient();
+        // 设置httpClient连接/执行超时时间(ms)
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(1000);
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(15000);
+        // 创建post请求方法实例对象
+        PostMethod postMethod = new PostMethod(url);
+        postMethod.addRequestHeader("Content-Type", "application/json;charset=utf-8");
+        // 构建参数
+        postMethod.setRequestHeader("Authorization",accessToken);
+        RequestEntity entity = new StringRequestEntity(param.toJSONString(),"application/json", "UTF-8");
+        postMethod.setRequestEntity(entity);
+        //执行并处理返回
+        httpClient.executeMethod(postMethod);
+        String result = postMethod.getResponseBodyAsString();
+        postMethod.releaseConnection();
+        return JSONObject.parseObject(result);
+    }
+
+    public static JSONObject sendPostArray(String url, JSONArray array,String accessToken) throws HttpException, IOException {
+        // 创建httpClient实例对象
+        HttpClient httpClient = new HttpClient();
+        // 设置httpClient连接/执行超时时间(ms)
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(1000);
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(15000);
+        // 创建post请求方法实例对象
+        PostMethod postMethod = new PostMethod(url);
+        postMethod.addRequestHeader("Content-Type", "application/json;charset=utf-8");
+        // 构建参数
+        postMethod.setRequestHeader("Authorization",accessToken);
+        //postMethod.setRequestHeader("Cookie",accessToken);
+        RequestEntity entity = new StringRequestEntity(array.toJSONString(),"application/json", "UTF-8");
+        postMethod.setRequestEntity(entity);
+        //执行并处理返回
+        httpClient.executeMethod(postMethod);
+        String result = postMethod.getResponseBodyAsString();
+        postMethod.releaseConnection();
+        return JSONObject.parseObject(result);
+    }
+
+    public static String sendGet(String urlParam) throws HttpException, IOException {
+        // 创建httpClient实例对象
+        HttpClient httpClient = new HttpClient();
+        // 设置httpClient连接主机服务器超时时间:15000毫秒
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(15000);
+        // 创建GET请求方法实例对象
+        GetMethod getMethod = new GetMethod(urlParam);
+        // 设置post请求超时时间
+        getMethod.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 60000);
+        getMethod.addRequestHeader("Content-Type", "application/json;charset=utf-8");
+
+        httpClient.executeMethod(getMethod);
+
+        String result = getMethod.getResponseBodyAsString();
+        getMethod.releaseConnection();
+        return result;
+    }
+    public static void main(String[] args) throws HttpException, IOException {
+
+    }
+}

+ 39 - 1
src/main/java/com/steerinfo/dil/util/SSOUtil.java

@@ -41,7 +41,7 @@ public class SSOUtil {
     public  String login(){
         try{
             JSONObject result = ssoFeign.login(userName,password,"web");
-            String token = result.getJSONObject("data").getString("accessToken");
+            String token = "Bearer " + result.getJSONObject("data").getString("accessToken");
             log.debug(token);
             return  token;
         }catch (Exception e){
@@ -141,4 +141,42 @@ public class SSOUtil {
         }
         return new HashMap<>();
     }
+
+    /**
+     * 重置密码
+     * @param userId
+     * @return
+     */
+    public JSONObject resetPwd(String userId,String userCode) throws Exception {
+        String token = login();
+        if(token == null){
+            throw new Exception("登录SSO失败!");
+        }
+        Map<String,Object> params = new HashMap<>();
+        params.put("userId",userId);
+        params.put("password","At123456");
+        //重置密码
+        JSONObject result =  ssoFeign.resetPassword(token,userId,"At123456",params);
+        //解锁用户并激活账号
+        unlockUser(userId,userCode);
+        return result;
+    }
+
+
+    /**
+     * 解锁用户并激活账号
+     * @param userId
+     * @param userCode
+     * @return
+     * @throws Exception
+     */
+    public JSONObject unlockUser(String userId,String userCode) throws Exception {
+        String token = login();
+        if(token == null){
+            throw new Exception("登录SSO失败!");
+        }
+        JSONObject result =  ssoFeign.resetLoginInfo(token,userCode);//解锁用户
+        ssoFeign.reActive(token,userId,"1","1");//激活账户
+        return result;
+    }
 }

+ 6 - 0
src/main/java/com/steerinfo/dil/util/poiutil.java

@@ -1,6 +1,10 @@
 package com.steerinfo.dil.util;
 
 
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.beust.jcommander.internal.Lists;
+import com.google.common.collect.Maps;
+import com.steerinfo.framework.utils.collection.MapUtils;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
@@ -169,4 +173,6 @@ public class poiutil {
     }
 
 
+
+
 }

+ 0 - 11
src/main/java/com/steerinfo/dil/util/test.java

@@ -1,11 +0,0 @@
-package com.steerinfo.dil.util;
-
-import com.steerinfo.framework.utils.misc.IdGenerator;
-
-public class test {
-    public static void main(String[] args) {
-        for(int i=0;i<1000;i++){
-            System.out.println(new IdGenerator(i%31,10).getNextStr());
-        }
-    }
-}

+ 5 - 0
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -973,6 +973,7 @@
         RL.LINE_ID "value",
         RL.LINE_NAME "label",
         RL.LINE_NAME "text",
+        RL.REMARK "lineDesk",
         NVL(RL_TEMP."points",'无') "points",
 
         RL.LINE_TYPE    "lineType",
@@ -1003,6 +1004,9 @@
             <if test="lineType!=null and lineType!=''">
                 AND REGEXP_LIKE("lineType" , #{lineType})
             </if>
+            <if test="lastIndex!=null and lastIndex!=''">
+                AND 1!=1
+            </if>
         </where>
         FETCH NEXT 10 ROWS ONLY
         )
@@ -1015,6 +1019,7 @@
             RL.LINE_ID "value",
             RL.LINE_NAME "label",
             RL.LINE_NAME "text",
+            RL .REMARK "lineDesk",
             NVL(RL_TEMP."points",'无') "points",
             RL.LINE_TYPE    "lineType",
             'lineName' "prop"