|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.weaver.seconddev.jcldoor.cmd;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.weaver.common.base.entity.result.WeaResult;
|
|
|
|
|
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
|
|
|
|
import com.weaver.framework.rpc.annotation.RpcReference;
|
|
|
|
@ -19,6 +21,7 @@ import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
@ -47,10 +50,13 @@ public class UserInfoCmd {
|
|
|
|
|
@RpcReference(group = "workflow")
|
|
|
|
|
WflRequestListRest wflRequestListRest;
|
|
|
|
|
|
|
|
|
|
@RpcReference
|
|
|
|
|
private com.weaver.em.msg.api.rest.OaRest oaRest;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private JucailinPortalUtils jucailinPortalUtils;
|
|
|
|
|
|
|
|
|
|
public String tenant_key = "t7akvdnf84" ;
|
|
|
|
|
public String tenant_key = "t7akvdnf84";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 我在泛微信息(姓名,部门-岗位,入职天数:478天,人员交流:80人,创建文档:128个,参与群聊:128个,创建流程:239条,处理流程:439条)
|
|
|
|
@ -103,7 +109,7 @@ public class UserInfoCmd {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
|
|
|
|
|
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam);
|
|
|
|
|
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(recordList)) {
|
|
|
|
@ -114,13 +120,13 @@ public class UserInfoCmd {
|
|
|
|
|
position = CommonUtils.null2String(recordMap.get("position"));
|
|
|
|
|
String hiredate = CommonUtils.null2String(recordMap.get("hiredate"));
|
|
|
|
|
if (StringUtils.isNotBlank(hiredate)) {
|
|
|
|
|
try{
|
|
|
|
|
try {
|
|
|
|
|
days = calculateMinute2(hiredate);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("calculateMinute2-e:"+e);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("calculateMinute2-e:" + e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(days)){
|
|
|
|
|
if (StringUtils.isBlank(days)) {
|
|
|
|
|
days = String.valueOf(calculateMinute(hiredate));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -131,15 +137,16 @@ public class UserInfoCmd {
|
|
|
|
|
//流程处理
|
|
|
|
|
wfdeal = getWfDealNum();
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
cyqlsl = "0";
|
|
|
|
|
mtgtrs = "0";
|
|
|
|
|
//参与群聊数量
|
|
|
|
|
cyqlsl = getCyqlNum(hiredate);
|
|
|
|
|
|
|
|
|
|
mtgtrs = getPjMtgtcs(hiredate);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("getUserInfo--Exception:" + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
map.put("userid", userid);
|
|
|
|
|
map.put("userimageurl",userimageurl);
|
|
|
|
|
map.put("userimageurl", userimageurl);
|
|
|
|
|
map.put("username", username);
|
|
|
|
|
map.put("department", department);
|
|
|
|
|
map.put("position", position);
|
|
|
|
@ -206,7 +213,7 @@ public class UserInfoCmd {
|
|
|
|
|
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
|
|
|
|
|
WeaResult<RequestCountInfoPAEntity> RequestCountInfoPAEntity = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
|
|
|
|
|
int code = RequestCountInfoPAEntity.getCode();
|
|
|
|
|
if(code == 200){
|
|
|
|
|
if (code == 200) {
|
|
|
|
|
count = RequestCountInfoPAEntity.getData().getCount();
|
|
|
|
|
}
|
|
|
|
|
num = count + "";
|
|
|
|
@ -244,20 +251,20 @@ public class UserInfoCmd {
|
|
|
|
|
|
|
|
|
|
public static String calculateMinute2(String sdate) throws ParseException {
|
|
|
|
|
String rzsj = "";
|
|
|
|
|
try{
|
|
|
|
|
if(sdate.length() >=10){
|
|
|
|
|
sdate = sdate.substring(0,10);
|
|
|
|
|
try {
|
|
|
|
|
if (sdate.length() >= 10) {
|
|
|
|
|
sdate = sdate.substring(0, 10);
|
|
|
|
|
}
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
String nowDate = sdf.format(new Date());
|
|
|
|
|
Period period = Period.between(LocalDate.parse(sdate), LocalDate.parse(nowDate));
|
|
|
|
|
int p_year = period.getYears() ;
|
|
|
|
|
int p_year = period.getYears();
|
|
|
|
|
LocalDate date = LocalDate.parse(sdate);
|
|
|
|
|
LocalDate p_day = date.plusYears(p_year);
|
|
|
|
|
long days = ChronoUnit.DAYS.between(p_day, LocalDate.parse(nowDate));
|
|
|
|
|
rzsj = p_year+"年"+days ;
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("calculateMinute2-e:"+e);
|
|
|
|
|
rzsj = p_year + "年" + days;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("calculateMinute2-e:" + e);
|
|
|
|
|
}
|
|
|
|
|
return rzsj;
|
|
|
|
|
}
|
|
|
|
@ -276,6 +283,7 @@ public class UserInfoCmd {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取人员类型
|
|
|
|
|
*
|
|
|
|
|
* @param simpleEmployee
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -284,48 +292,48 @@ public class UserInfoCmd {
|
|
|
|
|
String type = "3";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
try {
|
|
|
|
|
String field69 = "";
|
|
|
|
|
|
|
|
|
|
SimpleEmployee employee = UserContext.getCurrentUser();
|
|
|
|
|
log.error("getUserType-employee:"+employee.getEmployeeId());
|
|
|
|
|
log.error("getUserType-employee:" + employee.getEmployeeId());
|
|
|
|
|
|
|
|
|
|
long formdata = employee.getFormdata();
|
|
|
|
|
log.error("getUserType--formdata:"+formdata);
|
|
|
|
|
log.error("getUserType--formdata:" + formdata);
|
|
|
|
|
|
|
|
|
|
// String groupId = "weaver-ebuilder-form-service";
|
|
|
|
|
String pkey = "field69.groupId";
|
|
|
|
|
//weaver-ebuilder-form-service
|
|
|
|
|
String groupId = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
|
|
|
|
|
log.error("groupId:"+groupId);
|
|
|
|
|
String groupId = jucailinPortalUtils.getUfPropData(pkey, tenant_key);
|
|
|
|
|
log.error("groupId:" + groupId);
|
|
|
|
|
|
|
|
|
|
String sourceType = "LOGIC";
|
|
|
|
|
|
|
|
|
|
String sql =" select field69 from eteams.Hrmemployeedefined where form_data_id='"+formdata+"'" ;
|
|
|
|
|
log.error("getSelfServiceData--sql:"+sql);
|
|
|
|
|
String sql = " select field69 from eteams.Hrmemployeedefined where form_data_id='" + formdata + "'";
|
|
|
|
|
log.error("getSelfServiceData--sql:" + sql);
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
|
|
|
|
|
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
|
|
|
|
if(recordList.size()>0){
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
|
|
|
|
if (recordList.size() > 0) {
|
|
|
|
|
// 销售 0,项目 1,技术 2,其它 3
|
|
|
|
|
field69 = String.valueOf(recordList.get(0).get("field69"));
|
|
|
|
|
}
|
|
|
|
|
log.error("field69:"+field69);
|
|
|
|
|
if(StringUtils.isNotBlank(field69)){
|
|
|
|
|
log.error("field69:" + field69);
|
|
|
|
|
if (StringUtils.isNotBlank(field69)) {
|
|
|
|
|
type = getfield69Type(field69);
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
log.error("getUserType-e:"+e);
|
|
|
|
|
log.error("getUserType-e:" + e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map.put("type",type);
|
|
|
|
|
map.put("type", type);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getfield69Type(String key){
|
|
|
|
|
private String getfield69Type(String key) {
|
|
|
|
|
String type = "3";
|
|
|
|
|
switch (key){
|
|
|
|
|
switch (key) {
|
|
|
|
|
case "1":
|
|
|
|
|
type = "0";
|
|
|
|
|
break;
|
|
|
|
@ -341,5 +349,128 @@ public class UserInfoCmd {
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getCyqlNum(String hiredate) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
boolean flag = isTimestampFormat(hiredate);
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 定义日期格式
|
|
|
|
|
String sdate = "";
|
|
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, -1);
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
String edate = dateFormat.format(calendar.getTime());
|
|
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
|
sdate = hiredate.substring(0, 10);
|
|
|
|
|
} else {
|
|
|
|
|
long timestamp = new Long(hiredate); // 时间戳,单位是毫秒
|
|
|
|
|
Date rzdate = new Date(timestamp); // 将时间戳转换为Date对象
|
|
|
|
|
sdate = sdf.format(rzdate);
|
|
|
|
|
}
|
|
|
|
|
SimpleEmployee employee = UserContext.getCurrentUser();
|
|
|
|
|
Long cid = employee.getCid();
|
|
|
|
|
|
|
|
|
|
log.error("cid:" + cid);
|
|
|
|
|
|
|
|
|
|
String pageSize = "100";
|
|
|
|
|
String pageNum = "1";
|
|
|
|
|
|
|
|
|
|
Map<String, Object> json = new HashMap<String, Object>();
|
|
|
|
|
json.put("cid", cid);
|
|
|
|
|
json.put("pageNum", pageNum);
|
|
|
|
|
json.put("pageSize", pageSize);
|
|
|
|
|
json.put("startDate", sdate);
|
|
|
|
|
json.put("endDate", edate);
|
|
|
|
|
log.error("getCyqlNum json:" + JSON.toJSONString(json));
|
|
|
|
|
|
|
|
|
|
com.weaver.em.msg.api.entity.Request emrequest = new com.weaver.em.msg.api.entity.Request();
|
|
|
|
|
emrequest.setUrl("/user-profile/groupSession");
|
|
|
|
|
emrequest.setParamsMap(json);
|
|
|
|
|
emrequest.setAsync(false);
|
|
|
|
|
log.error("getCyqlNum:" + emrequest.toString());
|
|
|
|
|
|
|
|
|
|
com.weaver.em.msg.api.entity.Response response2 = oaRest.executeIm(emrequest);
|
|
|
|
|
log.error("getCyqlNum:" + response2.toString());
|
|
|
|
|
|
|
|
|
|
String data = response2.getData();
|
|
|
|
|
log.error("getCyqlNum data:" + data);
|
|
|
|
|
JSONObject resObj = JSONObject.parseObject(data);
|
|
|
|
|
JSONObject actionMsg = (JSONObject) resObj.get("actionMsg");
|
|
|
|
|
int code = (int) actionMsg.get("code");
|
|
|
|
|
if(code == 0){
|
|
|
|
|
JSONObject dataObj = (JSONObject) resObj.get("data");
|
|
|
|
|
count = (int) dataObj.get("count");
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("getCyqlNum Exception:" + e.getMessage());
|
|
|
|
|
count = 0;
|
|
|
|
|
}
|
|
|
|
|
return count+"";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getPjMtgtcs(String hiredate){
|
|
|
|
|
int count = 0;
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
boolean flag = isTimestampFormat(hiredate);
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 定义日期格式
|
|
|
|
|
String sdate = "";
|
|
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, -1);
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
String edate = dateFormat.format(calendar.getTime());
|
|
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
|
sdate = hiredate.substring(0, 10);
|
|
|
|
|
} else {
|
|
|
|
|
long timestamp = new Long(hiredate); // 时间戳,单位是毫秒
|
|
|
|
|
Date rzdate = new Date(timestamp); // 将时间戳转换为Date对象
|
|
|
|
|
sdate = sdf.format(rzdate);
|
|
|
|
|
}
|
|
|
|
|
SimpleEmployee employee = UserContext.getCurrentUser();
|
|
|
|
|
Long cid = employee.getCid();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String pageSize = "100";
|
|
|
|
|
String pageNum = "1";
|
|
|
|
|
|
|
|
|
|
Map<String, Object> json = new HashMap<String, Object>();
|
|
|
|
|
json.put("cid", cid);
|
|
|
|
|
json.put("pageNum", pageNum);
|
|
|
|
|
json.put("pageSize", pageSize);
|
|
|
|
|
json.put("startDate", sdate);
|
|
|
|
|
json.put("endDate", edate);
|
|
|
|
|
log.error("getPjMtgtcs json:" + JSON.toJSONString(json));
|
|
|
|
|
|
|
|
|
|
com.weaver.em.msg.api.entity.Request emrequest = new com.weaver.em.msg.api.entity.Request();
|
|
|
|
|
emrequest.setUrl("/user-profile/dailySingleSession");
|
|
|
|
|
emrequest.setParamsMap(json);
|
|
|
|
|
emrequest.setAsync(false);
|
|
|
|
|
log.error("getPjMtgtcs:" + emrequest.toString());
|
|
|
|
|
|
|
|
|
|
com.weaver.em.msg.api.entity.Response response2 = oaRest.executeIm(emrequest);
|
|
|
|
|
log.error("getPjMtgtcs:" + response2.toString());
|
|
|
|
|
|
|
|
|
|
String data = response2.getData();
|
|
|
|
|
log.error("getPjMtgtcs data:" + data);
|
|
|
|
|
JSONObject resObj = JSONObject.parseObject(data);
|
|
|
|
|
JSONObject actionMsg = (JSONObject) resObj.get("actionMsg");
|
|
|
|
|
int code = (int) actionMsg.get("code");
|
|
|
|
|
if(code == 0){
|
|
|
|
|
JSONObject dataObj = (JSONObject) resObj.get("data");
|
|
|
|
|
count = (int) dataObj.get("count");
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("getPjMtgtcs Exception:" + e.getMessage());
|
|
|
|
|
count = 0;
|
|
|
|
|
}
|
|
|
|
|
return count+"";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|