#E10-36# 优化员工信息及平均每天沟通数量的值

main
shilei 12 months ago
parent 1cf1fa8b3e
commit 2b96c01522

@ -1,7 +1,5 @@
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.common.hrm.util.Util;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
@ -67,11 +65,13 @@ public class UserInfoCmd {
*/
public Map<String, Object> getUserInfo(SimpleEmployee simpleEmployee) {
Map<String, Object> map = new HashMap<>(100);
// String userid = String.valueOf(simpleEmployee.getEmployeeId());
Long employeeId = simpleEmployee.getEmployeeId();
String username = String.valueOf(simpleEmployee.getName());
Long employeeId = simpleEmployee.getEmployeeId();
log.error("getUserInfo-employeeId:"+employeeId);
String userimageurl = "/profile/" + employeeId + "/personal";
String username = String.valueOf(simpleEmployee.getName());
log.error("username:"+username);
String department = "";
String position = "";
String days = "";
@ -81,49 +81,58 @@ public class UserInfoCmd {
String cyqlsl = "0";
String mtgtrs = "0";
// String groupId = "weaver-ebuilder-form-service";
// String sourceType = "LOGIC";
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
username = simpleEmployee.getName();
department = simpleEmployee.getDepartment().getName();
position = simpleEmployee.getPosition().getName();
String hiredate = sdf.format(simpleEmployee.getHiredate());
// Map<String, Object> recordMap = new HashMap<String, Object>();
String department2 = simpleEmployee.getDepartment().getName();
log.error("department2:"+department2);
String position2 = simpleEmployee.getPosition().getName();
log.error("position2:"+position2);
String hiredate2 = sdf.format(simpleEmployee.getHiredate());
log.error("hiredate2:"+hiredate2);
Map<String, Object> recordMap = new HashMap<String, Object>();
if (StringUtils.isNotBlank(employeeId+"")) {
// String dataSql = "select " +
// " a.id, " +
// " a.username, " +
// " a.hiredate, " +
// " b.name as department, " +
// " c.name as position " +
// "from " +
// " eteams.employee a " +
// " left join eteams.department b on a.department = b.id " +
// " left join eteams.position c on c.id = a.position " +
// "where " +
// " a.id = ? " +
// " and a.tenant_key = ? " +
// " and a.status = 'normal' " +
// " and a.type = 'inside'";
// log.error("getuserIfo--dataSql:" + dataSql);
// List<String> strlist = new ArrayList<>(100);
// strlist.add(userid);
// strlist.add(tenant_key);
// List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
// List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
// if (CollectionUtils.isNotEmpty(recordList)) {
// recordMap = recordList.get(0);
// }
// username = CommonUtils.null2String(recordMap.get("username"));
// department = CommonUtils.null2String(recordMap.get("department"));
// position = CommonUtils.null2String(recordMap.get("position"));
// String hiredate = CommonUtils.null2String(recordMap.get("hiredate"));
String dataSql ="select " +
" a.id, " +
" a.username, " +
" a.hiredate, " +
" b.name as department, " +
" c.name as position " +
" from " +
" eteams.employee a " +
" left join eteams.department b on a.department = b.id " +
" left join eteams.position c on c.id = a.position " +
" where " +
" a.id = ? " +
" and a.tenant_key = ? " +
" and a.status = 'normal' " +
" and a.type = 'inside'";
log.error("getuserIfo--dataSql:" + dataSql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId+"");
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (CollectionUtils.isNotEmpty(recordList)) {
recordMap = recordList.get(0);
}
username = CommonUtils.null2String(recordMap.get("username"));
log.error("username:"+username);
department = CommonUtils.null2String(recordMap.get("department"));
log.error("department:"+department);
position = CommonUtils.null2String(recordMap.get("position"));
log.error("position:"+position);
String hiredate = CommonUtils.null2String(recordMap.get("hiredate"));
log.error("hiredate:"+hiredate);
if (StringUtils.isNotBlank(hiredate)) {
try {
days = calculateMinute2(hiredate);
@ -153,6 +162,7 @@ public class UserInfoCmd {
log.error("mtgtrs:"+mtgtrs);
}
} catch (Exception e) {
e.printStackTrace();
log.error("getUserInfo--Exception:" + e.getMessage());
}
@ -236,7 +246,7 @@ public class UserInfoCmd {
* @return
* @throws ParseException
*/
public static int calculateMinute(String sdate) throws ParseException {
public int calculateMinute(String sdate) throws ParseException {
long l = 0;
boolean flag = isTimestampFormat(sdate);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@ -254,7 +264,7 @@ public class UserInfoCmd {
}
public static String calculateMinute2(String sdate) {
public String calculateMinute2(String sdate) {
String rzsj = "";
try {
if (sdate.length() >= 10) {
@ -274,7 +284,7 @@ public class UserInfoCmd {
return rzsj;
}
public static boolean isTimestampFormat(String inputDate) {
public boolean isTimestampFormat(String inputDate) {
// 使用 simpleDateFormat 尝试将输入日期解析为时间戳格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
@ -359,7 +369,7 @@ public class UserInfoCmd {
* @param employeeId
* @return
*/
private String getCyqlNumNew(String employeeId) {
public String getCyqlNumNew(String employeeId) {
String amount = "0";
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
@ -453,7 +463,7 @@ public class UserInfoCmd {
* @param employeeId
* @return
*/
private String getPjMtgtcsNew(String employeeId) {
public String getPjMtgtcsNew(String employeeId) {
String amount = "0.0";
try{
String sql = "select amount from uf_nj_pjmrdlhhsl where ry = ? and delete_type=0 and tenant_key = ?";

@ -16,6 +16,7 @@ import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.framework.rpc.context.impl.TenantRpcContext;
import com.weaver.mc.api.async.AsyncSystemMessageRest;
import com.weaver.mc.api.rest.SystemMessageRest;
import com.weaver.seconddev.jcldoor.cmd.UserInfoCmd;
import com.weaver.seconddev.jcldoor.util.ChatDayUtils;
import com.weaver.seconddev.jcldoor.util.ChatGroupUtils;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
@ -97,6 +98,9 @@ public class HrmSelfHelpController {
@RpcReference
SystemMessageRest systemMessageRest;
@Autowired
private com.weaver.seconddev.jcldoor.cmd.UserInfoCmd userInfoCmd ;
public String tenant_key = "t7akvdnf84" ;
@ -1889,5 +1893,95 @@ public class HrmSelfHelpController {
}
@GetMapping("/test203")
@WeaPermission(publicPermission = true)
public WeaResult<Object> test203(HttpServletRequest request){
Map<String,Object> dataMap = new HashMap<String,Object>();
dataMap.put("test","test203");
try {
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
long employeeId = simpleEmployee.getEmployeeId();
Map<String, Object> map = new HashMap<String, Object>(100);
log.error("getUserInfo-employeeId:"+employeeId);
String userimageurl = "/profile/" + employeeId + "/personal";
String username = String.valueOf(simpleEmployee.getName());
log.error("username:"+username);
String department = "";
String position = "";
String days = "";
String doccreate = "0";
String wfcreate = "0";
String wfdeal = "0";
String cyqlsl = "0";
String mtgtrs = "0";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
department = simpleEmployee.getDepartment().getName();
log.error("department:"+department);
position = simpleEmployee.getPosition().getName();
log.error("position:"+position);
String hiredate = sdf.format(simpleEmployee.getHiredate());
if (StringUtils.isNotBlank(employeeId+"")) {
log.error("hiredate:"+hiredate);
if (StringUtils.isNotBlank(hiredate)) {
try {
days = userInfoCmd.calculateMinute2(hiredate);
} catch (Exception e) {
log.error("calculateMinute2-e:" + e);
}
if (StringUtils.isBlank(days)) {
days = String.valueOf(userInfoCmd.calculateMinute(hiredate));
}
}
log.error("days:"+days);
//文档创建
doccreate = userInfoCmd.getDocCreateNum(employeeId);
log.error("doccreate:"+doccreate);
//流程创建
wfcreate = userInfoCmd.getWfCreateNum(simpleEmployee);
log.error("wfcreate:"+wfcreate);
//流程处理
wfdeal = userInfoCmd.getWfDealNum(simpleEmployee);
log.error("wfdeal:"+wfdeal);
//参与群聊数量
cyqlsl = userInfoCmd.getCyqlNumNew(employeeId+"");
log.error("cyqlsl:"+cyqlsl);
mtgtrs = userInfoCmd.getPjMtgtcsNew(employeeId+"");
log.error("mtgtrs:"+mtgtrs);
}
} catch (Exception e) {
e.printStackTrace();
log.error("getUserInfo--Exception:" + e);
}
map.put("userid", employeeId+"");
map.put("userimageurl", userimageurl);
map.put("username", username);
map.put("department", department);
map.put("position", position);
map.put("days", days);
map.put("doccreate", doccreate);
map.put("wfcreate", wfcreate);
map.put("wfdeal", wfdeal);
map.put("cyqlsl", cyqlsl);
map.put("mtgtrs", mtgtrs);
dataMap.put("datas",map);
} catch (Exception e) {
e.printStackTrace();
log.error("test202:"+e);
dataMap.put("message",e.getMessage());
}
return WeaResult.success(dataMap);
}
}

Loading…
Cancel
Save