提交修改

This commit is contained in:
quyixiao 2020-12-16 16:16:07 +08:00
commit ecc289d9ac
7 changed files with 144 additions and 20 deletions

View File

@ -40,6 +40,7 @@
<hutool.version>5.2.3</hutool.version>
<lombok.version>1.18.4</lombok.version>
<poi.version>3.17</poi.version>
<jsoupXpath.version>2.2</jsoupXpath.version>
<!--wagon plugin 配置-->
<service-path>/work/linzi</service-path>
<pack-name>${project.artifactId}-${project.version}.jar</pack-name>
@ -255,6 +256,12 @@
<classifier>suibian</classifier>
</dependency>
<dependency>
<groupId>cn.wanghaomiao</groupId>
<artifactId>JsoupXpath</artifactId>
<version>${jsoupXpath.version}</version>
</dependency>
</dependencies>
<build>

View File

@ -324,7 +324,7 @@ public class DingTalkUtil {
departmentStaffBo.setEmail(json.getString("email"));//邮箱钉钉的企业邮箱才可以需要单独授权手机权限
departmentStaffBo.setAvatar(json.getString("avatar"));//头像
departmentStaffBo.setPosition(json.getString("title"));
if(mapProbation.containsKey(departmentStaffBo.getEmployeeId())){
if(mapProbation != null && mapProbation.containsKey(departmentStaffBo.getEmployeeId())){
departmentStaffBo.setEmployeeType(2);
}else{
departmentStaffBo.setEmployeeType(1);

View File

@ -843,6 +843,7 @@ public class ResultRecordController extends AbstractController {
/*if(model.getMaxCount() != null && model.getDetailDtos().size() > model.getMaxCount().intValue()){
return R.error(model.getName() + "维度指标数量不能超过" + model.getMaxCount());
}*/
for (ResultDetailDto detailDto:model.getDetailDtos()
) {//排序
ResultDetail resultDetail = new ResultDetail();
@ -1459,23 +1460,14 @@ public class ResultRecordController extends AbstractController {
@ApiOperation("导出绩效详情报表")
@GetMapping("/recordDetailExport")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = RecordDetailExportResp.class)})
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ResultRecordDetailDto.class)})
public R recordDetailExport(Long recordId){
RecordDetailExportResp resp = new RecordDetailExportResp();
Map map = Maps.newHashMap();
map.put("id",recordId);
R respnse = getDetail(map);
if(respnse.isSuccess()){
ResultRecordDetailDto resultRecordDetailDto = (ResultRecordDetailDto) respnse.get("data");
//chartResultService.selectLevelDetailList(req);
// TODO 暂时按照详情页面数据返回
resp.setRecortModelDtos(resultRecordDetailDto.getRecortModelDtos());
}
return R.ok().put("data",resp);
return getDetail(map);
}
@ApiOperation("保存绩效详情报表计划")
@PostMapping("/recordDetailExplan")
@ApiResponses({@ApiResponse(code = 200,message = "成功")})

View File

@ -203,8 +203,11 @@ public class DingtalkBusiness {
if(departmentInfosBos.size() > 0){
List<String> probationUserIDS = getProbationStaff(token);//获取试用期人员信息
Map<String, String> mapProbation =
probationUserIDS.stream().collect(Collectors.toMap(String::toString, Function.identity(), (e, r) -> e));
Map<String, String> mapProbation = null;
if(probationUserIDS != null){
mapProbation = probationUserIDS.stream().collect(Collectors.toMap(String::toString, Function.identity(), (e, r) -> e));
}
//获取原有部门信息
Map<String, DepartmentInfosBo> mapDepartmentInfosBos
= departmentInfosBos.stream().collect(Collectors.toMap(DepartmentInfosBo::getId, Function.identity(), (e, r) -> e));
@ -574,7 +577,7 @@ public class DingtalkBusiness {
private List<String> getProbationStaff(String token){
//获取试用期员工信息
List<String> ids = null;
try {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob");
OapiSmartworkHrmEmployeeQueryonjobRequest req = new OapiSmartworkHrmEmployeeQueryonjobRequest();
@ -582,7 +585,7 @@ public class DingtalkBusiness {
req.setStatusList("2");
req.setSize(50L);
boolean isNext = false;
List<String> ids = new ArrayList<>();
ids = new ArrayList<>();
{
req.setOffset(offSet);
OapiSmartworkHrmEmployeeQueryonjobResponse rsp = client.execute(req, token);
@ -599,13 +602,12 @@ public class DingtalkBusiness {
}else{
logger.info("钉钉请求返回错误{}", jsonObject);
}
}while(isNext)
return ids;
}while(isNext);
} catch (ApiException e) {
e.printStackTrace();
}
return null;
return ids;
}

View File

@ -2,11 +2,15 @@ package com.lz.modules.performance.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.XmlUtil;
import cn.hutool.http.HtmlUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import cn.hutool.poi.excel.StyleSet;
import com.alibaba.druid.sql.visitor.functions.If;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.lz.common.utils.HttpUtil;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.model.ResultDetailDto;
@ -19,12 +23,23 @@ import com.lz.modules.performance.req.ChartResultReq;
import com.lz.modules.performance.res.LevelDetailExportRes;
import com.lz.modules.performance.service.ChartResultService;
import com.lz.modules.sys.service.app.ResultRecordService;
import com.sun.deploy.net.HttpUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.http.HeaderElement;
import org.apache.http.HttpEntity;
import org.apache.http.client.entity.GzipDecompressingEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.HttpClientUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.jsoup.Jsoup;
import org.seimicrawler.xpath.JXDocument;
import org.seimicrawler.xpath.JXNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -32,12 +47,21 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.HtmlUtils;
import org.w3c.dom.Document;
import sun.net.www.http.HttpClient;
import sun.plugin2.os.windows.Windows;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -408,4 +432,88 @@ public class ExportController {
" ],\n" +
" \"weight\": 1\n" +
" }*/
public static void main(String[] args) {
//域名
String domain = "";
//项目名
String projectName = "";
//分支名
String branchName = "";
//session
String session = "";
//分页 ?limit=40&offset=120
try {
URLConnection urlConnection = new URL("http://gitlab.ldxinyong.com/enterpriseManagement/lz_management/commits/version_performance_2.0").openConnection();
//URLConnection urlConnection = new URL("http://gitlab.ldxinyong.com/enterpriseManagement/lz_management/graphs/master").openConnection();
HttpURLConnection connection = (HttpURLConnection) urlConnection;
connection.setRequestMethod("GET");
connection.addRequestProperty("Host", "gitlab.ldxinyong.com");
connection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0");
connection.addRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
connection.addRequestProperty("Accept-Encoding", "gzip, deflate");
connection.addRequestProperty("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
connection.addRequestProperty("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22");
//connection.addRequestProperty("Referer", "http://gitlab.ldxinyong.com/enterpriseManagement/lz_management/commits/master");
//connection.addRequestProperty("Connection", "keep-alive");
//connection.addRequestProperty("Upgrade-Insecure-Requests", "1");
//connection.addRequestProperty("If-None-Match", "W/\"352c90856827b53f3735109727c9f3a1\"");
connection.addRequestProperty("Cookie", "_gitlab_session=4e14c53a8cb378a65fda996b0bc15021; sidebar_collapsed=false");
connection.connect();// 连接会话
// 获取输入流
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
StringBuilder sb = new StringBuilder();
while ((line = br.readLine()) != null) {// 循环读取流
sb.append(line);
}
br.close();// 关闭流
connection.disconnect();// 断开连接
System.out.println(sb.toString());
JXDocument document = JXDocument.create(sb.toString());
JXNode jxNode = document.selNOne("//*[@id='commits-list']");
List<JXNode> sel = jxNode.sel("//*[@class='commits-row']");
for(JXNode jx:sel){
List<JXNode> sel2 = jx.sel("//*[@class='commit flex-row js-toggle-container']");
for(JXNode j:sel2){
String avatar = j.sel("//img[@class='avatar s36 hidden-xs has-tooltip']/@src").get(0).toString();
System.out.println("头像 " + avatar);
String commit = j.sel("//a[@class='commit-row-message item-title']/text()").get(0).toString();
System.out.println("摘要 " + commit);
String name = j.sel("//a[@class='commit-author-link has-tooltip']/text()").get(0).toString();
System.out.println("姓名 " + name);
String time = j.sel("//time[@class='js-timeago']/@datetime").get(0).toString();
System.out.println("时间 " + time);
String version = j.sel("//div[@class='label label-monospace']/text()").get(0).toString();
System.out.println("版本 " + version);
}
}
System.out.println();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,7 @@
package com.lz.mysql;
public class ControlScanner {
private String filePath;//文件地址
static final String[] notesSym = {"/*", "*/", "//", "\\n"};//注释符号成对出现偶数为起始符号奇数为结束符号
}

View File

@ -0,0 +1,8 @@
package com.lz.mysql;
public class SourceData {
private String[] remarks;
private String name;//属性或者方法名称
private String[] params;//参数名称
private String reParam;//返回参数
}