master
wangjie 1 year ago
commit 6592dd05e3

@ -0,0 +1,102 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 4
*
* @author shil
* @version 1.00
* @Date 2024/5/22
*/
@Component
public class CockpitBlogDataCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitBlogDataCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public Map<String, Object> getDataInfo(SimpleEmployee simpleEmployee, Map<String, Object> paramMap,String tenantKey) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Map<String, Object> recordMap = new HashMap<String, Object>();
try {
String employeeId = String.valueOf(simpleEmployee.getEmployeeId());
String groupId = "weaver-elog-service";
String sourceType = "LOGIC";
String sql =" select w.id,w.blog_time,w.content \n" +
" from (\n" +
" select id,blog_time,content \n" +
" from blog where creator = ?\n" +
" and delete_type = 0\n" +
" and tenant_key = ? \n" +
" order by blog_time desc\n" +
" ) w limit 5 " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
List<Map<String,Object>> blogList = new ArrayList<Map<String,Object>>();
Map<String,Object> blogMap = null;
if(recordList.size()>0){
for(int i=0;i<recordList.size();i++){
Map<String,Object> dataMap = recordList.get(i) ;
String blogid = String.valueOf(dataMap.get("id"));
String blog_time = String.valueOf(dataMap.get("blog_time"));
String content = String.valueOf(dataMap.get("content"));
String blogDate = "";
if(StringUtils.isNotBlank(blog_time)){
try{
Long blogTime = Long.parseLong(blog_time);
Date date = new Date(blogTime);
blogDate = sdf.format(date);
}catch (Exception e){
}
}
if(StringUtils.isNotBlank(blogDate)){
blogMap = new HashMap<String,Object>();
blogMap.put("blogid",blogid);
blogMap.put("blog_time",blogDate);
blogMap.put("content",content);
blogList.add(blogMap);
}
}
}
recordMap.put("datas",blogList);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
return recordMap;
}
}

@ -0,0 +1,572 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
import com.weaver.teams.client.doc.remote.DocClientService;
import com.weaver.teams.domain.user.SimpleEmployee;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
/**
*
*
* @author shil
* @version 1.00
* @Date 2024/5/22
*/
@Component
public class CockpitDocumentAnalysisCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitDocumentAnalysisCmd.class);
@Autowired
private JucailinCockpitUtils jucailinCockpitUtils;
@Autowired
private DatabaseUtils databaseUtils;
@RpcReference
DocClientService docClientService;
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap,String tenantKey) {
Map<String, Object> recordMap = new HashMap<String, Object>();
try {
List<Map<String,String>> dataList = getDocumentDate(employee,tenantKey);
recordMap.put("leftdata",dataList);
List<Map<String, Object>> rightList = getRightViewData(employee,tenantKey);
recordMap.put("rightdata",rightList);;
} catch (Exception e) {
e.printStackTrace();
log.error("CockpitDocumentAnalysisCmd-e:" + e);
}
return recordMap;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public List<Map<String,String>> getDocumentDate(SimpleEmployee employee,String tenantKey) {
List<Map<String,String>> doclist = new ArrayList<>(100);
try {
long employeeId = employee.getEmployeeId();
Map<String,String> docMap = new HashMap<String,String>();
// String doc_count4 = getDocumentDateAmount(employeeId,"4",tenantKey);
// String doc_name4 = "待查看文档数量";
// String doc_pkey4 = "document.create.amount";
// String doc_url4 = jucailinCockpitUtils.getUfPropData(doc_pkey4,tenantKey);
// docMap.put("count",doc_count4);
// docMap.put("name",doc_name4);
// docMap.put("url",doc_url4);
// doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count5 = getDocumentDateAmount5(employeeId,tenantKey);
String doc_name5 = "我的积分";
String doc_pkey5 = "document.mine.integral";
String doc_url5 = jucailinCockpitUtils.getUfPropData(doc_pkey5,tenantKey);
docMap.put("count",doc_count5);
docMap.put("name",doc_name5);
docMap.put("url",doc_url5);
doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count6 = getDocumentDateAmount6(employeeId,tenantKey);
String doc_name6 = "我的分享";
String doc_pkey6 = "document.mine.share";
String doc_url6 = jucailinCockpitUtils.getUfPropData(doc_pkey6,tenantKey);
docMap.put("count",doc_count6);
docMap.put("name",doc_name6);
docMap.put("url",doc_url6);
doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count7 = getDocumentDateAmount7(employeeId,tenantKey);
String doc_name7 = "下属知识";
String doc_pkey7 = "document.subordinate.create";
String doc_url7 = jucailinCockpitUtils.getUfPropData(doc_pkey7,tenantKey);
docMap.put("count",doc_count7);
docMap.put("name",doc_name7);
docMap.put("url",doc_url7);
doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count1 = getDocumentDateAmount1(employeeId,tenantKey);
String doc_name1 = "我创建的文档";
String doc_pkey1 = "document.create.amount";
String doc_url1 = jucailinCockpitUtils.getUfPropData(doc_pkey1,tenantKey);
docMap.put("count",doc_count1);
docMap.put("name",doc_name1);
docMap.put("url",doc_url1);
doclist.add(docMap);
// docMap = new HashMap<String,String>();
// String doc_count2 = getDocumentDateAmount(employeeId,"2",tenantKey);
// String doc_name2 = "共享给我的文档";
// String doc_pkey2 = "document.read.amount";
// String doc_url2 = jucailinCockpitUtils.getUfPropData(doc_pkey2,tenantKey);
// docMap.put("count",doc_count2);
// docMap.put("name",doc_name2);
// docMap.put("url",doc_url2);
// doclist.add(docMap);
//
// docMap = new HashMap<String,String>();
// String doc_count3 = getDocumentDateAmount(employeeId,"3",tenantKey);
// String doc_name3 = "我订阅的文档";
// String doc_pkey3 = "document.number.amount";
// String doc_url3 = jucailinCockpitUtils.getUfPropData(doc_pkey3,tenantKey);
// docMap.put("count",doc_count3);
// docMap.put("name",doc_name3);
// docMap.put("url",doc_url3);
// doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count8 = getDocumentDateAmount8(employeeId,tenantKey);
String doc_name8 = "我关注的文档";
String doc_pkey8 = "document.mine.attention";
String doc_url8 = jucailinCockpitUtils.getUfPropData(doc_pkey8,tenantKey);
docMap.put("count",doc_count8);
docMap.put("name",doc_name8);
docMap.put("url",doc_url8);
doclist.add(docMap);
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return doclist;
}
// public String getDocumentDateAmount(Long employeeId,String type,String tenantKey) {
// String count = "0";
// String groupId = "weaver-doc-service";
// String sourceType = "LOGIC";
//
// try {
// if("1".equals(type)){
//
// int doccreatecount = docClientService.countByCreator(employeeId);
// count = doccreatecount + "";
//
// }else if("2".equals(type)){
//
// String sql =" select count(1) as cou " +
// " from document " +
// " where id in( select targetid from doc_documentlogs where log_operator <> ? and operatetype = 'read' and delete_type = 0 and tenant_key=? and doc_status = 2 ) \n" +
// " and creator = ?\n" +
// " and delete_type = 0\n" +
// " and tenant_key= ? " ;
//
// List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
// SqlParamEntity sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.LONG);
// sqlParamEntity.setValue(employeeId+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(tenantKey);
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.LONG);
// sqlParamEntity.setValue(employeeId+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(tenantKey);
// sqlparam.add(sqlParamEntity);
//
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
// List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
// if(recordList.size()>0){
// count = String.valueOf(recordList.get(0).get("cou"));
// }
// }else if("3".equals(type)){
// String sql =" select count(1) as cou \n" +
// " from doc_documentlogs \n" +
// " where targetid in( select id from document where creator = ? and delete_type = 0 and tenant_key=? and doc_status = 2) \n" +
// " and log_operator <> ? \n" +
// " and OPERATETYPE = 'read' \n" +
// " and delete_type = 0 \n" +
// " and tenant_key=? " ;
//
// List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
// SqlParamEntity sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.LONG);
// sqlParamEntity.setValue(employeeId+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(tenantKey);
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.LONG);
// sqlParamEntity.setValue(employeeId+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(tenantKey);
// sqlparam.add(sqlParamEntity);
//
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
// List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
// if(recordList.size()>0){
// count = String.valueOf(recordList.get(0).get("cou"));
// }
// }else if("4".equals(type)){
//
// }else if("5".equals(type)){
//
// }else if("6".equals(type)){
//
// }else if("7".equals(type)){
//
// }else if("8".equals(type)){
//
// }
// } catch (Exception e) {
// e.printStackTrace();
// log.error("getDocCreateNum:" + e);
// }
//
// return count;
// }
/***
*
* @param employeeId
* @param tenantKey
* @return
*/
public String getDocumentDateAmount1(Long employeeId,String tenantKey) {
String count = "0";
try {
int doccreatecount = docClientService.countByCreator(employeeId);
count = doccreatecount + "";
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return count;
}
/***
*
* @param employeeId
* @param tenantKey
* @return
*/
public String getDocumentDateAmount5(Long employeeId,String tenantKey) {
String count = "0";
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
try {
if(StringUtils.isNotBlank(employeeId+"")){
String sql =" select sum(case when jfzj = 0 then jfz else 0-jfz end ) as zjf \n" +
" from uf_docPointDetail_112 " +
" where xm = ?"+
" and delete_type = 0" +
" and tenant_key = ?" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou"));
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return count;
}
/***
*
* @param employeeId
* @param tenantKey
* @return
*/
public String getDocumentDateAmount6(Long employeeId,String tenantKey) {
int count = 0;
String count1 = "0";
String count2 = "0";
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
try {
if(StringUtils.isNotBlank(employeeId+"")){
String sql =" select count(1) as cou\n" +
" from doc_external_share \n" +
" where creator = ? " +
" and date_add(create_time, interval period_validity day) >= curdate()" +
" and delete_type = 0" +
" and tenant_key = ?" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count1 = String.valueOf(recordList.get(0).get("cou"));
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocumentDateAmount6:" + e);
}
try {
if(StringUtils.isNotBlank(employeeId+"")){
String sql =" select count(1) as cou " +
" from doc_matter_forwardlogs " +
" where creator = ? \n" +
" and delete_type = 0 \n" +
" and tenant_key = ?\n" +
" and functionname = 'matter_forward'\n" +
" and operatetype = 0 " +
" and targetid not in(\n" +
" select targetid " +
" from doc_matter_forwardlogs " +
" where creator = ?\n" +
" and delete_type = 0 \n" +
" and tenant_key = ?\n" +
" and functionname = 'matter_forward'\n" +
" and operatetype=1 \n" +
" )" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count2 = String.valueOf(recordList.get(0).get("cou"));
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocumentDateAmount6:" + e);
}
try{
if(StringUtils.isNotBlank(count1)){
int cou1 = Integer.parseInt(count1);
count = count + cou1;
}
if(StringUtils.isNotBlank(count2)){
int cou2 = Integer.parseInt(count2);
count = count + cou2;
}
}catch (Exception e){
e.printStackTrace();
log.error("getDocumentDateAmount6:" + e);
}
return count+"";
}
public String getDocumentDateAmount7(Long employeeId,String tenantKey) {
String count = "0";
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
try {
String sql =" select count(1) as cou from document where creator in(" +
" select id from eteams.employee where superior = ? and status='normal' and delete_type=0 and tenant_key=? "+
" ) and delete_type = 0 and tenant_key=? and doc_status = 2" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou"));
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return count;
}
public String getDocumentDateAmount8(Long employeeId,String tenantKey) {
String count = "0";
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
try {
String sql =" select count(1) as cou \n" +
" from my_watch \n" +
" where watcher = ? \n" +
" and module='document' \n" +
" and delete_type = 0 \n" +
" and tenant_key=? " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou"));
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return count;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public List<Map<String,Object>> getRightViewData(SimpleEmployee employee,String tenantKey){
List<Map<String,Object>> recordList = new ArrayList<Map<String,Object>>();
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
Long employeeId = employee.getEmployeeId();
log.error("employeeId:"+employeeId);
try {
String sql =" select p.folder,p.name,p.cou from ( \n" +
" select w.folder,w.name,w.cou \n" +
" from ( \n" +
" select t.folder,l.name,count(1) as cou \n" +
" from document t \n" +
" inner join folder l on l.id = t.folder \n" +
" where t.creator = ? \n" +
" and t.delete_type = 0 \n" +
" and t.tenant_key= ? " +
" and l.delete_type = 0 \n" +
" and l.tenant_key= ? " +
" group by t.folder,l.name \n" +
" ) w order by w.cou desc \n" +
") p limit 5 " ;
log.error("sql:"+sql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
recordList = databaseUtils.getDataSourceList(result);
} catch (Exception e) {
e.printStackTrace();
log.error("getRightViewData:" + e);
}
return recordList;
}
}

@ -0,0 +1,110 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.teams.domain.hr.entity.FlowData;
import com.weaver.teams.domain.hr.entity.FlowDataListReq;
import com.weaver.teams.domain.hr.entity.FlowDataListRes;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.workrelate.performance.api.rest.RemotePerformanceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/8
*/
@Component
public class CockpitMonthPerformanceInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitMonthPerformanceInfoCmd.class);
@RpcReference
public RemotePerformanceService remotePerformanceService;
public Map<String, Object> getDataInfo(SimpleEmployee simpleEmployee, Map<String, Object> paramMap,String tenantKey) {
Map<String, Object> dataMap = new HashMap<String, Object>(100);
String dateType = "month";
try {
long employeeId = simpleEmployee.getEmployeeId();
List<Long> userList = new ArrayList<Long>();
userList.add(employeeId);
LocalDate currentDate = LocalDate.now();
List<Map<String, Object>> scoreList = new ArrayList<Map<String, Object>>();
Map<String, Object> scoreMap = null;
for (int i = 0; i < 6; i++) {
LocalDate lastLocalDate = currentDate.minus(i, ChronoUnit.MONTHS); // 当前日期减去6个月
LocalDate startDay = lastLocalDate.with(TemporalAdjusters.firstDayOfMonth()); // 计算当前月份的首日
LocalDate endDay = lastLocalDate.with(TemporalAdjusters.lastDayOfMonth()); // 获取本月最后一天
log.error("startDay:"+startDay.toString());
log.error("endDay:"+endDay.toString());
String score = getScore(userList,startDay.toString(), endDay.toString(),dateType,tenantKey);
log.error("score:"+score);
int month = lastLocalDate.getMonth().getValue();
int year = lastLocalDate.getYear();
String currentMonth = "" ;
if(month < 10){
currentMonth = year+"-0"+month;
}else{
currentMonth = year+"-"+month;
}
log.error("currentMonth:"+currentMonth);
scoreMap = new HashMap<String, Object>();
scoreMap.put("month",currentMonth);
scoreMap.put("score",score);
scoreList.add(scoreMap);
}
dataMap.put("datas",scoreList);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
return dataMap;
}
public String getScore( List<Long> userList,String startDay, String endDay,String dateType,String tenantKey) {
String scoreData = "0.00" ;
try {
FlowDataListReq flowDataListReq = new FlowDataListReq();
flowDataListReq.setCurrent(1);
flowDataListReq.setPageSize(20);
flowDataListReq.setStartTime(startDay + "");
flowDataListReq.setEndTime(endDay + "");
flowDataListReq.setDateType(dateType);
flowDataListReq.setTenantKey(tenantKey);
flowDataListReq.setUserList(userList);
FlowData flowData = remotePerformanceService.queryFlowData(flowDataListReq);
log.error("getWholeYearKpi2-flowData:" + flowData);
List<FlowDataListRes> flowDataList = flowData.getDataList();
if (flowDataList.size() > 0) {
for (int index = 0; index < flowDataList.size(); index++) {
FlowDataListRes flowDataListRes = flowDataList.get(index);
float score = flowDataListRes.getScore();
scoreData = score+"";
}
}
} catch (Exception e) {
log.error("getWholeYearKpi2-getScore-Exception:" + e.getMessage());
}
return scoreData;
}
}

@ -0,0 +1,254 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class CockpitProjectDataCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitProjectDataCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap, String tenantKey) {
Map<String, Object> recordMap = new HashMap<String, Object>();
String userid = String.valueOf(paramMap.get("userid"));
List<Map<String,Object>> projectDate2 = new ArrayList<Map<String,Object>>();
List<Map<String,Object>> projectDate3 = new ArrayList<Map<String,Object>>();
try {
projectDate2 = getProjectDate3(employee,tenantKey,userid);
// projectDate3 = getProjectDate3(employee,tenantKey,userid);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
recordMap.put("projectDate2",projectDate2);
// recordMap.put("projectDate3",projectDate3);
return recordMap;
}
public List<Map<String,Object>> getProjectDate2(SimpleEmployee employee, String tenantKey,String userid) {
List<Map<String,Object>> projectList = new ArrayList<Map<String,Object>>();
String groupId = "weaver-project-service";
String sourceType = "LOGIC";
long employeeid = employee.getEmployeeId();
log.error("employeeid:"+employeeid);
if(StringUtils.isNotBlank(userid)){
employeeid = Long.parseLong(userid);
}
log.error("employeeid2:"+employeeid);
try {
String sql =" select w.* from (\n" +
" select convert(m.id,char) as mainline_id,m.name as mainline_name,\n" +
" convert(m.manager,char) as manager_id,e.username as manager_name,d.id as departmentid,d.name as departmentname,\n" +
" convert(p.rel_custom,char) as rel_custom,p.proj_amount,p.proj_approval_date,\n" +
" p.actual_val_date \n" +
" from ec_customerservice.mainline m \n" +
" inner JOIN ec_customerservice.mainline_form_data f ON f.mainline_id = m.id \n" +
" inner join ec_customerservice.proj_pms_base p on p.form_data_id = f.form_data_id \n" +
" inner join ec_customerservice.mainline_status_custom msc on msc.mainline_id = m.id \n" +
" inner join ec_customerservice.mainline_cust_status mcs on msc.status_id = mcs.id\n" +
" left join eteams.employee e ON m.manager = e.id \n" +
" left join eteams.department d ON e.department = d.id \n" +
" where m.group_id = '4527875868755238091' \n" +
" and m.manager in( select id\n" +
" from eteams.employee \n" +
" where (superior = "+employeeid+" or id = "+employeeid+")\n" +
" and status='normal'\n" +
" and delete_type=0 " +
" and tenant_key = '"+tenantKey+"'\n" +
" )\n" +
" and e.status = 'normal' " +
" and d.type='department' " +
" and mcs.name <> '结案'" +
" and m.delete_type = 0 \n" +
" and m.tenant_key = '"+tenantKey+"'\n" +
" and f.delete_type = 0 \n" +
" and f.tenant_key = '"+tenantKey+"'\n" +
" and p.delete_type = 0\n" +
" and p.tenant_key = '"+tenantKey+"'\n" +
" and msc.delete_type = 0\n" +
" and msc.tenant_key = '"+tenantKey+"'\n" +
" and mcs.delete_type = 0\n" +
" and mcs.tenant_key = '"+tenantKey+"'\n" +
" and mcs.enabled = 1 \n" +
" and e.delete_type = 0 \n" +
" and e.tenant_key = '"+tenantKey+"'\n" +
" and d.delete_type = 0 \n" +
" and d.tenant_key = '"+tenantKey+"'\n" +
" order by m.create_time desc\n" +
") w limit 6";
log.error("sql:"+sql);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
projectList = databaseUtils.getDataSourceList(result);
} catch (Exception e) {
e.printStackTrace();
log.error("getProjectDate2-Exception:" + e);
}
return projectList;
}
/***
*
* @param employee
* @param tenantKey
* @param userid
* @return
*/
public List<Map<String,Object>> getProjectDate3(SimpleEmployee employee, String tenantKey,String userid) {
List<Map<String,Object>> projectList = new ArrayList<Map<String,Object>>();
String groupId = "weaver-project-service";
String sourceType = "LOGIC";
String groupid = "4527875868755238091";
long employeeid = employee.getEmployeeId();
log.error("employeeid:"+employeeid);
if(StringUtils.isNotBlank(userid)){
employeeid = Long.parseLong(userid);
}
log.error("employeeid2:"+employeeid);
try {
String sql =" select w.* from (\n" +
" select convert(m.id,char) as mainline_id,m.name as mainline_name,\n" +
" convert(m.manager,char) as manager_id,e.username as manager_name,d.id as departmentid,d.name as departmentname,\n" +
" convert(p.rel_custom,char) as rel_custom,p.proj_amount,p.proj_approval_date,\n" +
" p.actual_val_date \n" +
" from ec_customerservice.mainline m \n" +
" inner JOIN ec_customerservice.mainline_form_data f ON f.mainline_id = m.id \n" +
" inner join ec_customerservice.proj_pms_base p on p.form_data_id = f.form_data_id \n" +
" inner join ec_customerservice.mainline_status_custom msc on msc.mainline_id = m.id \n" +
" inner join ec_customerservice.mainline_cust_status mcs on msc.status_id = mcs.id\n" +
" left join eteams.employee e ON m.manager = e.id \n" +
" left join eteams.department d ON e.department = d.id \n" +
" where m.group_id = ? \n" +
" and m.manager in( select id\n" +
" from eteams.employee \n" +
" where (superior = ? or id = ?)\n" +
" and status='normal'\n" +
" and delete_type=0" +
" and tenant_key = ?\n" +
" )\n" +
" and e.status = 'normal' " +
" and d.type='department' " +
" and mcs.name <> '结案'\n" +
" and m.delete_type = 0 \n" +
" and m.tenant_key = ?\n" +
" and f.delete_type = 0 \n" +
" and f.tenant_key = ?\n" +
" and p.delete_type = 0\n" +
" and p.tenant_key = ?\n" +
" and msc.delete_type = 0\n" +
" and msc.tenant_key = ?\n" +
" and mcs.delete_type = 0\n" +
" and mcs.tenant_key = ?\n" +
" and mcs.enabled = 1 \n" +
" and e.delete_type = 0 \n" +
" and e.tenant_key = ? \n" +
" and d.delete_type = 0 \n" +
" and d.tenant_key = ?\n" +
" order by m.create_time desc\n" +
") w limit 6";
log.error("sql:"+sql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(groupid);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeid+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeid+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
projectList = databaseUtils.getDataSourceList(result);
} catch (Exception e) {
e.printStackTrace();
log.error("getProjectDate2-Exception:" + e);
}
return projectList;
}
}

@ -0,0 +1,773 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.Period;
import java.util.*;
/**
* 4
*
* @author shil
* @version 1.00
* @Date 2024/5/22
*/
@Component
public class CockpitUserDataCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitUserDataCmd.class);
@Autowired
private JucailinCockpitUtils jucailinCockpitUtils;
@Autowired
private DatabaseUtils databaseUtils;
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap, String tenantKey) {
Map<String, Object> userMap = new HashMap<String, Object>();
String sourceType = "LOGIC";
String groupId ="weaver-ebuilder-form-service";
try{
Long deptid = 0L ;
String subcompanynme = "";
String employeeId = "";
String deptname = "" ;
String positionname = "";
String username = "";
try {
employeeId = String.valueOf(employee.getEmployeeId());
username = employee.getName();
}catch (Exception e) {
e.printStackTrace();
log.error("getDataInfo1:"+e);
}
log.error("employeeId:" + employeeId);
log.error("username:" + username);
try {
deptname = employee.getDepartment().getName();
deptid = employee.getDepartment().getId();
}catch (Exception e) {
e.printStackTrace();
log.error("getDataInfo2:"+e);
}
log.error("deptname:" + deptname);
log.error("deptid:" + deptid);
try {
positionname = employee.getPosition().getName();
}catch (Exception e) {
e.printStackTrace();
log.error("getDataInfo3:"+e);
}
log.error("positionname:" + positionname);
String personnelstatusname = "正式员工";
String personnelstatus = "";
try {
personnelstatus = employee.getPersonnelStatus();
log.error("personnelstatus:" + personnelstatus);
if ("1".equals(personnelstatus)) {
personnelstatusname = "试用员工";
} else if ("2".equals(personnelstatus)) {
personnelstatusname = "试用延期员工";
} else if ("3".equals(personnelstatus)) {
personnelstatusname = "正式员工";
} else if ("4".equals(personnelstatus)) {
personnelstatusname = "临时员工";
} else if ("5".equals(personnelstatus)) {
personnelstatusname = "实习员工";
} else if ("6".equals(personnelstatus)) {
personnelstatusname = "离职员工";
} else if ("7".equals(personnelstatus)) {
personnelstatusname = "退休员工";
} else if ("9".equals(personnelstatus)) {
personnelstatusname = "解聘员工";
} else if ("10".equals(personnelstatus)) {
personnelstatusname = "无效员工";
}
}catch (Exception e) {
e.printStackTrace();
log.error("getDataInfo4:"+e);
}
log.error("personnelstatusname:" + personnelstatusname);
try {
if (StringUtils.isNotBlank(deptid + "")) {
String sql =" select name from eteams.department where id in( " +
" select subcompanyid from eteams.department where id = ? and delete_type=0 and tenant_key = ?" +
" ) and delete_type=0 and tenant_key = ?";
log.error("sql:" + sql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(deptid + "");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (!recordList.isEmpty() && recordList.size() > 0) {
subcompanynme = String.valueOf(recordList.get(0).get("name"));
}
}
}catch (Exception e){
e.printStackTrace();
log.error("getDataInfo5:"+e);
}
String jobcallname = "";
try{
long jobcallid = employee.getJobCall();
log.error("jobcallid:" + jobcallid);
if (StringUtils.isNotBlank(jobcallid + "")) {
String sql =" select data_name from eteams.hrm_jobcall " +
" where id = ? " +
" and delete_type = 0\n" +
" and tenant_key = ? \n";
log.error("sql:" + sql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(jobcallid + "");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (!recordList.isEmpty() && recordList.size() > 0) {
jobcallname = String.valueOf(recordList.get(0).get("data_name"));
}
}
}catch (Exception e){
e.printStackTrace();
log.error("getDataInfo6:"+e);
}
String field69 = "";
try{
long formdata = employee.getFormdata();
log.error("formdata:" + formdata);
if (StringUtils.isNotBlank(formdata + "")) {
String sql = " select field69 from eteams.Hrmemployeedefined where form_data_id = ?";
log.error("getSelfServiceData--sql:" + sql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(formdata + "");
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (recordList.size() > 0) {
field69 = String.valueOf(recordList.get(0).get("field69"));
}
if ("1".equals(field69)) {
field69 = "销售";
} else if ("2".equals(field69)) {
field69 = "项目";
} else if ("3".equals(field69)) {
field69 = "技术";
} else if ("4".equals(field69)) {
field69 = "客服";
} else if ("5".equals(field69)) {
field69 = "运营";
}
}
}catch (Exception e){
e.printStackTrace();
log.error("getDataInfo6:"+e);
}
log.error("field69:" + field69);
String avatarUrl = "";
String hiredate = "";
try {
String sex = "";
String resourceimageid = "";
if(StringUtils.isNotBlank(employeeId)){
String dataSql =" select date_format(a.hiredate,'%Y-%m-%d') hiredate,resourceimageid,sex " +
" from eteams.employee a " +
" where a.id = ? " +
" and a.tenant_key = ? " +
" and a.status = 'normal' " +
" and a.type = 'inside'" +
" and delete_type = 0";
log.error("getEmployeeHireData--dataSql:" + dataSql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId + "");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (CollectionUtils.isNotEmpty(recordList)) {
Map<String, Object> recordMap = recordList.get(0);
hiredate = String.valueOf(recordMap.get("hiredate"));
resourceimageid = String.valueOf(recordMap.get("resourceimageid"));
sex = String.valueOf(recordMap.get("sex"));
}
log.error("hiredate:"+hiredate);
}
if(StringUtils.isNotBlank(resourceimageid)){
avatarUrl = "/api/file/preview?type=redirect&fileId="+resourceimageid;
}
if (StringUtils.isBlank(avatarUrl)) {
if("male".equals(sex)){
avatarUrl = "/build/hrm/static/media/male.png"; //female
}else if("female".equals(sex)){
avatarUrl = "/build/hrm/static/media/female.png"; //female
}else{
avatarUrl = "/build/hrm/static/media/male.png"; //female
}
}
}catch (Exception e) {
e.printStackTrace();
log.error("getDataInfo7:"+e);
}
List<Map<String, Object>> customList = new ArrayList<Map<String, Object>>();
try {
customList = getCustomType(employee, tenantKey);
userMap.put("customType", customList);
}catch (Exception e){
e.printStackTrace();
log.error("getDataInfo8:"+e);
}
List<Map<String, Object>> changeList = new ArrayList<Map<String, Object>>();
try {
if (StringUtils.isNotBlank(hiredate)) {
Map<String, Object> hireMap = new HashMap<String, Object>();
hireMap.put("change_date", hiredate);
hireMap.put("operator_type", "entry");
hireMap.put("operator_type_name", "入职");
hireMap.put("data_type", "");
hireMap.put("data_value", "");
hireMap.put("change_id", "");
changeList.add(hireMap);
}
List<Map<String, Object>> empList = getEmpChangeData(employeeId, tenantKey);
if(!empList.isEmpty() && empList.size()>0){
changeList.addAll(empList);
}
for (int i = 0; i < changeList.size()-1; i++) {
Map<String,Object> currentMap = changeList.get(i);
Map<String,Object> nextMap = changeList.get(i+1);
String current_changedate = String.valueOf(currentMap.get("change_date"));
String next_changedate = String.valueOf(nextMap.get("change_date"));
log.error("current_changedate:"+current_changedate);
log.error("next_changedate:"+next_changedate);
String diffdate = "";
if(StringUtils.isNotBlank(current_changedate) && StringUtils.isNotBlank(next_changedate)
&& !"null".equals(current_changedate) && !"null".equals(next_changedate)
){
try{
LocalDate current_date = LocalDate.parse(current_changedate);
LocalDate next_date = LocalDate.parse(next_changedate);
// 计算两个日期之间的期间
Period period = Period.between(current_date, next_date);
int year = period.getYears();
int month = period.getMonths();
if(year > 0){
diffdate = year+"年";
}
if(month > 0){
diffdate = diffdate +month+"月";
}
}catch (Exception e){
e.printStackTrace();
log.error("getDataInfo:"+e);
}
}
currentMap.put("diffdate",diffdate);
}
}catch (Exception e){
e.printStackTrace();
log.error("getDataInfo9:"+e);
}
String userimageurl = "/profile/" + employeeId + "/personal";
userMap.put("employeeId", employeeId);
userMap.put("username", username);
userMap.put("deptmentnnme", subcompanynme + "-" + deptname);
userMap.put("positionname", positionname);
userMap.put("userimageurl", userimageurl);
userMap.put("jobcallname", jobcallname);
userMap.put("personnelstatusname", personnelstatusname);
userMap.put("personnelstatus", personnelstatus);
userMap.put("field69", field69);
userMap.put("avatarUrl", avatarUrl);
userMap.put("changeList", changeList);
}catch (Exception e){
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
return userMap;
}
/***
*
* @return
*/
public List<Map<String, Object>> getCustomType(SimpleEmployee employee, String tenantKey) {
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
Long employeeId = employee.getEmployeeId();
try {
String sql = " select p.bqmc,p.bqnr \n" +
" from(\n" +
" select bqmc,bqnr " +
" from uf_rcbq " +
" where ry = ? \n" +
" and delete_type = 0\n" +
" and tenant_key = ? \n" +
" order by xssx \n" +
" ) p limit 4";
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId + "");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
recordList = databaseUtils.getDataSourceList(result);
// if (recordList.size() < 4) {
// for (int i = 0; i < (4 - recordList.size()); i++) {
// Map<String, Object> nullMap = new HashMap<String, Object>();
// recordList.add(nullMap);
// }
// }
} catch (Exception e) {
e.printStackTrace();
log.error("getRightViewData:" + e);
}
return recordList;
}
public List<Map<String, Object>> getEmpChangeData(String employeeId, String tenantKey) {
List<Map<String, Object>> changeList = new ArrayList<Map<String, Object>>();
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
try {
//入职
// Map<String, Object> hireMap = getEmployeeHireData(employeeId, tenantKey, groupId, sourceType);
// if (hireMap != null && hireMap.size() > 0) {
// changeList.add(hireMap);
// }
// log.error("changeList:"+changeList.size());
//变更
List<Map<String, Object>> changeDataList = getEmployeeChangeData(employeeId, tenantKey, groupId, sourceType);
if (CollectionUtils.isNotEmpty(changeDataList)) {
changeList.addAll(changeDataList);
}
// //离职
// Map<String,Object> departMap = getEmployeeDepartData(employeeId,tenantKey,groupId,sourceType);
// if(departMap !=null && departMap.size()>0){
// changeList.add(departMap);
// }
} catch (Exception e) {
e.printStackTrace();
log.error("getEmpChangeData:" + e);
}
return changeList;
}
/***
*
* @param employeeId
* @param tenantKey
* @return
*/
public Map<String, Object> getEmployeeHireData(String employeeId, String tenantKey, String groupId, String sourceType) {
Map<String, Object> map = new HashMap<String, Object>();
try {
String hiredate = "";
String dataSql =" select date_format(a.hiredate,'%Y-%m-%d') hiredate " +
" from eteams.employee a " +
" where a.id = ? " +
" and a.tenant_key = ? " +
" and a.status = 'normal' " +
" and a.type = 'inside'" +
" and delete_type = 0";
log.error("getEmployeeHireData--dataSql:" + dataSql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId + "");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (CollectionUtils.isNotEmpty(recordList)) {
Map<String, Object> recordMap = recordList.get(0);
hiredate = String.valueOf(recordMap.get("hiredate"));
}
log.error("hiredate:"+hiredate);
if (StringUtils.isNotBlank(hiredate)) {
map.put("change_date", hiredate);
map.put("operator_type", "entry");
map.put("operator_type_name", "入职");
map.put("data_type", "");
map.put("data_value", "");
map.put("change_id", "");
}
} catch (Exception e) {
e.printStackTrace();
log.error("getEmployeeHireData:" + e);
}
return map;
}
// public Map<String,Object> getEmployeeDepartData(Long employeeId,String tenantKey,String groupId,String sourceType){
//
// Map<String,Object> map = new HashMap<String,Object>();
// try {
// String hiredate = "";
// String dataSql =" select t.change_id,k.change_date,k.operator_type \n" +
// " from hrm_empchange_user t \n" +
// " inner join hrm_empchange k on k.id = t.change_id \n" +
// " where t.employeeid = ? \n" +
// " and t.delete_type = 0 \n" +
// " and t.tenant_key = ? " +
// " and k.delete_type = 0 \n" +
// " and k.tenant_key = ? " +
// " and k.batch_status = 2 \n" +
// " and k.operator_type = 'dismiss' ";
//
// log.error("getuserIfo--dataSql:" + dataSql);
// List<String> strlist = new ArrayList<>(100);
// strlist.add(employeeId + "");
// strlist.add(tenantKey);
// 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)) {
// Map<String, Object> recordMap = recordList.get(0);
// change_date = CommonUtils.null2String(recordMap.get("change_date"));
// }
//
// if (StringUtils.isNotBlank(hiredate)) {
// map.put("change_date", hiredate);
// map.put("operator_type", "entry");
// map.put("operator_type_name", "入职");
// map.put("data_type", "");
// map.put("data_value", "");
// map.put("change_id", "");
// }
// }catch (Exception e){
// e.printStackTrace();
// log.error("getEmployeeHireData:"+e);
// }
// return map;
//
// }
/***
*
* @param employeeId
* @param tenantKey
* @param groupId
* @param sourceType
* @return
*/
public List<Map<String, Object>> getEmployeeChangeData(String employeeId, String tenantKey, String groupId, String sourceType) {
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
try {
String dataSql =" select t.change_id,date_format(k.change_date,'%Y-%m-%d') change_date,k.operator_type,p.data_type,p.data_value \n" +
" from eteams.hrm_empchange_user t\n" +
" inner join eteams.hrm_empchange k on k.id = t.change_id\n" +
" inner join eteams.hrm_empchange_userdetail p on p.change_id = t.change_id\n" +
" where t.employeeid = ? \n" +
" and length(p.data_value)>0 \n" +
" and k.batch_status = 2 \n" +
" and t.delete_type = 0 \n" +
" and t.tenant_key = ? \n" +
" and p.delete_type = 0 \n" +
" and p.tenant_key = ? \n" +
" and k.delete_type = 0 \n" +
" and k.tenant_key = ? " +
" and p.data_type in('newDepartment','newPosition','newSuperior','changeStatus') \n " +
" order by k.change_date \n";
log.error("getEmployeeChangeData--dataSql:" + dataSql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
recordList = databaseUtils.getDataSourceList(result);
log.error("recordList2:"+recordList.size());
if (CollectionUtils.isNotEmpty(recordList)) {
for (int i = 0; i < recordList.size(); i++) {
Map<String, Object> recordMap = recordList.get(i);
String operator_type = String.valueOf(recordMap.get("operator_type"));
log.error("operator_type:"+operator_type);
String data_type = String.valueOf(recordMap.get("data_type"));
log.error("data_type:"+data_type);
String data_value = String.valueOf(recordMap.get("data_value"));
log.error("data_value:"+data_value);
String operator_type_name = "";
String data_type_name = "";
String data_value_name = "";
if ("trial".equals(operator_type)) {
operator_type_name = "试用";
} else if ("hire".equals(operator_type)) {
operator_type_name = "转正";
} else if ("extend".equals(operator_type)) {
operator_type_name = "续签";
} else if ("redeploy".equals(operator_type)) {
operator_type_name = "调动";
} else if ("dismiss".equals(operator_type)) {
operator_type_name = "离职";
} else if ("retire".equals(operator_type)) {
operator_type_name = "退休";
} else if ("quit".equals(operator_type)) {
operator_type_name = "解聘";
} else if ("rehire".equals(operator_type)) {
operator_type_name = "返聘";
} else if ("custom".equals(operator_type)) {
operator_type_name = "变更";
}
if ("newDepartment".equals(data_type)) {
data_type_name = "部门";
data_value_name = getDepartmentName(data_value,tenantKey,sourceType,groupId);
} else if ("newPosition".equals(data_type)) {
data_type_name = "岗位";
data_value_name = getPositionName(data_value,tenantKey,sourceType,groupId);
} else if ("newSuperior".equals(data_type)) {
data_type_name = "上级";
data_value_name = getSuperiorName(data_value,tenantKey,sourceType,groupId);
}
recordMap.put("operator_type_name", operator_type_name);
recordMap.put("data_type_name", data_type_name);
recordMap.put("data_value_name", data_value_name);
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getEmpChangeData:" + e);
}
return recordList;
}
/***
*
* @param departmentid
* @param tenantKey
* @param sourceType
* @param groupId
* @return
*/
public String getDepartmentName(String departmentid,String tenantKey,String sourceType,String groupId){
// select name from Department where id=9080991104676336702
String deptname = "" ;
log.error("getDepartmentName--departmentid:" + departmentid);
log.error("getDepartmentName--sourceType:" + sourceType);
log.error("getDepartmentName--groupId:" + groupId);
try{
String dataSql =" select name from eteams.department where id= ? and tenant_key = ? ";
log.error("getDepartmentName--dataSql:" + dataSql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(departmentid + "");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
log.error("getDepartmentName--recordList:" + recordList.size());
if(!recordList.isEmpty() && recordList.size()>0){
deptname = String.valueOf(recordList.get(0).get("name"));
}
log.error("getDepartmentName--deptname:" + deptname);
}catch (Exception e){
e.printStackTrace();
log.error("getDepartmentName:"+e);
}
return deptname;
}
/***
*
* @param positionid
* @param tenantKey
* @param sourceType
* @param groupId
* @return
*/
public String getPositionName(String positionid,String tenantKey,String sourceType,String groupId){
// select name from Department where id=9080991104676336702
String positionName = "" ;
log.error("getPositionName--positionid:" + positionid);
log.error("getPositionName--sourceType:" + sourceType);
log.error("getPositionName--groupId:" + groupId);
try{
String dataSql =" select name from eteams.position where id= ? and tenant_key = ? ";
log.error("getPositionName--dataSql:" + dataSql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(positionid);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
log.error("getPositionName--recordList:" + recordList.size());
if(!recordList.isEmpty() && recordList.size()>0){
positionName = String.valueOf(recordList.get(0).get("name"));
}
log.error("getPositionName--positionName:" + positionName);
}catch (Exception e){
e.printStackTrace();
log.error("getPositionName:"+e);
}
return positionName;
}
/**
*
* @param employeeid
* @param tenantKey
* @param sourceType
* @param groupId
* @return
*/
public String getSuperiorName(String employeeid,String tenantKey,String sourceType,String groupId){
// select name from Department where id=9080991104676336702
String employeeName = "" ;
try{
log.error("getSuperiorName--employeeid:" + employeeid);
log.error("getSuperiorName--sourceType:" + sourceType);
log.error("getSuperiorName--groupId:" + groupId);
String dataSql =" select username from eteams.employee where id= ? and tenant_key = ? ";
log.error("getSuperiorName--dataSql:" + dataSql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeid);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
log.error("getSuperiorName--recordList:" + recordList.size());
if(!recordList.isEmpty() && recordList.size()>0){
employeeName = String.valueOf(recordList.get(0).get("username"));
}
log.error("getSuperiorName--employeeName:" + employeeName);
}catch (Exception e){
e.printStackTrace();
log.error("getPositionName:"+e);
}
return employeeName;
}
}

@ -0,0 +1,830 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
import com.weaver.teams.domain.hr.entity.FlowData;
import com.weaver.teams.domain.hr.entity.FlowDataListReq;
import com.weaver.teams.domain.hr.entity.FlowDataListRes;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workflow.common.constant.list.api.DateTimeConditionEnum;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import com.weaver.workrelate.performance.api.rest.RemotePerformanceService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* ()
*
* @author shil
* @version 1.00
* @Date 2024/5/22
*/
@Component
public class CockpitWorkAchievementsCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitWorkAchievementsCmd.class);
@RpcReference
public RemotePerformanceService remotePerformanceService;
@Autowired
private JucailinCockpitUtils jucailinCockpitUtils;
@Autowired
private DatabaseUtils databaseUtils;
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
public Map<String, Object> getDataInfo(SimpleEmployee simpleEmployee, Map<String, Object> paramMap,String tenantKey) {
Map<String, Object> recordMap = new HashMap<String, Object>();
List<Map<String,String>> list = new ArrayList<Map<String,String>>(100);
Map<String,String> oneMap = new HashMap<String,String>(100);
Map<String,String> twoMap = new HashMap<String,String>(100);
Map<String,String> threeMap = new HashMap<String,String>(100);
Map<String,String> fourMap = new HashMap<String,String>(100);
String startday = String.valueOf(paramMap.get("startday"));
String endday = String.valueOf(paramMap.get("endday"));
String one = "0";
String oneword = "";
String oneurl = "";
String two = "0";
String twoword = "";
String twourl = "";
String three = "0";
String threeword = "";
String threeurl = "";
String four = "0";
String fourword = "";
String foururl = "";
try {
String employeeId = String.valueOf(simpleEmployee.getEmployeeId());
//销售 0项目 1,技术 2其它 3
String znlx = getUserType(simpleEmployee,tenantKey);
//销售 0项目 1,技术 2其它 3
if("2".equals(znlx)){
one = getQuestInfo(startday, endday, employeeId,tenantKey);
oneword = "本年问题处理数";
String pkey = "workdata.technology.wtclsl";
oneurl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
two = getDaysInfo(startday, endday, employeeId,tenantKey);
twoword = "本年开发人天";
pkey = "workdata.technology.kfrt";
twourl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
three = getCoWorkInfo(startday,endday, employeeId,tenantKey);
threeword = "本年协作沟通数";
pkey = "workdata.technology.gtxz";
threeurl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
four = getWfInfo(simpleEmployee);
fourword = "本年处理流程数";
pkey = "workdata.technology.cllc";
foururl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
}else if("1".equals(znlx)){
one = "0.00";
oneword = "本年验收指标";
String pkey = "workdata.project.yszb";
oneurl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
//项目验收信息
two = getYsInfo(employeeId,startday,endday);
two = parseJe(two);
log.error("four:"+four);
twoword = "本年验收金额";
pkey = "workdata.project.ysje";
twourl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
three = "0.00";
threeword = "本年指标达成率";
pkey = "workdata.project.zbdcl";
threeurl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
//项目收款信息
four = getSkInfo(employeeId,startday,endday,tenantKey);
log.error("four:"+four);
four = parseJe(four);
log.error("four2:"+four);
fourword = "本年收款金额";
pkey = "workdata.project.skje";
foururl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
}else if("3".equals(znlx)){
one = getWfInfo(simpleEmployee);
oneword = "本年处理流程数";
String pkey = "workdata.other.cllc";
oneurl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
two = getDocInfo(startday,endday,employeeId,tenantKey);
twoword = "本年文档贡献度";
pkey = "workdata.other.wdgx";
twourl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
three = getDailyInfo(startday,endday,employeeId,tenantKey);
threeword = "本年微博填写数";
pkey = "workdata.other.wbtx";
threeurl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
four = getCoWorkInfo(startday,endday,employeeId,tenantKey);
fourword = "本年沟通协作数";
pkey = "workdata.other.gtxz";
foururl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
}else{
one = getWfInfo(simpleEmployee);
oneword = "本年处理流程数";
String pkey = "workdata.other.cllc";
oneurl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
two = getDocInfo(startday,endday,employeeId,tenantKey);
twoword = "本年文档贡献度";
pkey = "workdata.other.wdgx";
twourl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
three = getDailyInfo(startday,endday,employeeId,tenantKey);
threeword = "本年微博填写数";
pkey = "workdata.other.wbtx";
threeurl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
four = getCoWorkInfo(startday,endday,employeeId,tenantKey);
fourword = "本年沟通协作数";
pkey = "workdata.other.gtxz";
foururl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
}
oneMap.put("name",oneword);
oneMap.put("value",one);
oneMap.put("url",oneurl);
log.error("1111");
twoMap.put("name",twoword);
twoMap.put("value",two);
twoMap.put("url",twourl);
log.error("2222");
threeMap.put("name",threeword);
threeMap.put("value",three);
threeMap.put("url",threeurl);
log.error("3333");
fourMap.put("name",fourword);
fourMap.put("value",four);
fourMap.put("url",foururl);
log.error("4444");
list.add(oneMap);
list.add(twoMap);
list.add(threeMap);
list.add(fourMap);
recordMap.put("datas",list);
} catch (Exception e) {
e.printStackTrace();
log.error("CockpitWorkAchievementsCmd :" + e);
}
return recordMap;
}
public String getScore( List<Long> userList,String startDay, String endDay,String dateType,String tenantKey) {
String scoreData = "0.00" ;
try {
FlowDataListReq flowDataListReq = new FlowDataListReq();
flowDataListReq.setCurrent(1);
flowDataListReq.setPageSize(20);
flowDataListReq.setStartTime(startDay + "");
flowDataListReq.setEndTime(endDay + "");
flowDataListReq.setDateType(dateType);
flowDataListReq.setTenantKey(tenantKey);
flowDataListReq.setUserList(userList);
FlowData flowData = remotePerformanceService.queryFlowData(flowDataListReq);
log.error("getWholeYearKpi2-flowData:" + flowData);
List<FlowDataListRes> flowDataList = flowData.getDataList();
if (flowDataList.size() > 0) {
for (int index = 0; index < flowDataList.size(); index++) {
FlowDataListRes flowDataListRes = flowDataList.get(index);
float score = flowDataListRes.getScore();
scoreData = score+"";
}
}
} catch (Exception e) {
log.error("getWholeYearKpi2-getScore-Exception:" + e.getMessage());
}
return scoreData;
}
/***
*
* @param startday
* @param endday
* @param employeeId
* @param tenantKey
* @return
*/
public String getQuestInfo(String startday, String endday, String employeeId,String tenantKey) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String quecou = "0";
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
if (StringUtils.isNotBlank(employeeId)) {
String dataSql =" select ifnull(sum(d.integer2),0) as devcou \n" +
" from wfc_form_data l\n" +
" inner join fto_62 d on d.id = l.dataid\n" +
" inner join wfc_requestbase p on p.requestid = l.requestid\n" +
" where d.multiresource5=?\n" +
" and d.date2 >=?" +
" and d.date2 <=?" +
" and d.tenant_key=?\n" +
" and d.is_delete='0'\n" +
" and l.tenant_key=?\n" +
" and l.delete_type=0\n" +
" and p.tenant_key=?\n" +
" and p.delete_type=0\n" +
" order by d.id desc ";
log.info("DevQuestCountCmd dataSql:" + dataSql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenantKey);
strlist.add(tenantKey);
strlist.add(tenantKey);
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(recordList.size()>0){
quecou = String.valueOf(recordList.get(0).get("devcou"));
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return quecou;
}
/**
*
* @param employee
* @return
*/
public String getUserType(SimpleEmployee employee,String tenantkey) {
String sourceType = "LOGIC";
String userType = "3";
try{
long formdata = employee.getFormdata();
String pkey = "field69.groupId";
String groupId = jucailinCockpitUtils.getUfPropData(pkey,tenantkey);
log.error("groupId:"+groupId);
String field69 = "";
String sql =" select field69 from eteams.Hrmemployeedefined where form_data_id = ?" ;
log.error("getSelfServiceData--sql:"+sql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(formdata+"");
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
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)){
switch (field69){
case "1":
userType = "0";
break;
case "2":
userType = "1";
break;
case "3":
userType = "2";
break;
default:
userType = "3";
}
}
}catch (Exception e){
e.printStackTrace();
log.error("getUserType-e:"+e);
}
return userType;
}
/***
*
* @param startday
* @param endday
* @param employeeId
* @return
*/
public String getDaysInfo(String startday, String endday, String employeeId,String tenantKey) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String devcou = "0";
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
if (StringUtils.isNotBlank(employeeId)) {
String dataSql =" select count(1) as devcou \n" +
" from wfc_form_data l\n" +
" inner join fto_83 d on d.id = l.dataid\n" +
" inner join wfc_requestbase p on p.requestid = l.requestid\n" +
" where d.mutiresource= ?\n" +
" and d.xsjfrq >= ?" +
" and d.xsjfrq <= ?" +
" and d.tenant_key= ?\n" +
" and d.is_delete='0'\n" +
" and l.tenant_key=?\n" +
" and l.delete_type=0\n" +
" and p.tenant_key=?\n" +
" and p.delete_type=0\n" +
" order by d.id desc ";
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenantKey);
strlist.add(tenantKey);
strlist.add(tenantKey);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
log.info("DevDaysCountCmd sql:" + dataSql);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
devcou = String.valueOf(recordList.get(0).get("devcou"));
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDaysInfo-Exception:" + e);
}
return devcou;
}
/**
*
*
* @param
* @return
*/
public String getCoWorkInfo(String startday, String endday, String employeeId,String tenantKey) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-cowork-service";
String sourceType = "LOGIC";
String count = "0";
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql =" select count(1) as count from cw_content " +
" where CREATOR=?\n" +
" and left(create_time,10)>=? " +
" and left(create_time,10) <= ?" +
" and tenant_key = ?" +
" and delete_type = 0 ";
log.error("getInteractInfo sql:" + sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenantKey);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (recordList.size() > 0) {
count = String.valueOf(recordList.get(0).get("count"));
}
}catch (Exception e){
e.printStackTrace();
log.error("getCoWorkInfo-Exception:"+e.getMessage());
}
return count;
}
/**
*
*
* @param
* @return
*/
public String getWfInfo(SimpleEmployee employee) {
String wfcount = "0";
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
conditionEntity.setOperatedate(DateTimeConditionEnum.CURRENT_YEAR);
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
int code = requestCountInfo.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
Long count = requestCountInfoPAEntity.getCount();
wfcount = count+"" ;
}
} catch (Exception e) {
e.printStackTrace();
log.error("getWfInfo-Exception:" + e);
}
return wfcount;
}
/***
*
* @param employeeId
* @param startday
* @param endday
* @return
*/
public String getSkInfo(String employeeId,String startday,String endday,String tenantKey) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String skje = "0.00";
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql =" SELECT \n" +
" CONVERT(ifnull(sum(cast(t1.skje as decimal(18,2))),0),CHAR) as skje,\n" + //收款金额
" CONVERT(ifnull(sum(cast(t1.xmskje as decimal(18,2))),0),CHAR) as xmskje,\n" + // 项目收款金额
" CONVERT(ifnull(sum(cast(t1.xsyxje as decimal(18,2))),0),CHAR) as xsyxje," + // 销售有效金额
" CONVERT(ifnull(sum(cast(t1.xsje as decimal(18,2))),0),CHAR) as xsje," + // 销售金额
" CONVERT(ifnull(sum(cast(t1.xmyxje as decimal(18,2))),0),CHAR) as xmyxje," + //项目有效金额
" CONVERT(ifnull(sum(cast(t1.xsjxhk as decimal(18,2))),0),CHAR) as xsjxhk," + //有效绩效回款
" CONVERT(ifnull(sum(cast(t1.sumsk as decimal(18,2))),0),CHAR) as sumsk," + //总收款金额
" CONVERT(ifnull(sum(cast(t1.sjjsk as decimal(18,2))),0),CHAR) as sjjsk," + //实际结算款
" CONVERT(ifnull(sum(cast(t1.skjs as decimal(18,2))),0),CHAR) as skjs " + //收款结算
" FROM uf_jxhs_skmx t1\n" +
" LEFT JOIN uf_jxhs_zxhtzb t2 ON t1.hth = t2.hth AND t2.hth != '' AND t2.hth IS NOT NULL \n" +
" LEFT JOIN ebdf_physical_data epd on t1.id = epd.form_data_id and epd.delete_type = 0 \n" +
" WHERE t1.skje != 0 \n" +
" and t1.skje IS NOT NULL " +
" and t1.xshsny >= ? and t1.xshsny <=? "+
" and (" +
" ? IN ( 2, 27, 166, 10285, 11661, 300, 876, 3593, 1416, 1647, 1844,3044480226941419013,794508876297846787 ) \n" +
" or cast(t1.xsjl AS decimal(25,0)) in( \n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.kfry AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.qdjl AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.xmjl AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" )\n" +
" order by t1.id " ;
log.error("PorojectReceiptsInfoCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
log.error("recordList:"+recordList.size());
if(!CollectionUtils.isEmpty(recordList)){
skje = String.valueOf(recordList.get(0).get("skje"));
}
log.error("skje:"+skje);
} catch (Exception e) {
e.printStackTrace();
log.error("PorojectReceiptsInfoCmd Exception:"+e);
}
return skje;
}
public String getYsInfo(String employeeId,String startday,String endday){
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String htzje = "0.00" ;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql =" select CONVERT(ifnull(sum(cast(t1.htzje as decimal(18,2))),0),CHAR) as htzje," +
" CONVERT(ifnull(sum(cast(t1.htyxje as decimal(18,2))),0),CHAR) as htyxje," +
" CONVERT(ifnull(sum(cast(t1.sumsk as decimal(18,2))),0),CHAR) as sumsk " +
" from uf_jxhs_xmys t1 \n" +
" where t1.ysrq>=? and t1.ysrq<=? " +
" and ( t1.qyjl = ? "+
" or t1.qyjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.ysry = ?\n" +
" or t1.ysry in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.dqfzr = ?\n" +
" or t1.dqfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.tdjl = ?\n" +
" or t1.tdjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.tdfzr = ?\n" +
" or t1.tdfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.jgfzr = ?\n" +
" or t1.jgfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.dqzj = ?\n" +
" or t1.dqzj in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?) " +
" ) " ;
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty() && recordList.size()>0){
htzje = String.valueOf(recordList.get(0).get("htzje"));
}
} catch (Exception e) {
e.printStackTrace();
log.error("PorojectAcceptanceInfoCmd:"+e.getMessage());
}
return htzje;
}
/**
*
* @param
* @return
*/
public String getDocInfo(String startday,String endday,String employeeId,String tenantKey) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
String count = "0";
try{
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql = " select count(1) as count " +
" from document " +
" where CREATOR=?\n" +
" and left(create_time,10)>=? " +
" and left(create_time,10) <= ?" ;
log.error("PortalDocCreateCountCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("count"));
}
}catch (Exception e){
e.printStackTrace();
log.error("getDocInfo-e:"+e);
}
return count;
}
public String getDailyInfo(String startday,String endday,String employeeId,String tenantKey) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-blog-service";
String sourceType = "LOGIC";
String count = "0";
try{
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql =" select count(1) as count\n" +
" from blog " +
" where creator=?\n" +
" and left(BLOG_TIME,10) >=?\n" +
" and left(BLOG_TIME,10) <=?\n" +
" and type='blog'\n" +
" and TENANT_KEY = ?\n" +
" and MODULE = 'blog'\n" +
" and DELETE_TYPE = 0\n" +
" and CONTENT is not null" ;
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenantKey);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("count"));
}
}catch (Exception e){
e.printStackTrace();
log.error("getDailyInfo-e:"+e);
}
return count;
}
public static String parseJe(String value){
if("".equals(value)){
return "0.00";
}
BigDecimal dividend = new BigDecimal(value); // 被除数
BigDecimal divisor = new BigDecimal("10000"); // 除数
// 设置小数点后两位,并进行四舍五入
BigDecimal result = dividend.divide(divisor, 2, RoundingMode.HALF_UP);
return result.toString();
}
}

@ -0,0 +1,216 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.project.entity.SimpleMainline;
import com.weaver.project.service.RemoteMainlineService;
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.teams.core.orm.mybatis.Page;
import com.weaver.teams.domain.crm.RemoteCustomerService;
import com.weaver.teams.domain.crm.SimpleCustomer;
import com.weaver.teams.domain.user.SimpleEmployee;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
/**
* 4
*
* @author shil
* @version 1.00
* @Date 2024/5/22
*/
@Component
public class CockpitWorkDate3TypeCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitWorkDate3TypeCmd.class);
@RpcReference
RemoteCustomerService remoteCustomerService;
@RpcReference
RemoteMainlineService remoteMainlineService ;
@Autowired
private DatabaseUtils databaseUtils;
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap,String tenantKey) {
Map<String, Object> recordMap = new HashMap<String, Object>();
List<SimpleMainline> projectList = new ArrayList<SimpleMainline>();
List<SimpleCustomer> customerList = new ArrayList<SimpleCustomer>();
List<Map<String,Object>> getProjectDate2 = new ArrayList<Map<String,Object>>();
try {
projectList = getProjectDate(employee,tenantKey);
customerList = getCustomerDate(employee,tenantKey);
getProjectDate2 = getProjectDate2(employee,tenantKey);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
recordMap.put("projectList",projectList);
recordMap.put("customerList",customerList);
recordMap.put("getProjectDate2",getProjectDate2);
return recordMap;
}
/***
*
* @return
*/
public List<SimpleMainline> getProjectDate(SimpleEmployee employee,String tenantKey) {
List<SimpleMainline> projectList = new ArrayList<SimpleMainline>(100);
try {
SimpleMainline mainline = new SimpleMainline();
Page<SimpleMainline> page = new Page<SimpleMainline>();
page.setPageNo(0);
page.setPageSize(20);
projectList = remoteMainlineService.search(mainline,page);
log.error("projectList"+projectList.size());
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return projectList;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public List<SimpleCustomer> getCustomerDate(SimpleEmployee employee,String tenantKey) {
List<SimpleCustomer> customerList = new ArrayList<SimpleCustomer>(100);
try {
Page<SimpleCustomer> page = new Page<SimpleCustomer>();
page.setPageNo(0);
page.setPageSize(20);
Page<SimpleCustomer> customerPage = remoteCustomerService.findCustomerByTenantKey(tenantKey,page);
log.error("customerList"+customerPage.getTotalCount());
customerList = customerPage.getResult();
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return customerList;
}
public List<Map<String,Object>> getProjectDate2(SimpleEmployee employee, String tenantKey) {
List<Map<String,Object>> projectList = new ArrayList<Map<String,Object>>();
String groupId = "weaver-project-service";
String sourceType = "LOGIC";
String groupid = "4527875868755238091";
long employeeid = employee.getEmployeeId();
try {
String sql =" select w.* from (\n" +
" select convert(m.id,char) as mainline_id,m.name as mainline_name,\n" +
" convert(m.manager,char) as manager_id,\n" +
" convert(p.rel_custom,char) as rel_custom,p.proj_amount,p.proj_approval_date,\n" +
" p.actual_val_date \n" +
" from ec_customerservice.mainline m \n" +
" inner JOIN ec_customerservice.mainline_form_data f ON f.mainline_id = m.id \n" +
" inner join ec_customerservice.proj_pms_base p on p.form_data_id = f.form_data_id \n" +
" inner join ec_customerservice.mainline_status_custom msc on msc.mainline_id = m.id \n" +
" inner join ec_customerservice.mainline_cust_status mcs on msc.status_id = mcs.id\n" +
" where m.group_id = ? \n" +
" and m.manager in( select id\n" +
" from eteams.employee \n" +
" where (superior = ? or id = ?)\n" +
" and status='normal'\n" +
" and delete_type=0" +
" and tenant_key = ?\n" +
" and password is not null\n" +
" )\n" +
" and m.delete_type = 0 \n" +
" and m.tenant_key = ?\n" +
" and f.delete_type = 0 \n" +
" and f.tenant_key = ?\n" +
" and p.delete_type = 0\n" +
" and p.tenant_key = ?\n" +
" and msc.delete_type = 0\n" +
" and msc.tenant_key = ?\n" +
" and mcs.delete_type = 0\n" +
" and mcs.tenant_key = ?\n" +
" and mcs.enabled = 1 \n" +
" and mcs.name <> '结案'\n" +
" order by m.create_time desc\n" +
") w limit 6";
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(groupid);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeid+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeid+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey+"");
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
projectList = databaseUtils.getDataSourceList(result);
} catch (Exception e) {
e.printStackTrace();
log.error("getProjectDate2-Exception:" + e);
}
return projectList;
}
}

@ -0,0 +1,561 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.calendar.service.RemoteAgendaService;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
import com.weaver.teams.client.doc.remote.DocClientService;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import com.weaver.workrelate.performance.api.rest.RemotePerformanceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
/**
* 4
*
* @author shil
* @version 1.00
* @Date 2024/5/22
*/
@Component
public class CockpitWorkDate4TypeCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitWorkDate4TypeCmd.class);
@RpcReference
public RemotePerformanceService remotePerformanceService;
@Autowired
private JucailinCockpitUtils jucailinCockpitUtils;
@Autowired
private DatabaseUtils databaseUtils;
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
@RpcReference
DocClientService docClientService;
@RpcReference
RemoteAgendaService remoteAgendaService;
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap,String tenantKey) {
Map<String, Object> recordMap = new HashMap<String, Object>();
List<Map<String,String>> wfList = new ArrayList<Map<String,String>>();
List<Map<String,String>> docList = new ArrayList<Map<String,String>>();
List<Map<String,String>> coworkList = new ArrayList<Map<String,String>>();
List<Map<String,String>> calendarList = new ArrayList<Map<String,String>>();
try {
wfList = getWorkflowDate(employee,tenantKey);
docList = getDocumentDate(employee,tenantKey);
coworkList = getCoWorkDate(employee,tenantKey);
calendarList = getCalendarDate(employee,tenantKey);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
recordMap.put("wfdata",wfList);
recordMap.put("docdata",docList);
recordMap.put("coworkdata",coworkList);
recordMap.put("calendardata",calendarList);
return recordMap;
}
/***
*
* @return
*/
public List<Map<String,String>> getWorkflowDate(SimpleEmployee employee,String tenantKey) {
List<Map<String,String>> wflist = new ArrayList<>(100);
try {
Map<String,String> wfMap = new HashMap<String,String>();
String wf_count1 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid());
String wf_name1 = "待办流程数";
String wf_pkey1 = "workflow.todo.amount";
String wf_url1 = jucailinCockpitUtils.getUfPropData(wf_pkey1,tenantKey);
wfMap.put("count",wf_count1);
wfMap.put("name",wf_name1);
wfMap.put("url",wf_url1);
wflist.add(wfMap);
wfMap = new HashMap<String,String>();
String wf_count2 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid());
String wf_name2 = "我发起的流程";
String wf_pkey2 = "workflow.mine.amount";
String wf_url2 = jucailinCockpitUtils.getUfPropData(wf_pkey2,tenantKey);
wfMap.put("count",wf_count2);
wfMap.put("name",wf_name2);
wfMap.put("url",wf_url2);
wflist.add(wfMap);
wfMap = new HashMap<String,String>();
String wf_count3 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid());
String wf_name3 = "已办流程";
String wf_pkey3 = "workflow.done.amount";
String wf_url3 = jucailinCockpitUtils.getUfPropData(wf_pkey3,tenantKey);
wfMap.put("count",wf_count3);
wfMap.put("name",wf_name3);
wfMap.put("url",wf_url3);
wflist.add(wfMap);
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return wflist;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public List<Map<String,String>> getDocumentDate(SimpleEmployee employee,String tenantKey) {
List<Map<String,String>> doclist = new ArrayList<>(100);
try {
long employeeId = employee.getEmployeeId();
Map<String,String> docMap = new HashMap<String,String>();
String doc_count1 = getDocumentDateAmount(employeeId,"1",tenantKey);
String doc_name1 = "创建文档";
String doc_pkey1 = "document.create.amount";
String doc_url1 = jucailinCockpitUtils.getUfPropData(doc_pkey1,tenantKey);
docMap.put("count",doc_count1);
docMap.put("name",doc_name1);
docMap.put("url",doc_url1);
doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count2 = getDocumentDateAmount(employeeId,"2",tenantKey);
String doc_name2 = "查阅文档";
String doc_pkey2 = "document.read.amount";
String doc_url2 = jucailinCockpitUtils.getUfPropData(doc_pkey2,tenantKey);
docMap.put("count",doc_count2);
docMap.put("name",doc_name2);
docMap.put("url",doc_url2);
doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count3 = getDocumentDateAmount(employeeId,"3",tenantKey);
String doc_name3 = "查阅次数";
String doc_pkey3 = "document.number.amount";
String doc_url3 = jucailinCockpitUtils.getUfPropData(doc_pkey3,tenantKey);
docMap.put("count",doc_count3);
docMap.put("name",doc_name3);
docMap.put("url",doc_url3);
doclist.add(docMap);
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return doclist;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public List<Map<String,String>> getCoWorkDate(SimpleEmployee employee,String tenantKey) {
List<Map<String,String>> datalist = new ArrayList<>(100);
try {
long employeeId = employee.getEmployeeId();
Map<String,String> coworkMap = new HashMap<String,String>();
String cowork_count = getCoWorkDateAmount(employeeId,"1",tenantKey);
String cowork_name = "协作区发表";
String cowork_pkey = "cowork.create.amount";
String cowork_url = jucailinCockpitUtils.getUfPropData(cowork_pkey,tenantKey);
coworkMap.put("count",cowork_count);
coworkMap.put("name",cowork_name);
coworkMap.put("url",cowork_url);
datalist.add(coworkMap);
Map<String,String> imMap = new HashMap<String,String>();
String im_count2 = getCoWorkDateAmount(employeeId,"2",tenantKey);
String im_name2 = "参与群聊";
String im_pkey2 = "im.group.amount";
String im_url2 = jucailinCockpitUtils.getUfPropData(im_pkey2,tenantKey);
imMap.put("count",im_count2);
imMap.put("name",im_name2);
imMap.put("url",im_url2);
datalist.add(imMap);
imMap = new HashMap<String,String>();
String im_count3 = getCoWorkDateAmount(employeeId,"3",tenantKey);
String im_name3 = "平均每日沟通人数";
String im_pkey3 = "im.chatday.amount";
String im_url3 = jucailinCockpitUtils.getUfPropData(im_pkey3,tenantKey);
imMap.put("count",im_count3);
imMap.put("name",im_name3);
imMap.put("url",im_url3);
datalist.add(imMap);
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return datalist;
}
public List<Map<String,String>> getCalendarDate(SimpleEmployee employee,String tenantKey) {
List<Map<String,String>> datalist = new ArrayList<>(100);
try {
long employeeId = employee.getEmployeeId();
Map<String,String> calendarMap = new HashMap<String,String>();
String calendar_count = getCalendarDateAmount(employeeId,"1",tenantKey);
String calendar_name = "日程";
String calendar_pkey = "calendar.create.amount";
String calendar_url = jucailinCockpitUtils.getUfPropData(calendar_pkey,tenantKey);
calendarMap.put("count",calendar_count);
calendarMap.put("name",calendar_name);
calendarMap.put("url",calendar_url);
datalist.add(calendarMap);
calendarMap = new HashMap<String,String>();
String calendar_count2 = getCalendarDateAmount(employeeId,"2",tenantKey);
String calendar_name2 = "我的任务";
String calendar_pkey2 = "task.mine.amount";
String calendar_url2 = jucailinCockpitUtils.getUfPropData(calendar_pkey2,tenantKey);
calendarMap.put("count",calendar_count2);
calendarMap.put("name",calendar_name2);
calendarMap.put("url",calendar_url2);
datalist.add(calendarMap);
calendarMap = new HashMap<String,String>();
String calendar_count3 = getCalendarDateAmount(employeeId,"3",tenantKey);
String calendar_name3 = "关注任务";
String calendar_pkey3 = "task.watch.amount";
String calendar_url3 = jucailinCockpitUtils.getUfPropData(calendar_pkey3,tenantKey);
calendarMap.put("count",calendar_count3);
calendarMap.put("name",calendar_name3);
calendarMap.put("url",calendar_url3);
datalist.add(calendarMap);
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return datalist;
}
/**
*
*
* @param employeeId
* @return
*/
public String getCoWorkDateAmount(Long employeeId,String type,String tenantKey) {
String count = "0";
if("1".equals(type)){
String groupId = "weaver-cowork-service";
String sourceType = "LOGIC";
String sql =" select count(1) as cou " +
" from cw_content " +
" where creator=?\n" +
" and delete_type = 0\n" +
" and tenant_key= ? " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou"));
}
}else if("2".equals(type)){
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql =" select amount " +
" from uf_nj_pjmrdlhhsl " +
" where ry = ?\n" +
" and delete_type = 0\n" +
" and tenant_key= ? " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("amount"));
}
}else if("3".equals(type)){
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql =" select amount " +
" from uf_nj_cyqltjb " +
" where ry = ?\n" +
" and delete_type = 0\n" +
" and tenant_key= ? " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("amount"));
}
}
return count;
}
public String getDocumentDateAmount(Long employeeId,String type,String tenantKey) {
String count = "0";
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
try {
if("1".equals(type)){
int doccreatecount = docClientService.countByCreator(employeeId);
count = doccreatecount + "";
}else if("2".equals(type)){
String sql =" select count(1) as cou " +
" from document " +
" where id in( select targetid from doc_documentlogs where log_operator <> ? and operatetype = 'read' and delete_type = 0 and tenant_key=? and doc_status = 2 ) \n" +
" and creator = ?\n" +
" and delete_type = 0\n" +
" and tenant_key= ? " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou"));
}
}else if("3".equals(type)){
String sql =" select count(1) as cou \n" +
" from doc_documentlogs \n" +
" where targetid in( select id from document where creator = ? and delete_type = 0 and tenant_key=? and doc_status = 2) \n" +
" and log_operator <> ? \n" +
" and OPERATETYPE = 'read' \n" +
" and delete_type = 0 \n" +
" and tenant_key=? " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou"));
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return count;
}
public String getCalendarDateAmount(Long employeeId,String type,String tenantKey) {
String count = "0";
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
try {
if("1".equals(type)){
int clendarcount = remoteAgendaService.countCalendar(employeeId,tenantKey);
count = clendarcount + "";
}else if("2".equals(type)){
String sql =" select count(1) as cou " +
" from task " +
" where creator = ? \n" +
" and STATUS = 'todo'\n" +
" and delete_type = 0\n" +
" and tenant_key= ? " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou"));
}
}else if("3".equals(type)){
String sql =" select count(1) as cou \n" +
" from my_watch \n" +
" where watcher = ? \n" +
" and module='task' \n" +
" and delete_type = 0 \n" +
" and tenant_key=? " ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou"));
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return count;
}
/**
*
* @param employee
* @return
*/
public String getWorkflowDataAmount(SimpleEmployee employee,int Type) {
Map<String,Object> data = new HashMap<>(100);
String count = "0";
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
// conditionEntity.setOperatedate(DateTimeConditionEnum.CURRENT_YEAR);
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, Type, conditionEntity);
int code = requestCountInfo.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
count = String.valueOf(requestCountInfoPAEntity.getCount());
}
} catch (Exception e) {
log.error("PortalWfDealCountCmd-Exception:" + e);
}
return count;
}
}

@ -0,0 +1,373 @@
package com.weaver.seconddev.cockpit.cmd;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
import com.weaver.seconddev.jcldoor.util.CommonUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.workflow.common.constant.list.api.DateTimeConditionEnum;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestListInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
/**
* 4
*
* @author shil
* @version 1.00
* @Date 2024/5/22
*/
@Component
public class CockpitWorkflowAnalysisCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(CockpitWorkflowAnalysisCmd.class);
@Autowired
private JucailinCockpitUtils jucailinCockpitUtils;
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
@Autowired
private DatabaseUtils databaseUtils;
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap,String tenantKey) {
Map<String, Object> recordMap = new HashMap<String, Object>();
try {
List<Map<String,String>> dataList = getWorkflowDate(employee,tenantKey);
recordMap.put("leftdata",dataList);
List<Map<String,Object>> rightList = getRightViewData(employee,tenantKey);
recordMap.put("rightdata",rightList);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
return recordMap;
}
/***
*
* @return
*/
public List<Map<String,String>> getWorkflowDate(SimpleEmployee employee,String tenantKey) {
List<Map<String,String>> wflist = new ArrayList<>(100);
try {
Map<String,String> wfMap = new HashMap<String,String>();
String wf_count1 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid());
String wf_name1 = "待处理流程数量";
String wf_pkey1 = "workflow.todo.amount";
String wf_url1 = jucailinCockpitUtils.getUfPropData(wf_pkey1,tenantKey);
wfMap.put("count",wf_count1);
wfMap.put("name",wf_name1);
wfMap.put("url",wf_url1);
wfMap.put("key","dcllcsl");
wflist.add(wfMap);
wfMap = new HashMap<String,String>();
String wf_count2 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid());
String wf_name2 = "我创建的流程";
String wf_pkey2 = "workflow.mine.amount";
String wf_url2 = jucailinCockpitUtils.getUfPropData(wf_pkey2,tenantKey);
wfMap.put("count",wf_count2);
wfMap.put("name",wf_name2);
wfMap.put("url",wf_url2);
wfMap.put("key","wcjdlc");
wflist.add(wfMap);
wfMap = new HashMap<String,String>();
String wf_count3 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid());
String wf_name3 = "我处理的流程";
String wf_pkey3 = "workflow.done.amount";
String wf_url3 = jucailinCockpitUtils.getUfPropData(wf_pkey3,tenantKey);
wfMap.put("count",wf_count3);
wfMap.put("name",wf_name3);
wfMap.put("url",wf_url3);
wfMap.put("key","wcldlc");
wflist.add(wfMap);
wfMap = new HashMap<String,String>();
String wf_count4 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.SUPERVISE_ALL.getTabid());
String wf_name4 = "我督办的流程";
String wf_pkey4 = "workflow.supervise.amount";
String wf_url4 = jucailinCockpitUtils.getUfPropData(wf_pkey4,tenantKey);
wfMap.put("count",wf_count4);
wfMap.put("name",wf_name4);
wfMap.put("url",wf_url4);
wfMap.put("key","wdbdlc");
wflist.add(wfMap);
wfMap = new HashMap<String,String>();
String wf_count5 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.ATTENTION_ALL.getTabid());
String wf_name5 = "我关注的流程";
String wf_pkey5 = "workflow.attention.amount";
String wf_url5 = jucailinCockpitUtils.getUfPropData(wf_pkey5,tenantKey);
wfMap.put("count",wf_count5);
wfMap.put("name",wf_name5);
wfMap.put("url",wf_url5);
wfMap.put("key","wgzdlc");
wflist.add(wfMap);
List<Map<String,String>> daylist = getWorkflowDayOperateCount(employee,tenantKey,wf_count3,wf_count2);
wflist.addAll(daylist);
wfMap = getWorkflowOperateAverageTime(employee,tenantKey);
wflist.add(wfMap);
} catch (Exception e) {
e.printStackTrace();
log.error("DevQuestCountCmd-Exception:" + e);
}
return wflist;
}
/**
*
* @param employee
* @return
*/
public String getWorkflowDataAmount(SimpleEmployee employee,int Type) {
String count = "0";
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, Type, conditionEntity);
int code = requestCountInfo.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
count = String.valueOf(requestCountInfoPAEntity.getCount());
}
} catch (Exception e) {
log.error("PortalWfDealCountCmd-Exception:" + e);
}
return count;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public Map<String,String> getWorkflowOperateAverageTime(SimpleEmployee employee,String tenantKey) {
String count = "0.0";
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
conditionEntity.setOperatedate(DateTimeConditionEnum.CURRENT_YEAR);
int wfcount = 0 ;
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
log.error("requestCountInfo--:"+requestCountInfo.toString());
int code1 = requestCountInfo.getCode();
log.error("code1--:"+code1);
if(code1 == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
Long wf_count = requestCountInfoPAEntity.getCount();
log.error("wfcount--:"+wfcount);
wfcount = wf_count.intValue();
}
if(wfcount > 0){
WeaResult<List<RequestListInfoPAEntity>> requestListData = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), 1, wfcount, conditionEntity);
int code2 = requestListData.getCode();
if(code2 == 200){
Long minutescount = 0L;
List<RequestListInfoPAEntity> requestCountInfoPAEntityList = requestListData.getData();
int requestLength = requestCountInfoPAEntityList.size() ;
log.error("requestLength:"+requestLength);
for(int i=0;i<requestLength;i++){
RequestListInfoPAEntity requestListInfoPAEntity = requestCountInfoPAEntityList.get(i);
LocalDateTime receiveDateTime = requestListInfoPAEntity.getReceiveTime();
LocalDateTime operateDateTime = requestListInfoPAEntity.getOperateTime();
// log.error("receiveDateTime:"+receiveDateTime);
// log.error("operateDateTime:"+operateDateTime);
Long minutesDiff = ChronoUnit.MINUTES.between(receiveDateTime, operateDateTime);
// log.error("minutesDiff:"+minutesDiff);
minutescount += minutesDiff ;
}
log.error("minutescount:"+minutescount);
if(requestLength > 0 && minutescount > 0){
double average = minutescount/requestLength ;
count = String.valueOf(average);
}
}
}
} catch (Exception e) {
log.error("PortalWfDealCountCmd-Exception:" + e);
}
Map<String,String> wfMap = new HashMap<String,String>();
String wf_name1 = "平均流程处理时间";
String wf_pkey1 = "workflow.processtime.amount";
String wf_url1 = jucailinCockpitUtils.getUfPropData(wf_pkey1,tenantKey);
wfMap.put("count",count);
wfMap.put("name",wf_name1);
wfMap.put("url",wf_url1);
wfMap.put("key","pjlcclsj");
return wfMap;
}
public List<Map<String,String>> getWorkflowDayOperateCount(SimpleEmployee employee,String tenantKey,String wf_count3,String wf_count2) {
String count2 = "0.0";
String count3 = "0.0";
String diffdays = "1";
log.error("wf_count3:"+wf_count3);
log.error("wf_count2:"+wf_count2);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
log.error("wf_count3:"+wf_count3);
try{
long employeeId = employee.getEmployeeId();
String dataSql =" select a.hiredate,datediff(curdate(),a.hiredate) as diffdays " +
" from eteams.employee a " +
" 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(tenantKey);
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)) {
Map<String, Object> recordMap = recordList.get(0);
diffdays = CommonUtils.null2String(recordMap.get("diffdays"));
}
log.error("diffdays:"+diffdays);
if(StringUtils.isNotBlank(wf_count3) && StringUtils.isNotBlank(diffdays)){
Long dealcount = Long.parseLong(wf_count3);
Long days = Long.parseLong(diffdays);
BigDecimal bg = new BigDecimal((double) dealcount/(days*1.00));
count3 = String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
if(StringUtils.isNotBlank(wf_count2) && StringUtils.isNotBlank(diffdays)){
Long dealcount = Long.parseLong(wf_count2);
Long days = Long.parseLong(diffdays);
BigDecimal bg = new BigDecimal((double) dealcount/(days*1.00));
count2 = String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
} catch (Exception e) {
log.error("PortalWfDealCountCmd-Exception:" + e);
}
List<Map<String,String>> dayList = new ArrayList<Map<String,String>>();
Map<String,String> wfMap = new HashMap<String,String>();
String wf_name2 = "平均每日发起流程";
String wf_pkey2 = "workflow.daily.create.amount";
String wf_url2 = jucailinCockpitUtils.getUfPropData(wf_pkey2,tenantKey);
wfMap.put("count",count2);
wfMap.put("name",wf_name2);
wfMap.put("url",wf_url2);
wfMap.put("key","pjmrfqlc");
dayList.add(wfMap);
wfMap = new HashMap<String,String>();
String wf_name3 = "平均每日处理流程";
String wf_pkey3 = "workflow.daily.process.amount";
String wf_url3 = jucailinCockpitUtils.getUfPropData(wf_pkey3,tenantKey);
wfMap.put("count",count3);
wfMap.put("name",wf_name3);
wfMap.put("url",wf_url3);
wfMap.put("key","pjmrcllc");
dayList.add(wfMap);
return dayList;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public List<Map<String,Object>> getRightViewData(SimpleEmployee employee,String tenantKey){
List<Map<String,Object>> recordList = new ArrayList<Map<String,Object>>();
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
Long employeeId = employee.getEmployeeId();
log.error("employeeId2:"+employeeId);
try {
String sql =" select w.workflowid,w.workflowname,w.cou " +
" from (\n" +
" select p.workflowid,p.workflowname,p.cou\n" +
" from (\n" +
" select t.workflowid,p.workflowname,count(1) as cou \n" +
" from wfc_requestbase t\n" +
" inner join wfp_base p on p.id = t.workflowid\n" +
" where t.userid = ? \n" +
" and t.delete_type=0\n" +
" and p.delete_type=0\n" +
" and t.tenant_key= ? \n" +
" and p.tenant_key = ?" +
" group by t.workflowid,p.workflowname\n" +
" ) p order by p.cou desc \n" +
" ) w limit 5" ;
log.error("sql2:"+sql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.LONG);
sqlParamEntity.setValue(employeeId+"");
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
recordList = databaseUtils.getDataSourceList(result);
} catch (Exception e) {
e.printStackTrace();
log.error("getRightViewData2:" + e);
}
return recordList;
}
}

@ -0,0 +1,202 @@
package com.weaver.seconddev.cockpit.controller;
import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.seconddev.cockpit.service.JucailinCockpitService;
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 javax.servlet.http.HttpServletRequest;
import java.util.*;
@RestController
@RequestMapping("/api/secondev/njjucailin/cockpit")
public class JucailinCockpitController {
private final Logger log = LoggerFactory.getLogger(JucailinCockpitController.class);
public String tenant_key = "t7akvdnf84" ;
@Autowired
private JucailinCockpitService jucailinCockpitService;
@Autowired
private JucailinCockpitUtils jucailinCockpitUtils;
/**
*
* @param request
* @return
*/
@GetMapping("/getMonthPerformanceData")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getMonthPerformanceData(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinCockpitService.getMonthPerformanceData(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("testSapi-Exception:"+e);
}
return WeaResult.success(recordMap);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getWorkAchievementsData")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getWorkAchievementsData(HttpServletRequest request){
log.error("getWorkData");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
try{
dataList = jucailinCockpitService.getWorkAchievementsData(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
@GetMapping("/getUserData4Type")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getUserData4Type(HttpServletRequest request){
log.error("getUserData4Type");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
try{
dataList = jucailinCockpitService.getUserData4Type(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
@GetMapping("/getWorkflowAnalysis")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getWorkflowAnalysis(HttpServletRequest request){
log.error("getWorkflowAnalysis");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
try{
dataList = jucailinCockpitService.getWorkflowAnalysis(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
@GetMapping("/getDocmentAnalysis")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getDocmentAnalysis(HttpServletRequest request){
log.error("getDocmentAnalysis");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
try{
dataList = jucailinCockpitService.getDocmentAnalysis(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
@GetMapping("/getUserInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getUserData(HttpServletRequest request){
log.error("getWorkData");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
try{
dataList = jucailinCockpitService.getUserInfo(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getUserData3Type")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getUserData3Type(HttpServletRequest request){
log.error("getWorkData");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
try{
dataList = jucailinCockpitService.getUserData3Type(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
@GetMapping("/getProjectData")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getProjectData(HttpServletRequest request){
log.error("getWorkData");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
try{
dataList = jucailinCockpitService.getProjectData(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
@GetMapping("/getBlogData")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getBlogData(HttpServletRequest request){
log.error("getWorkData");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
Map<String,Object> params = jucailinCockpitUtils.request2Map(request);
try{
dataList = jucailinCockpitService.getBlogData(simpleEmployee,params,tenant_key);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
}

@ -0,0 +1,28 @@
package com.weaver.seconddev.cockpit.service;
import com.weaver.teams.domain.user.SimpleEmployee;
import java.util.Map;
public interface JucailinCockpitService {
Map<String, Object> getMonthPerformanceData(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getWorkAchievementsData(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getUserData4Type(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getWorkflowAnalysis(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getDocmentAnalysis(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getUserInfo(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getUserData3Type(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getProjectData(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getBlogData(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
}

@ -0,0 +1,100 @@
package com.weaver.seconddev.cockpit.service.impl;
import com.weaver.seconddev.cockpit.cmd.*;
import com.weaver.seconddev.cockpit.service.JucailinCockpitService;
import com.weaver.teams.domain.user.SimpleEmployee;
import groovy.util.logging.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Slf4j
@Service
public class JucailinCockpitServiceimpl implements JucailinCockpitService {
@Autowired
private CockpitMonthPerformanceInfoCmd cockpitMonthPerformanceInfoCmd;
@Autowired
private CockpitWorkAchievementsCmd cockpitWorkAchievementsCmd;
@Autowired
private CockpitWorkDate4TypeCmd cockpitWorkDate4TypeCmd;
@Autowired
private CockpitDocumentAnalysisCmd cockpitDocumentAnalysisCmd;
@Autowired
private CockpitWorkflowAnalysisCmd cockpitWorkflowAnalysisCmd;
@Autowired
private CockpitUserDataCmd cockpitUserDataCmd;
@Autowired
private CockpitBlogDataCmd cockpitBlogDataCmd;
@Autowired
private CockpitWorkDate3TypeCmd cockpitWorkDate3TypeCmd;
@Autowired
private CockpitProjectDataCmd cockpitProjectDataCmd;
@Override
public Map<String, Object> getMonthPerformanceData(SimpleEmployee simpleEmployee, Map<String, Object> paramMap,String tenantKey) {
Map<String,Object> dataMap = cockpitMonthPerformanceInfoCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getWorkAchievementsData(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitWorkAchievementsCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getUserData4Type(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitWorkDate4TypeCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getWorkflowAnalysis(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitWorkflowAnalysisCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getDocmentAnalysis(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitDocumentAnalysisCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getUserInfo(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitUserDataCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getUserData3Type(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitWorkDate3TypeCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getProjectData(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitProjectDataCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getBlogData(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitBlogDataCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
}

@ -0,0 +1,395 @@
package com.weaver.seconddev.cockpit.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Component
public class CommonUtils {
private final static Logger log = LoggerFactory.getLogger(CommonUtils.class);
public static JSONObject toJSON(String data){
if(!StringUtils.isEmpty(data)){
try {
return JSONObject.parseObject(data);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static Long getJSONLong(JSONObject json,String key){
if(json != null && json.containsKey(key)){
try {
return json.getLong(key);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static Integer getJSONInteger(JSONObject json,String key){
if(json != null && json.containsKey(key)){
try {
return json.getInteger(key);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return -1;
}
public static String getJSONString(JSONObject json,String key){
if(json != null && json.containsKey(key)){
try {
return null2String(json.getString(key));
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return "";
}
public static JSONObject getJSONObject(JSONObject json,String key){
if(json != null && json.containsKey(key)){
try {
return json.getJSONObject(key);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static JSONArray getJSONArray(JSONObject json, String key){
if(json != null && json.containsKey(key)){
try {
return json.getJSONArray(key);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static JSONObject getJSONObject(JSONArray json, int idx){
if(json != null && json.size() > idx){
try {
return json.getJSONObject(idx);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static String mapToStrData(Map<String, Object> para){
if(para != null) {
return JSONObject.toJSON(para).toString();
}
return "";
}
public static void strToLongList(List<Long> list,String strs){
strToLongList(list,strs,true);
}
public static void strToLongList(List<Long> list,String strs,boolean isDist){
if(list == null){
return;
}
if(StringUtils.isEmpty(strs)){
return;
}
String[] strList = StringUtils.split(strs, ",");
for(String str:strList){
if(StringUtils.isEmpty(str)){
continue;
}
long id = getLongValue(str);
if(id > 0l && (isDist == false || !list.contains(id))){
list.add(id);
}
}
}
public static long getLongValue(Object v){
return getLongValue(null2String(v));
}
public static long getLongValue(String v) {
return getLongValue(v, -1);
}
public static long getLongValue(String v, long def) {
try {
return Long.parseLong(v);
} catch (Exception ex) {
return def;
}
}
public static int getIntValue(Object o){
return getIntValue(null2String(o));
}
public static int getIntValue(String s){
return getIntValue(s,-1);
}
public static int getIntValue(String s, int def){
try {
return NumberUtils.toInt(s);
} catch (Exception ex) {
return def;
}
}
public static String null2String(Object s) {
return s == null ? "" : s.toString();
}
public static String null2String(Object s, String def) {
return s == null ? (def == null ? "" : def) : s.toString();
}
public static String stringReplace(String sou, String s1, String s2) {
//int idx = sou.indexOf(s1);
//if (idx < 0) {
// return sou;
//}
//return sou.substring(0, idx) + s2 + StringReplace(sou.substring(idx + s1.length()), s1, s2);
sou = null2String(sou);
s1 = null2String(s1);
s2 = null2String(s2);
try{
sou = sou.replace(s1, s2);
}catch(Exception e){
//System.out.println(e);//将未知异常打印出来,便于检查错误。
}
return sou;
}
/**
*
*
* @param s
* @return
*/
public static String toScreen(String s) {
char c[] = s.toCharArray();
char ch;
int i = 0;
StringBuffer buf = new StringBuffer();
while (i < c.length) {
ch = c[i++];
if (ch == '\r')
buf.append("");
else if (ch == '\n')
buf.append("");
else
buf.append(ch);
}
return buf.toString();
}
/**
*
*
* @param s
* @return
*/
public static String toExcel(String s) {
if (s == null) return "";
//因本方法会将字符串 &符号转换故先将欧元符号转义符转换为其Unicode码
s = s.replaceAll("&euro;", "\u20AC");
String str = toScreen(s);
str = stringReplace(str, "&ang;", "∠");
str = stringReplace(str, "&phi;", "φ");
str = stringReplace(str, "&quot;", "\"");
str = stringReplace(str, "&nbsp", "%nbsp");
//str=Util.StringReplace(str,"'","");
str = stringReplace(str, "&lt;", "<");
str = stringReplace(str, "&gt;", ">");
str = stringReplace(str, "&dt;&at;", "<br>");
str = stringReplace(str, "&", "&amp;");
str = stringReplace(str, "<br>", "&dt;&at;");
if ("&dt;&at;".equals(str)) {
str = "";
}
//在方法最后,又将欧元符号置换为转义符
str = str.replaceAll("\u20AC", "&euro;");
return str;
}
public static String delHtml(final String inputString) {
String htmlStr = toExcel(inputString); // 含html标签的字符串
String textStr = "";
java.util.regex.Pattern p_script;
java.util.regex.Matcher m_script;
java.util.regex.Pattern p_html;
java.util.regex.Matcher m_html;
try {
String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
String regEx_script = "<[/s]*?script[^>]*?>[/s/S]*?<[/s]*?//[/s]*?script[/s]*?>"; // 定义script的正则表达式{或<script[^>]*?>[/s/S]*?<//script>
p_script = java.util.regex.Pattern.compile(regEx_script, java.util.regex.Pattern.CASE_INSENSITIVE);
m_script = p_script.matcher(htmlStr);
htmlStr = m_script.replaceAll(""); // 过滤script标签
p_html = java.util.regex.Pattern.compile(regEx_html, java.util.regex.Pattern.CASE_INSENSITIVE);
m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll(""); // 过滤html标签
textStr = htmlStr;
} catch (Exception e) {
System.err.println("Html2Text: " + e.getMessage());
}
return htmlToTxt(textStr).trim();// 返回文本字符串
}
/**
* html
*
* @param input
* @return
*/
public static String htmlToTxt(String input) {
if (input == null || input.trim().equals("")) {
return "";
}
// 去掉所有html元素,
String str = input.replaceAll("<[a-zA-Z]+[1-9]?[^><]*>", "");
return str;
}
//==new=
public static int getIntValue(Object s, int def){
return getIntValue(null2String(s));
}
public static List<Long> strToLongList(String strs){
List<Long> list = new ArrayList<Long>();
strToLongList(list,strs,true);
return list;
}
public static int dateInterval(String fromdate, String todate) {
Calendar fromcalendar = getCalendar(fromdate);
Calendar tocalendar = getCalendar(todate);
if (fromcalendar == null || tocalendar == null)
return 0;
return (int) ((tocalendar.getTimeInMillis() - fromcalendar.getTimeInMillis()) / 3600 / 24 / 1000);
}
/**
* @param datetime - '2004-05-12 12:00:23' '2004-05-12'
* @return null
*/
public static Calendar getCalendar(String datetime) {
int datetimelength = datetime.length() ;
switch(datetimelength) {
case 19 :
return getCalendar(datetime , "yyyy'-'MM'-'dd' 'HH:mm:ss") ;
case 10 :
return getCalendar(datetime , "yyyy'-'MM'-'dd") ;
default :
return null ;
}
}
/**
* @param datetime -
* @param formart -
* @return null
*/
public static Calendar getCalendar(String datetime, String formart) {
SimpleDateFormat SDF = new SimpleDateFormat(formart) ;
Calendar calendar = Calendar.getInstance() ;
try {
calendar.setTime(SDF.parse(datetime)) ;
} catch (ParseException e) {
return null ;
}
return calendar ;
}
/**
* @return yyyy'-'MM'-'dd
*
* yyyy'-'MM'-'dd
*
* 2004-09-07
*/
public static String getCurrentDateString() {
String timestrformart = "yyyy'-'MM'-'dd" ;
SimpleDateFormat SDF = new SimpleDateFormat(timestrformart) ;
Calendar calendar = Calendar.getInstance() ;
return SDF.format(calendar.getTime()) ;
}
public static String getMessage(String msgMode,String key,String val){
key = null2String(key).trim();
val = null2String(val).trim();
msgMode = null2String(msgMode).trim();
if(!"".equals(msgMode) && !"".equals(key)) {
msgMode = msgMode.replaceAll(key, val);
}
return msgMode;
}
public static List<Long> tranStrToLongList(Object idListObj){
List<Long> docIds = new ArrayList<Long>();
if(idListObj != null) {
try {
JSONArray idObjs = JSONArray.parseArray(null2String(idListObj));
for (Object idObj : idObjs) {
long id = getLongValue(idObj);
if (id > 0l) {
docIds.add(id);
}
}
} catch (Exception e) {
log.error("trans error :{}", idListObj);
log.error(e.getMessage(), e);
}
}
return docIds;
}
}

@ -0,0 +1,293 @@
package com.weaver.seconddev.cockpit.util;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.ebuilder.datasource.api.query.dto.dw.DynamicParamDto;
import com.weaver.ebuilder.datasource.api.query.dto.dw.FieldQuery;
import com.weaver.ebuilder.datasource.api.query.dto.dw.GroupQuery;
import com.weaver.ebuilder.datasource.api.query.dto.dw.TableQuery;
import com.weaver.ebuilder.datasource.api.entity.ExecuteSqlEntity;
import com.weaver.ebuilder.datasource.api.enums.SourceType;
import com.weaver.ebuilder.datasource.api.service.DataSetService;
import com.weaver.ebuilder.datasource.api.service.impl.EbFormDataService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
/**
* DatabaseUtil SQL
*/
@Component
public class DatabaseUtils {
private final static Logger log = LoggerFactory.getLogger(DatabaseUtils.class);
@Autowired
private DataSetService dataSetService;
@Autowired
private EbFormDataService dataService;
/**
* SQL
*
* @param entity SQL
* @return Map
* @throws RuntimeException SQL
*/
public Map<String, Object> executeSql(ExecuteSqlEntity entity) {
Map<String, Object> map = dataSetService.executeSql(entity);
if ("FAIL".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT))) {
log.error("sql执行失败=>{}", JSONObject.toJSONString(map));
throw new RuntimeException("sql执行异常");
} else {
return map;
}
}
/**
* SQL
*
* @param entity SQL
* @param pageNo
* @param pageSize
* @return Map
* @throws RuntimeException SQL
*/
public Map<String, Object> executeSql(ExecuteSqlEntity entity, int pageNo, int pageSize) {
entity.setPageNo(pageNo);
entity.setPageSize(pageSize);
Map<String, Object> map = dataSetService.executeForQuery(entity);
if ("FAIL".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT))) {
log.error("sql执行失败=>{}", JSONObject.toJSONString(map));
throw new RuntimeException("sql执行异常");
} else {
return map;
}
}
/**
* SQL
*
* @param sql SQL
* @param groupId ID
* @paramDesc ID select APPLICATION_MARK,APPLICATION_name from eteams.ds_mark_service_relation
* @return SQL
*/
public ExecuteSqlEntity getExecuteSqlEntity(String sql, String groupId) {
log.error("sql=>{}", sql);
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
executeSqlEntity.setSql(base64(sql));
executeSqlEntity.setGroupId(groupId);
executeSqlEntity.setSourceType(SourceType.LOGIC);
executeSqlEntity.setGroupKey("0");
return executeSqlEntity;
}
/**
* SQL Base64
*
* @param sql SQL
* @return
*/
public String base64(String sql) {
return Base64.encode(sql);
}
/**
*
*
* @param map Map
* @return Map
*/
public List<Map<String, Object>> getDataSourceList(Map<String, Object> map) {
List<Map<String, Object>> entity = new ArrayList();
if ("OK".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT)) && map.get("count") != null && CommonUtils.getIntValue(map.get("count")) > 0) {
entity = (List) map.get("records");
}
return keyToLowerCase((List) entity);
}
public Map<String, Object> getOneDataSource(Map<String, Object> map) {
List<Map<String, Object>> entity = getDataSourceList(map);
return (Map)(CollectionUtil.isNotEmpty(entity) ? (Map)entity.get(0) : new HashMap());
}
/**
* Map
*
* @param orgMapList Map
* @return Map
*/
public List<Map<String, Object>> keyToLowerCase(List<Map<String, Object>> orgMapList) {
List<Map<String, Object>> resultList = new ArrayList();
Iterator var2 = orgMapList.iterator();
while (var2.hasNext()) {
Map<String, Object> stringObjectMap = (Map) var2.next();
resultList.add(keyToLowerCase(stringObjectMap));
}
return resultList;
}
/**
* Map
*
* @param orgMap Map
* @return Map
*/
public Map<String, Object> keyToLowerCase(Map<String, Object> orgMap) {
Map<String, Object> resultMap = new HashMap();
if (orgMap != null && !orgMap.isEmpty()) {
Set<Map.Entry<String, Object>> entrySet = orgMap.entrySet();
Iterator var3 = entrySet.iterator();
while (var3.hasNext()) {
Map.Entry<String, Object> entry = (Map.Entry) var3.next();
String key = (String) entry.getKey();
Object value = entry.getValue();
resultMap.put(key.toLowerCase(), value);
}
return resultMap;
} else {
return resultMap;
}
}
/**
*
*
* @param sourceType sourceType
* ETEAMS :
* FORM: ebuilder
* LOGIC: ()
* EXTERNAL
* @return
*/
public List<Map<String, Object>> getDataGroups(String sourceType, Boolean flag) {
GroupQuery query = new GroupQuery();
query.setSourceType(SourceType.valueOf(sourceType));
query.setShowSqlDataset(flag);
DynamicParamDto dynamicParamDto = new DynamicParamDto();
dynamicParamDto.setUserId(10000L);
dynamicParamDto.setTenantKey("tk");
query.setDynamicParamDto(dynamicParamDto);
return dataSetService.getDataGroups(query);
}
/**
*
*
* @param sourceType
* @param groupId
* @param pageNum
* @param pageSize
* @return
*/
public Map<String, Object> getDataSets(String sourceType, String groupId, Integer pageNum, Integer pageSize) {
TableQuery tableQuery = new TableQuery();
tableQuery.setSourceType(SourceType.valueOf(sourceType));
tableQuery.setGroupId(groupId);
//非必传
//tableQuery.setName(name);
tableQuery.setPageNo(pageNum);
tableQuery.setPageSize(pageSize);
return dataSetService.getDataSetsByPage(tableQuery);
}
/**
*
* sourceType :LOGIC
* sourceId : 8494845523559165780
* groupId : weaver-crm-service
*
* @param
* @return
*/
public List<Map<String, Object>> getFields(String sourceType, String sourceId, String groupId) {
FieldQuery query = new FieldQuery();
query.setSourceType(SourceType.valueOf(sourceType));
query.setSourceId(sourceId);
query.setGroupId(groupId);
return dataSetService.getFields(query);
}
/**
* sql
* sourceType :LOGIC
* groupId : weaver-ebuilder-app-service
* sql : select * from ebda_app limit 10
*
* @param
* @return
*/
public Map<String, Object> execute(String sourceType, String groupId, String sql) {
//执行sql 参数sourceType groupId sql
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
executeSqlEntity.setSql(base64(sql));
executeSqlEntity.setGroupId(groupId);
executeSqlEntity.setSourceType(SourceType.valueOf(sourceType));
return dataSetService.executeSql(executeSqlEntity);
}
public Map<String, Object> executeForQuery(String sourceType, String groupId, String sql,List<SqlParamEntity> sqlparam) {
//执行sql 参数sourceType groupId sql sqlparam
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
executeSqlEntity.setSql(base64(sql));
executeSqlEntity.setGroupId(groupId);
executeSqlEntity.setSourceType(SourceType.valueOf(sourceType));
executeSqlEntity.setParams(sqlparam);
return dataSetService.executeSql(executeSqlEntity);
}
public String getMysqlPagedSql(String sql,int pageNo, int pageSize) {
if(pageNo<=0){
pageNo = 1;
}
if(pageSize<=0){
pageSize = 20;
}
int start = (pageNo-1)*pageSize;
int end = pageNo*pageSize;
return new StringBuffer().append(sql).append(
" LIMIT "+start+","+(end-start)).toString();
}
/**
* sql
* @param list
* @return
*/
public List<SqlParamEntity> getSqlParamEntity(List<String> list){
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
for (String str : list){
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(str);
sqlparam.add(sqlParamEntity);
}
return sqlparam;
}
}

@ -0,0 +1,158 @@
package com.weaver.seconddev.cockpit.util;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.ebuilder.form.client.entity.data.*;
import com.weaver.ebuilder.form.client.service.data.RemoteSimpleDataService;
import com.weaver.framework.rpc.annotation.RpcReference;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Component
public class JucailinCockpitUtils {
private final Logger log = LoggerFactory.getLogger(JucailinCockpitUtils.class);
@Autowired
private DatabaseUtils databaseUtils;
@RpcReference(group="ebuilderform")
private RemoteSimpleDataService remoteSimpleDataService;
/***
*
* @param pkey
* @param tenant_key
* @return
*/
public String getUfPropData(String pkey,String tenant_key) {
String pvalue = "" ;
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
try{
if(StringUtils.isNotBlank(pkey))
{
String dataSql =" select pvalue \n" +
" from uf_nj_prop \n" +
" where pkey = ? \n" +
" and delete_type = 0 \n" +
" and tenant_key='"+tenant_key+"'" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(pkey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(CollectionUtils.isNotEmpty(recordList) && recordList.size() >0 ) {
Map<String,Object> recordMap = recordList.get(0);
if(recordMap.containsKey("pvalue")){
pvalue = String.valueOf(recordMap.get("pvalue"));
}
}
}
}catch (Exception e){
e.printStackTrace();
log.error("getUfPropData-Exception:"+e);
}
return pvalue;
}
public void saveModeData(String objId,String operator,String tenant_key,List<EBDataReqDto> datas){
log.error("saveModeData-objid:"+objId);
log.error("saveModeData-operator:"+operator);
log.error("saveModeData-tenant_key:"+tenant_key);
log.error("saveModeData-datas:"+datas.size());
EBDataChangeReqDto ebDataChangeReqDto = new EBDataChangeReqDto();
// 构建基础参数; objId 表单id, operator 操作人, tenantKey 租户
ebDataChangeReqDto.setHeader(new EBDataReqHeader(objId, operator,tenant_key));
ebDataChangeReqDto.setDatas(datas);
EBDataChangeResult insertEbDataChangeResult = remoteSimpleDataService.saveFormData(ebDataChangeReqDto);
log.error("insertEbDataChangeResult:"+insertEbDataChangeResult.getMessage());
log.error("insertEbDataChangeResult:"+insertEbDataChangeResult.toString());
log.error("insertEbDataChangeResult:"+insertEbDataChangeResult.getStatus());
}
/***
*
*/
public void updateModeDataById(String objId,String operator,String tenant_key,List<EBDataReqDto> datas,boolean isNeedAdd){
/**
* id update table set a = '11' where id = 1
*/
EBDataChangeReqDto ebDataChangeReqDto = new EBDataChangeReqDto();
// 构建基础参数; objId 表单id, operator 操作人, tenantKey 租户
ebDataChangeReqDto.setHeader(new EBDataReqHeader(objId, operator, tenant_key));
// 请求操作信息
EBDataReqOperation ebDataReqOperation = new EBDataReqOperation();
ebDataReqOperation.setUpdateType(EBDataUpdateType.ids);
// 数据没有找到的时候是否新增数据
EBDataReqOperationInfo ebDataReqOperationInfo = new EBDataReqOperationInfo();
ebDataReqOperationInfo.setNeedAdd(isNeedAdd);
ebDataReqOperation.setMainData(ebDataReqOperationInfo);
ebDataChangeReqDto.setOperation(ebDataReqOperation);
ebDataChangeReqDto.setDatas(datas);
EBDataChangeResult updateEbDataChangeResult = remoteSimpleDataService.updateFormData(ebDataChangeReqDto);
log.error("updateEbDataChangeResult:"+updateEbDataChangeResult.getMessage());
log.error("updateEbDataChangeResult:"+updateEbDataChangeResult.toString());
log.error("updateEbDataChangeResult:"+updateEbDataChangeResult.getStatus());
}
/***
*
* @param request
* @return
*/
public Map<String, Object> request2Map(HttpServletRequest request) {
// 参数Map
Map properties = request.getParameterMap();
// 返回值Map
Map<String, Object> returnMap = new HashMap<String, Object>();
Iterator<Map.Entry> entries = properties.entrySet().iterator();
Map.Entry entry;
String name = "";
Object value = null;
while (entries.hasNext()) {
entry = (Map.Entry) entries.next();
name = (String) entry.getKey();
Object valueObj = entry.getValue();
if (null == valueObj) {
value = null;
} else if (valueObj instanceof String[]) {
String[] values = (String[]) valueObj;
if (values.length == 1) {
value = values[0];
} else {
value = values;
}
} else {
value = valueObj.toString();
}
returnMap.put(name, value);
}
return returnMap;
}
}

@ -0,0 +1,297 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workflow.common.constant.list.api.DateTimeConditionEnum;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/14
*/
@Component
public class DevCollaborationInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(DevCollaborationInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84";
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String, Object> dataMap = new HashMap<String, Object>();
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
Map<String, Object> rtMap = getDaysInfo(startday, endday, employeeId);
String rtcount = (String) rtMap.get("count");
Map<String, Object> wtMap = getQuestInfo(startday, endday, employeeId);
String wtcount = (String) wtMap.get("count");
Map<String, Object> gtxzMap = getInteractInfo(startday, endday, employeeId);
int gtxz = (int) gtxzMap.get("count");
Map<String, Object> wfMap = getWfInfo();
Long lccl = (Long) wfMap.get("count");
dataMap.put("rtcount", rtcount);
dataMap.put("wtcount", wtcount);
dataMap.put("gtxz", gtxz);
dataMap.put("lccl", lccl);
return dataMap;
}
public Map<String, Object> getDaysInfo(String startday, String endday, String employeeId) {
log.error("DevDaysCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
Map<String, Object> dataMap = new HashMap<String, Object>();
String devcou = "0";
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
if (StringUtils.isNotBlank(employeeId)) {
String dataSql = " select count(1) as devcou \n" +
" from wfc_form_data l\n" +
" inner join fto_83 d on d.id = l.dataid\n" +
" inner join wfc_requestbase p on p.requestid = l.requestid\n" +
" where d.mutiresource= ?\n" +
" and d.xsjfrq >= ?" +
" and d.xsjfrq <= ?" +
" and d.tenant_key= ?\n" +
" and d.is_delete='0'\n" +
" and l.tenant_key=?\n" +
" and l.delete_type=0\n" +
" and p.tenant_key=?\n" +
" and p.delete_type=0\n" +
" order by d.id desc ";
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
strlist.add(tenant_key);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
log.info("DevDaysCountCmd sql:" + dataSql);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
devcou = String.valueOf(recordList.get(0).get("devcou"));
}
}
dataMap.put("count", devcou);
} catch (Exception e) {
log.error("DevDaysCountCmd-Exception:" + e);
}
return dataMap;
}
public Map<String, Object> getQuestInfo(String startday, String endday, String employeeId) {
log.error("DevQuestCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
Map<String, Object> dataMap = new HashMap<String, Object>();
String devcou = "0";
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
if (StringUtils.isNotBlank(employeeId)) {
String dataSql = " select ifnull(sum(d.integer2),0) as devcou \n" +
" from wfc_form_data l\n" +
" inner join fto_62 d on d.id = l.dataid\n" +
" inner join wfc_requestbase p on p.requestid = l.requestid\n" +
" where d.multiresource5=?\n" +
" and d.date2 >=?" +
" and d.date2 <=?" +
" and d.tenant_key=?\n" +
" and d.is_delete='0'\n" +
" and l.tenant_key=?\n" +
" and l.delete_type=0\n" +
" and p.tenant_key=?\n" +
" and p.delete_type=0\n" +
" order by d.id desc ";
log.info("DevQuestCountCmd dataSql:" + dataSql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
strlist.add(tenant_key);
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(recordList.size()>0){
devcou = String.valueOf(recordList.get(0).get("devcou"));
}
}
dataMap.put("count", devcou);
} catch (Exception e) {
log.error("DevQuestCountCmd-Exception:" + e);
}
return dataMap;
}
/**
*
*
* @param
* @return
*/
public Map<String, Object> getInteractInfo(String startday, String endday, String employeeId) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-cowork-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql = " select count(1) as count from cw_content " +
" where CREATOR=?\n" +
" and left(CREATE_TIME,10)>=? and left(CREATE_TIME,10) <= ?";
log.error("getInteractInfo sql:" + sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (recordList.size() > 0) {
dataMap = recordList.get(0);
}
}catch (Exception e){
log.error("getInteractInfo-Exception:"+e.getMessage());
}
return dataMap;
}
/**
*
*
* @param
* @return
*/
public Map<String, Object> getWfInfo() {
Map<String, Object> data = new HashMap<>(100);
Long count = 0L ;
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
SimpleEmployee employee = UserContext.getCurrentUser();
conditionEntity.setOperatedate(DateTimeConditionEnum.CURRENT_YEAR);
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
int code = requestCountInfo.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
count = requestCountInfoPAEntity.getCount();
}
} catch (Exception e) {
log.error("getWfInfo-Exception:" + e);
}
data.put("count", count);
return data;
}
}

@ -0,0 +1,102 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/14
*/
@Component
public class DevDaysCountCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(DevDaysCountCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84";
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
log.error("DevDaysCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
Map<String, Object> dataMap = new HashMap<String, Object>();
String devcou = "0";
try {
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
if (StringUtils.isNotBlank(employeeId)) {
String dataSql = " select count(1) as devcou \n" +
" from wfc_form_data l\n" +
" inner join fto_83 d on d.id = l.dataid\n" +
" inner join wfc_requestbase p on p.requestid = l.requestid\n" +
" where d.mutiresource=?\n" +
" and d.xsjfrq >=?" +
" and d.xsjfrq <=?" +
" and d.tenant_key=?\n" +
" and d.is_delete='0'\n" +
" and l.tenant_key=?\n" +
" and l.delete_type=0\n" +
" and p.tenant_key=?\n" +
" and p.delete_type=0\n" +
" order by d.id desc ";
log.info("DevDaysCountCmd sql:" + dataSql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
strlist.add(tenant_key);
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(recordList.size()>0){
devcou = String.valueOf(recordList.get(0).get("devcou"));
}
}
dataMap.put("count", devcou);
} catch (Exception e) {
log.error("DevDaysCountCmd-Exception:" + e.getMessage());
}
return dataMap;
}
}

@ -0,0 +1,106 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/14
*/
@Component
public class DevQuestCountCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(DevQuestCountCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84";
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
log.error("DevQuestCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
Map<String, Object> dataMap = new HashMap<String, Object>();
String devcou = "0";
try {
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
if (StringUtils.isNotBlank(employeeId)) {
String dataSql = " select ifnull(sum(d.integer2),0) as devcou \n" +
" from wfc_form_data l\n" +
" inner join fto_62 d on d.id = l.dataid\n" +
" inner join wfc_requestbase p on p.requestid = l.requestid\n" +
" where d.multiresource5=?\n" +
" and d.date2 >=?" +
" and d.date2 <=?" +
" and d.tenant_key=?\n" +
" and d.is_delete='0'\n" +
" and l.tenant_key=?\n" +
" and l.delete_type=0\n" +
" and p.tenant_key=?\n" +
" and p.delete_type=0\n" +
" order by d.id desc ";
log.info("DevQuestCountCmd dataSql:" + dataSql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
strlist.add(tenant_key);
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)) {
devcou = String.valueOf(recordList.get(0).get("devcou"));
}
}
dataMap.put("count", devcou);
} catch (Exception e) {
log.error("DevQuestCountCmd-Exception:" + e.getMessage());
}
return dataMap;
}
}

@ -0,0 +1,228 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.seconddev.jcldoor.util.CommonUtils;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/5
* @desc
*/
@Component
public class PortalBirthdayWishesCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(PortalBirthdayWishesCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
/**
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String, Object> result = new HashMap<>(100);
JSONArray list = new JSONArray();
String hid = getHid();
try {
String groupId = "weaver-hr-service";
String sourceType = "LOGIC";
String tenant_key = "t7akvdnf84";
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
Date date = new Date();
String day = sdf.format(date);
if (StringUtils.isNotBlank(day)) {
String dataSql = "select\n" +
" k.id,\n" +
" k.sex,\n" +
" k.username,\n" +
" right(left(BIRTHDAY, 10), 5) as BIRTHDAY,\n" +
" b.name as department,\n" +
" d.name as subcompany,\n" +
" c.name as position\n" +
"from\n" +
" hr_userinfo t\n" +
" inner join eteams.employee k on k.id = t.user\n" +
" inner join eteams.department b on k.department = b.id\n" +
" inner join eteams.department d on b.subcompanyid = d.id\n" +
" inner join eteams.position c on c.id = k.position\n" +
"where\n" +
" BIRTHDAY is not null\n" +
" and right(left(BIRTHDAY, 10), 5) = ?\n" +
" and k.status = 'normal'\n" +
" and k.type = 'inside'\n" +
" and k.tenant_key = ?";
List<String> strlist = new ArrayList<>(100);
strlist.add(day);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
log.error("getuserIfo--dataSql:" + dataSql);
Map<String, Object> data = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(data);
if (CollectionUtils.isNotEmpty(recordList)) {
for(Map<String, Object> map:recordList){
String id = CommonUtils.null2String(map.get("id"));
String sextype = CommonUtils.null2String(map.get("sex"));
int sex = parseSex(sextype);
String username = CommonUtils.null2String(map.get("username"));
String department = CommonUtils.null2String(map.get("department"));
String subcompany = CommonUtils.null2String(map.get("subcompany"));
String position = CommonUtils.null2String(map.get("position"));
JSONObject obj = new JSONObject();
obj.put("id",id);
obj.put("sex",sex);
obj.put("username",username);
obj.put("department",department);
obj.put("subcompany",subcompany);
obj.put("position",position);
list.add(obj);
}
}
}
} catch (Exception e) {
log.error("PortalBirthdayWishesCmd--Exception:" + e.getMessage());
}
result.put("list",list);
result.put("hid",hid);
return result;
}
/**
*
* @param sextype
* @return
*/
private int parseSex(String sextype){
//0男 1
int sex = 0;
switch (sextype){
case "male":
sex = 0;
break;
case "female":
sex = 1;
break;
default:
sex = 0;
break;
}
return sex;
}
public String getHid() {
String hid = "";
String groupId = "weaver-hr-service";
String sourceType = "LOGIC";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
String nowDay = sdf.format(new Date());
SimpleEmployee employee = UserContext.getCurrentUser();
long formdata = employee.getFormdata();
String tip_id = "";
String sql = " select id " +
" from hr_tip\n" +
" where TIP_TYPE='birthday'\n" +
" and TENANT_KEY='t7akvdnf84'\n" +
" and DELETE_TYPE='0' ";
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (recordList.size() > 0) {
Map<String, Object> recordMap = recordList.get(0);
tip_id = String.valueOf(recordMap.get("id"));
}
String tip_target_id = "";
if (StringUtils.isNotBlank(tip_id)) {
sql = " select id from hr_tip_target \n" +
" where TIP_ID = ? \n" +
" and TARGET_TYPE='colleague' \n" +
" and tip_time_type='sameDay' ";
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tip_id);
sqlparam.add(sqlParamEntity);
Map<String, Object> result2 = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList2 = databaseUtils.getDataSourceList(result2);
if (recordList2.size() > 0) {
Map<String, Object> recordMap = recordList2.get(0);
tip_target_id = String.valueOf(recordMap.get("id"));
}
}
if (StringUtils.isNotBlank(tip_id) && StringUtils.isNotBlank(tip_target_id)) {
sql = " select id \n" +
" from hr_tip_send_history\n" +
" where history_date = ? \n" +
" and tip_id = ? \n" +
" and tip_target_id= ? \n" +
" order by create_time desc " +
" limit 1 ";
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(nowDay);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tip_id);
sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tip_target_id);
sqlparam.add(sqlParamEntity);
Map<String, Object> result3 = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList3 = databaseUtils.getDataSourceList(result3);
if (recordList3.size() > 0) {
Map<String, Object> recordMap = recordList3.get(0);
hid = String.valueOf(recordMap.get("id"));
}
}
}catch (Exception e){
log.error("getHid Exception"+e.getMessage());
}
return hid;
}
}

@ -0,0 +1,279 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workflow.common.constant.list.api.DateTimeConditionEnum;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
* +++
*
* @author wangj
* @version 1.00
* @Date 2024/3/13
*/
@Component
public class PortalCollaborationInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(PortalCollaborationInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84" ;
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = new HashMap<String,Object>();
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
int wb = 0;
int wdgx = 0;
int gtxz = 0;
Long lccl = 0L;
try{
Map<String,Object> wbMap = getDailyInfo(startday,endday,employeeId);
wb = (int) wbMap.get("count");
Map<String,Object> wdMap = getDocInfo(startday,endday,employeeId);
wdgx = (int) wdMap.get("count");
Map<String,Object> gtxzMap = getInteractInfo(startday,endday,employeeId);
gtxz = (int) gtxzMap.get("count");
Map<String,Object> wfMap = getWfInfo();
lccl = (Long) wfMap.get("count");
}catch (Exception e){
log.error("PortalCollaborationInfoCmd-Exception:"+e.getMessage());
}
dataMap.put("lccl",lccl);
dataMap.put("gtxz",gtxz);
dataMap.put("wdgx",wdgx);
dataMap.put("wb",wb);
return dataMap;
}
public Map<String, Object> getDailyInfo(String startday,String endday,String employeeId) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-blog-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try{
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql =" select count(1) as count\n" +
" from blog " +
" where creator=?\n" +
" and left(BLOG_TIME,10) >=?\n" +
" and left(BLOG_TIME,10) <=?\n" +
" and type='blog'\n" +
" and TENANT_KEY = ?\n" +
" and MODULE = 'blog'\n" +
" and DELETE_TYPE = 0\n" +
" and CONTENT is not null" ;
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
dataMap = recordList.get(0);
}
}catch (Exception e){
dataMap.put("count",0);
}
return dataMap;
}
/**
*
* @param
* @return
*/
public Map<String, Object> getDocInfo(String startday,String endday,String employeeId) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try{
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql = " select count(1) as count from document " +
" where CREATOR=?\n" +
" and left(create_time,10)>=? and left(create_time,10) <= ?" ;
log.error("PortalDocCreateCountCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
dataMap = recordList.get(0);
}
}catch (Exception e){
dataMap.put("count",0);
}
return dataMap;
}
/**
*
* @param
* @return
*/
public Map<String, Object> getInteractInfo(String startday,String endday,String employeeId) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-cowork-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try{
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql = " select count(1) as count from cw_content " +
" where CREATOR=?\n" +
" and left(CREATE_TIME,10)>=? and left(CREATE_TIME,10) <= ?" ;
log.error("PortalInteractCountCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
dataMap = recordList.get(0);
}
}catch (Exception e){
e.getMessage();
dataMap.put("count",0);
}
return dataMap;
}
/**
*
* @param
* @return
*/
public Map<String, Object> getWfInfo() {
log.error("PortalWfDealCountCmd");
Map<String,Object> data = new HashMap<>(100);
Long count = 0L ;
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
SimpleEmployee employee = UserContext.getCurrentUser();
conditionEntity.setOperatedate(DateTimeConditionEnum.CURRENT_YEAR);
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
int code = requestCountInfo.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
count = requestCountInfoPAEntity.getCount();
}
} catch (Exception e) {
log.error("PortalWfDealCountCmd-Exception:" + e);
}
data.put("count", count);
return data;
}
}

@ -0,0 +1,93 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/13
*/
@Component
public class PortalDailyCountCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(PortalDailyCountCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84" ;
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
log.error("PortalDailyCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-blog-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try{
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql =" select count(1) as count\n" +
" from blog " +
" where creator=?\n" +
" and left(BLOG_TIME,10) >=?\n" +
" and left(BLOG_TIME,10) <=?\n" +
" and type='blog'\n" +
" and TENANT_KEY = ?\n" +
" and MODULE = 'blog'\n" +
" and DELETE_TYPE = 0\n" +
" and CONTENT is not null" ;
log.error("PortalDailyCountCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
dataMap = recordList.get(0);
}
}catch (Exception e){
log.error("PortalDailyCountCmd-Exception:"+e.getMessage());
dataMap.put("count",0);
}
return dataMap;
}
}

@ -0,0 +1,92 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/13
*/
@Component
public class PortalDocCreateCountCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(PortalDocCreateCountCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84" ;
/**
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
log.error("PortalDocCreateCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try{
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql = " select count(1) as count from document " +
" where CREATOR=?\n" +
" and left(create_time,10)>=? and left(create_time,10) <= ?" ;
log.error("PortalDocCreateCountCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
dataMap = recordList.get(0);
}
}catch (Exception e){
log.error("PortalDocCreateCountCmd-Exception:"+e.getMessage());
dataMap.put("count",0);
}
return dataMap;
}
}

@ -0,0 +1,91 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/13
*/
@Component
public class PortalInteractCountCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(PortalInteractCountCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84" ;
/**
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
log.error("PortalInteractCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-cowork-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try{
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql = " select count(1) as count from cw_content " +
" where CREATOR=?\n" +
" and left(CREATE_TIME,10)>= ? and left(CREATE_TIME,10) <= ?" ;
log.error("PortalInteractCountCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
dataMap = recordList.get(0);
}else{
dataMap.put("count",0);
}
}catch (Exception e){
e.getMessage();
}
return dataMap;
}
}

@ -0,0 +1,551 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.seconddev.jcldoor.util.JucailinPortalUtils;
import com.weaver.teams.domain.hr.entity.FlowData;
import com.weaver.teams.domain.hr.entity.FlowDataListReq;
import com.weaver.teams.domain.hr.entity.FlowDataListRes;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workrelate.performance.api.rest.RemotePerformanceService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Month;
import java.time.YearMonth;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/8
*/
@Component
public class PortalPerformanceInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(PortalPerformanceInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84";
@Autowired
private JucailinPortalUtils jucailinPortalUtils;
@RpcReference
public RemotePerformanceService remotePerformanceService;
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String, Object> dataMap = new HashMap<String, Object>(100);
try {
String employeeId = request.getParameter("employeeId");
LocalDate currentDate = LocalDate.now();
LocalDate lastMonthDate = currentDate.minusMonths(1);
int lastMonth = lastMonthDate.getMonthValue();
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
Map<String, Object> scoreMap = getLastMonthKpi2(employeeId, groupId, sourceType);
List<Map<String, String>> yearList = getWholeYearKpi2();
dataMap.put("scoreMap", scoreMap);
dataMap.put("yearList", yearList);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
dataMap.put("count", "-1");
}
return dataMap;
}
public Map<String, Object> getLastMonthKpi2(String employeeId, String groupId, String sourceType) {
log.error("PortalPerformanceInfoCmd getLastMonthKpi2");
Map<String, Object> dataMap = new HashMap<String, Object>();
List<Map<String, Object>> indicatorList = new ArrayList<Map<String, Object>>();
if (StringUtils.isNotBlank(employeeId)) {
// String sql =" select left(k.real_period,10) as real_period,left(k.real_period,7) as period_month,k.kpi_scheme,k.score\n" +
// " from (select real_period,kpi_scheme,score\n" +
// " from hr_kpi_flow \n" +
// " where kpi_user=? \n" +
// " and module = 'kpiFlow' \n" +
// " and date_type = 'month' \n" +
// " and delete_type = '0' " +
// " and tenant_key=?\n" +
// " order by real_period desc\n" +
// ") k limit 1 ";
//
// log.error("sql20-1:" + sql);
//
// 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, sql, sqlparam);
//
// List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
// if (CollectionUtils.isNotEmpty(recordList)) {
// Map<String, Object> recordMap = recordList.get(0);
// if (!recordMap.isEmpty()) {
// String score = String.valueOf(recordMap.get("score"));
// String kpi_scheme = String.valueOf(recordMap.get("kpi_scheme"));
// String real_period = String.valueOf(recordMap.get("real_period"));
// String period_month = String.valueOf(recordMap.get("period_month"));
//
//// dataMap.put("score", score);
//// dataMap.put("yearmonth", period_month);
// dataMap.put("kpi_scheme", kpi_scheme);
//// dataMap.put("real_period", real_period);
// }
// }
try{
String startDay = "" ;
String endDay = "" ;
String score = "0.0";
String kpi_scheme = "";
String real_period = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
String nowDate = sdf.format(new Date())+"-01";
Map<String,String> scoreMap = getLastScore(nowDate);
if(!scoreMap.isEmpty()){
score = scoreMap.get("score");
real_period = scoreMap.get("real_period");
startDay = scoreMap.get("startDay");
endDay = scoreMap.get("endDay");
}
log.error("startDay:"+startDay);
log.error("endDay:"+endDay);
String sql =" select scheme_id " +
" from hr_kpi_scheme_flow_log_detail " +
" where user_id=? \n" +
" and date_type='month' \n" +
" order by real_period desc " ;
List<String> strlist = new ArrayList<String>();
strlist.add(employeeId);
strlist.add(startDay);
strlist.add(endDay);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (CollectionUtils.isNotEmpty(recordList)) {
for(int i=0;i<recordList.size();i++){
Map<String, Object> recordMap = recordList.get(i);
kpi_scheme = String.valueOf(recordMap.get("scheme_id"));
if(StringUtils.isNotBlank(kpi_scheme)){
break;
}
}
}
log.error("kpi_scheme:"+kpi_scheme);
if(StringUtils.isNotBlank(kpi_scheme)){
dataMap.put("score", score);
dataMap.put("yearmonth", real_period);
dataMap.put("real_period", real_period);
dataMap.put("kpi_scheme", kpi_scheme);
dataMap.put("startDay", startDay);
dataMap.put("endDay", endDay);
}else{
sql =" select k.kpi_scheme\n" +
" from (select real_period,kpi_scheme,score\n" +
" from hr_kpi_flow \n" +
" where kpi_user=? \n" +
" and module = 'kpiFlow' \n" +
" and date_type = 'month' \n" +
" and delete_type = '0' " +
" and tenant_key=?\n" +
" order by real_period desc\n" +
") k limit 1 ";
log.error("sql20-1:" + sql);
strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(tenant_key);
sqlparam = databaseUtils.getSqlParamEntity(strlist);
result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
recordList = databaseUtils.getDataSourceList(result);
if (CollectionUtils.isNotEmpty(recordList)) {
Map<String, Object> recordMap = recordList.get(0);
if (!recordMap.isEmpty()) {
kpi_scheme = String.valueOf(recordMap.get("kpi_scheme"));
}
}
dataMap.put("score", score);
dataMap.put("yearmonth", real_period);
dataMap.put("kpi_scheme", kpi_scheme);
dataMap.put("real_period", real_period);
dataMap.put("startDay", startDay);
dataMap.put("endDay", endDay);
}
}catch (Exception e){
e.printStackTrace();
log.error("getLastScore-e:"+e);
}
}
if (!dataMap.isEmpty()) {
String kpi_scheme = String.valueOf(dataMap.get("kpi_scheme"));
log.error("kpi_scheme:" + kpi_scheme);
if (StringUtils.isNotBlank(kpi_scheme)) {
String sql = " select indicator_type,indicator_description,weight \n" +
" from hr_kpi_scheme_indicator " +
" where scheme_id=? " +
" and indicator_mode='quantify'\n" +
" and status='on' " +
" and delete_type = '0'" +
" and tenant_key = ?";
log.error("sql2:" + sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(kpi_scheme);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
log.error("recordList:" + recordList.size());
if (recordList.size() >= 2) {
for (int i = 0; i < 2; i++) {
indicatorList.add(recordList.get(i));
}
} else if (recordList.size() == 1) {
indicatorList.add(recordList.get(0));
Map<String, Object> indicatorMap = new HashMap<String, Object>();
sql = " select name,data_row,property\n" +
" from hr_kpi_details_link\n" +
" where kpi_details in( " +
" select id\n" +
" from hr_kpi_details " +
" where KPI_SCHEME=?\n" +
" and MODULE='kpiSchemeSetting'\n" +
" and TENANT_KEY=?\n" +
" and DELETE_TYPE = 0" +
" )\n" +
" and module = 'kpiSchemeSetting'\n" +
" and tenant_key = ?\n" +
" and delete_type = '0'\n" +
" and property in('weight', 'describe', 'type')\n" +
" and data_row in ( \n" +
" select p.data_row from (\n" +
" select w.data_row from (\n" +
" select data_row \n" +
" from hr_kpi_details_link\n" +
" where kpi_details in ( " +
" select id\n" +
" from hr_kpi_details " +
" where KPI_SCHEME=?\n" +
" and MODULE='kpiSchemeSetting'\n" +
" and TENANT_KEY=?\n" +
" and DELETE_TYPE = 0" +
" )\n" +
" and PROPERTY = 'weight'\n" +
" and MODULE = 'kpiSchemeSetting'\n" +
" and TENANT_KEY = ?\n" +
" and DELETE_TYPE = '0'\n" +
" order by name desc\n" +
" ) w limit 1 \n" +
" ) p\n" +
" )";
log.error("sql3:" + sql);
List<String> strlist2 = new ArrayList<>(100);
strlist2.add(kpi_scheme);
strlist2.add(tenant_key);
strlist2.add(tenant_key);
strlist2.add(kpi_scheme);
strlist2.add(tenant_key);
strlist2.add(tenant_key);
List<SqlParamEntity> sqlparam2 = databaseUtils.getSqlParamEntity(strlist2);
Map<String, Object> result2 = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam2);
List<Map<String, Object>> recordList2 = databaseUtils.getDataSourceList(result2);
log.error("recordList2:" + recordList2.size());
for (int i = 0; i < recordList2.size(); i++) {
Map<String, Object> recordMap = recordList2.get(i);
String name = String.valueOf(recordMap.get("name"));
String property = String.valueOf(recordMap.get("property"));
log.error("name:" + name);
log.error("property:" + property);
if ("weight".equalsIgnoreCase(property)) {
indicatorMap.put("weight", name);
}
if ("describe".equalsIgnoreCase(property)) {
indicatorMap.put("indicator_description", name);
}
if ("type".equalsIgnoreCase(property)) {
indicatorMap.put("indicator_type", name);
}
}
if (!indicatorMap.isEmpty()) {
indicatorList.add(indicatorMap);
}
} else {
sql = " select w.data_row from (\n" +
" select data_row\n" +
" from hr_kpi_details_link\n" +
" where kpi_details in( " +
" select id\n" +
" from hr_kpi_details " +
" where kpi_scheme =?\n" +
" and MODULE='kpiSchemeSetting'\n" +
" and tenant_key =?\n" +
" and delete_type = '0' " +
" )\n" +
" and property = 'weight'\n" +
" and module = 'kpiSchemeSetting'\n" +
" and tenant_key = ?\n" +
" and delete_type = '0'\n" +
" order by name desc\n" +
") w limit 2";
log.error("sql4:" + sql);
List<String> strlist3 = new ArrayList<>(100);
strlist3.add(kpi_scheme);
strlist3.add(tenant_key);
strlist3.add(tenant_key);
List<SqlParamEntity> sqlparam3 = databaseUtils.getSqlParamEntity(strlist3);
Map<String, Object> result3 = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam3);
List<Map<String, Object>> recordList3 = databaseUtils.getDataSourceList(result3);
log.error("recordList3:" + recordList3.size());
for (int k = 0; k < recordList3.size(); k++) {
Map<String, Object> recordMap3 = recordList3.get(k);
String data_row = String.valueOf(recordMap3.get("data_row"));
log.error("data_row:" + data_row);
Map<String, Object> indicatorMap = new HashMap<String, Object>();
sql = " select name,data_row,property\n" +
" from hr_kpi_details_link\n" +
" where kpi_details in( " +
" select id\n" +
" from hr_kpi_details " +
" where kpi_scheme=?\n" +
" and module='kpiSchemeSetting'\n" +
" and TENANT_KEY=?\n" +
" and DELETE_TYPE = 0" +
" )\n" +
" and MODULE = 'kpiSchemeSetting'\n" +
" and TENANT_KEY = ?\n" +
" and DELETE_TYPE = '0'\n" +
" and property in('weight', 'describe', 'type')\n" +
" and data_row = ? ";
log.error("sql5:" + sql);
List<String> strlist2 = new ArrayList<>(100);
strlist2.add(kpi_scheme);
strlist2.add(tenant_key);
strlist2.add(tenant_key);
strlist2.add(data_row);
List<SqlParamEntity> sqlparam2 = databaseUtils.getSqlParamEntity(strlist2);
Map<String, Object> result2 = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam2);
List<Map<String, Object>> recordList2 = databaseUtils.getDataSourceList(result2);
for (int i = 0; i < recordList2.size(); i++) {
Map<String, Object> recordMap = recordList2.get(i);
String name = String.valueOf(recordMap.get("name"));
String property = String.valueOf(recordMap.get("property"));
if ("weight".equalsIgnoreCase(property)) {
indicatorMap.put("weight", name);
}
if ("describe".equalsIgnoreCase(property)) {
indicatorMap.put("indicator_description", name);
}
if ("type".equalsIgnoreCase(property)) {
indicatorMap.put("indicator_type", name);
}
}
indicatorList.add(indicatorMap);
}
}
}
dataMap.put("indicator", indicatorList);
}
return dataMap;
}
public List<Map<String, String>> getWholeYearKpi2() {
List<Map<String, String>> dateList = new ArrayList<Map<String, String>>();
LocalDate localDate = LocalDate.now();
int year = localDate.getYear();
int dayOfYear = 1;
String[] monthzw = new String[]{"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"};
for (int i = 1; i <= 12; i++) {
Map<String, String> dataMap = new HashMap<>();
Month month = Month.of(i);
LocalDate startDay = YearMonth.of(year, month).atDay(dayOfYear); // 计算当前月份的首日
LocalDate endDay = YearMonth.of(year, month).atEndOfMonth(); // 计算当前月份的最后一天
String yearMonth = "";
if (monthzw.length == 12) {
yearMonth = monthzw[i - 1];
}
String score = getScore(startDay + "", endDay + "");
dataMap.put(yearMonth, score);
dateList.add(dataMap);
}
return dateList;
}
public String getScore(String startDay, String endDay) {
String score = "0.0";
try {
FlowDataListReq flowDataListReq = new FlowDataListReq();
flowDataListReq.setCurrent(1);
flowDataListReq.setPageSize(20);
flowDataListReq.setStartTime(startDay + "");
flowDataListReq.setEndTime(endDay + "");
flowDataListReq.setDateType("month");
flowDataListReq.setTenantKey("t7akvdnf84");
List<Long> userList = new ArrayList<Long>();
Long employeeId = UserContext.getCurrentEmployeeId();
userList.add(employeeId);
flowDataListReq.setUserList(userList);
FlowData flowData = remotePerformanceService.queryFlowData(flowDataListReq);
log.error("getWholeYearKpi2-flowData:" + flowData);
List<FlowDataListRes> flowDataList = flowData.getDataList();
if (flowDataList.size() > 0) {
for (int index = 0; index < flowDataList.size(); index++) {
FlowDataListRes flowDataListRes = flowDataList.get(index);
float Score = flowDataListRes.getScore();
score = Score + "";
}
}
} catch (Exception e) {
log.error("getWholeYearKpi2-getScore-Exception:" + e.getMessage());
score = "0.0";
}
return score;
}
/**
*
* @return
*/
public Map<String, String> getLastScore(String nowDay) {
Map<String, String> dataMap = new HashMap<String, String>();
String DateType = "month";
String score = "0.0";
String period_month = "";
String startDay = "" ;
String endDay = "" ;
try {
LocalDate date = LocalDate.parse(nowDay);
for (int i = 1; i <= 12; i++) {
LocalDate localStartDay = date.minusMonths(i);
LocalDate localEndDay = localStartDay.with(TemporalAdjusters.lastDayOfMonth()); // 获取本月最后一天
startDay = localStartDay.toString();
endDay = localEndDay.toString() ;
log.error("getLastScore-startDay:"+startDay);
log.error("getLastScore-endDay:"+endDay);
FlowDataListReq flowDataListReq = new FlowDataListReq();
flowDataListReq.setCurrent(1);
flowDataListReq.setPageSize(20);
flowDataListReq.setStartTime(startDay);
flowDataListReq.setEndTime(endDay);
flowDataListReq.setDateType(DateType);
flowDataListReq.setTenantKey(tenant_key);
List<Long> userList = new ArrayList<Long>();
Long employeeId = UserContext.getCurrentEmployeeId();
userList.add(employeeId);
flowDataListReq.setUserList(userList);
FlowData flowData = remotePerformanceService.queryFlowData(flowDataListReq);
log.error("getWholeYearKpi2-flowData:" + flowData);
List<FlowDataListRes> flowDataList = flowData.getDataList();
if (flowDataList.size() > 0) {
FlowDataListRes flowDataListRes = flowDataList.get(0);
float Score = flowDataListRes.getScore();
score = String.valueOf(Score);
period_month = startDay.substring(0,7);
break;
}
}
} catch (Exception e) {
log.error("getWholeYearKpi2-getScore-Exception:" + e.getMessage());
score = "0.0";
}
dataMap.put("score", score);
dataMap.put("yearmonth", period_month);
dataMap.put("real_period", period_month);
dataMap.put("startDay", startDay);
dataMap.put("endDay", endDay);
return dataMap;
}
public static String null2String(String s, String def) {
return s == null ? (def == null ? "" : def) : s;
}
}

@ -0,0 +1,145 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/8
*/
@Component
public class PortalRiskInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(PortalRiskInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84" ;
/**
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> recordMap = new HashMap<String,Object>();
try {
String day = null2String(request.getParameter("day"),"30");
SimpleEmployee employee = UserContext.getCurrentUser();
String startDay = "";
log.error("PortalRiskInfoCmd day:"+startDay);
if(StringUtils.isNotBlank(day)){
int day_ = Integer.parseInt(day);
LocalDate today = LocalDate.now(); // 获取当前日期
LocalDate tenDaysBefore = today.minusDays(day_); // 当前日期前10天
startDay = tenDaysBefore.toString();
}else{
LocalDate today = LocalDate.now(); // 获取当前日期
LocalDate tenDaysBefore = today.minusDays(30); // 当前日期前10天
startDay = tenDaysBefore.toString();
}
log.error("PortalRiskInfoCmd startDay:"+startDay);
long employeeId = UserContext.getCurrentEmployeeId();
String groupId = "weaver-portrait-service";
String sourceType = "LOGIC";
String sql =" SELECT \n" +
" t1.id typeid,\n" +
" t1.name typename,\n" +
" t2.id riskid,\n" +
" t2.name riskname,\n" +
" t.risk_value,\n" +
" e.username,\n" +
" t.tenant_key,\n" +
" t.userid,\n" +
" times \n" +
" FROM ( \n" +
" SELECT k.riskid,k.risk_value,k.tenant_key,k.userid,COUNT(k.riskid) times \n" +
" FROM (\n" +
" SELECT t.riskid,t.risk_value,t.tenant_key,t.userid\n" +
" FROM pr_indrisk_data t \n" +
" WHERE t.delete_type = 0 \n" +
" AND t.tenant_key = ?\n" +
" AND t.risk_date >= ?\n" +
" AND t.userid = ?\n" +
" union all\n" +
" SELECT t.riskid,t.risk_value,t.tenant_key,t.userid \n" +
" FROM pr_indrisk_data t \n" +
" WHERE t.delete_type = 0 \n" +
" AND t.tenant_key = ? \n" +
" AND t.risk_date >= ? \n" +
" AND t.userid IN (select cid from eteams.emp_link where pid= ? and relation = 'senior') \n" +
" ) k \n" +
" GROUP BY k.riskid,\n" +
" k.risk_value,\n" +
" k.tenant_key,\n" +
" k.userid\n" +
" ) t,\n" +
" pr_indrisk_type t1,\n" +
" pr_indrisk_info t2 ,\n" +
" eteams.employee e\n" +
" WHERE t.riskid = t2.id \n" +
" AND t2.risk_type = t1.id \n" +
" AND t.userid = e.id\n" +
" AND e.STATUS != 'unavailable' AND e.PERMANENTLY_DELETE = '0'\n" +
" AND t1.delete_type = 0 \n" +
" AND t2.delete_type = 0" ;
log.error("PortalRiskInfoCmd:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(tenant_key);
strlist.add(startDay+"");
strlist.add(employeeId+"");
strlist.add(tenant_key);
strlist.add(startDay+"");
strlist.add(employeeId+"");
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap2 = recordList.get(i);
recordMap2.put("pid",i+"");
}
recordMap.put("datas",recordList);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalRiskInfoCmd E:"+e);
}
return recordMap;
}
public static String null2String(String s,String def) {
return s == null ?(def==null?"":def) : s;
}
}

@ -0,0 +1,74 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workflow.common.constant.list.api.DateTimeConditionEnum;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/13
*/
@Component
public class PortalWfDealCountCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(PortalWfDealCountCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
/**
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
log.error("PortalWfDealCountCmd");
Map<String,Object> data = new HashMap<>(100);
Long count = 0L ;
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
SimpleEmployee employee = UserContext.getCurrentUser();
conditionEntity.setOperatedate(DateTimeConditionEnum.CURRENT_YEAR);
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
int code = requestCountInfo.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
count = requestCountInfoPAEntity.getCount();
}
} catch (Exception e) {
log.error("PortalWfDealCountCmd-Exception:" + e);
}
data.put("count", count);
return data;
}
}

@ -0,0 +1,204 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.alibaba.fastjson.JSONObject;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import okhttp3.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/4
*/
@Component
public class PortalWorkAchievementCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(UserInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
/**
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String, Object> result = getSaleInfo(request,simpleEmployee);
return result;
}
public Map<String,Object> getSaleInfo(HttpServletRequest request, SimpleEmployee simpleEmployee){
Map<String,Object> map = new HashMap<>(10);
String headcookie = request.getHeader("Cookie");
//有效合同金额
JSONObject yxhtjeObj = new JSONObject();
try {
JSONObject params = new JSONObject();
params.put("compId","e12a1c232bbe4238859da5963f5e9407");
params.put("pageId","880065951867256872");
params.put("filter","[{\"value\":\"f26759ae44ef4e2f866b8dc3359b8c8a\",\"conditionComId\":\"d84ed5ccd4204ef595885cad8dde1822\",\"funcType\":\"\",\"filterFields\":[],\"dataType\":\"classification\",\"conditionType\":\"and\"}]");
params.put("pageFilter","[{\"dataset\":{\"id\":\"10\",\"text\":\"业绩达成表\",\"type\":\"LOGIC\",\"groupId\":\"weaver-ebuilder-contract-servicecmdatauFJXHS\",\"isPhysical\":false}}]");
params.put("cusMenuId","838181366272991264");
params.put("urlPageTitle","5ZCI5ZCM6Zeo5oi3");
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, params.toJSONString());
Request requestPost = new Request.Builder()
.url("http://10.12.253.23:20600/api/ebuilder/coms/digitalpanel/getData")
.method("POST", body)
.addHeader("Cookie", headcookie)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(requestPost).execute();
int code = response.code();
log.error("getSaleInfo yxhtjeObj:"+code);
String data = response.body().string();
log.error("getSaleInfo yxhtjeObj:"+data);
if(StringUtils.isNotBlank(data)){
yxhtjeObj = JSONObject.parseObject(data);
}
} catch (IOException e) {
e.printStackTrace();
log.error("getSaleInfo yxhtjeObj:"+e);
}
map.put("yxhtjeObj",yxhtjeObj);
//新客户销售合同金额
JSONObject xkhxshtjeObj = new JSONObject();
try {
JSONObject params = new JSONObject();
params.put("compId","c0a6f30332a04612b17487f894a9bdb2");
params.put("pageId","880065951867256872");
params.put("filter","[{\"value\":\"f26759ae44ef4e2f866b8dc3359b8c8a\",\"conditionComId\":\"d84ed5ccd4204ef595885cad8dde1822\",\"funcType\":\"\",\"filterFields\":[],\"dataType\":\"classification\",\"conditionType\":\"and\"}]");
params.put("pageFilter","[{\"dataset\":{\"id\":\"40\",\"text\":\"类型分布表\",\"type\":\"LOGIC\",\"groupId\":\"weaver-ebuilder-contract-servicecmdatauFJXHS\",\"isPhysical\":false}}]");
params.put("cusMenuId","838181366272991264");
params.put("urlPageTitle","5ZCI5ZCM6Zeo5oi3");
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, params.toJSONString());
Request requestPost = new Request.Builder()
.url("http://10.12.253.23:20600/api/ebuilder/coms/digitalpanel/getData")
.method("POST", body)
.addHeader("Cookie", headcookie)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(requestPost).execute();
int code = response.code();
log.error("getSaleInfo xkhxshtjeObj:"+code);
String data = response.body().string();
log.error("getSaleInfo xkhxshtjeObj:"+data);
if(StringUtils.isNotBlank(data)){
xkhxshtjeObj = JSONObject.parseObject(data);
}
} catch (IOException e) {
e.printStackTrace();
log.error("getSaleInfo xkhxshtjeObj:"+e);
}
map.put("xkhxshtjeObj",xkhxshtjeObj);
//老客户销售合同金额
JSONObject lkhxshtjeObj = new JSONObject();
try {
JSONObject params = new JSONObject();
params.put("compId","eed91abb469f49928ef2a7a89ab02c93");
params.put("pageId","880065951867256872");
params.put("filter","[{\"value\":\"f26759ae44ef4e2f866b8dc3359b8c8a\",\"conditionComId\":\"d84ed5ccd4204ef595885cad8dde1822\",\"funcType\":\"\",\"filterFields\":[],\"dataType\":\"classification\",\"conditionType\":\"and\"}]");
params.put("pageFilter","[{\"dataset\":{\"id\":\"40\",\"text\":\"类型分布表\",\"type\":\"LOGIC\",\"groupId\":\"weaver-ebuilder-contract-servicecmdatauFJXHS\",\"isPhysical\":false}}]");
params.put("cusMenuId","838181366272991264");
params.put("urlPageTitle","5ZCI5ZCM6Zeo5oi3");
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, params.toJSONString());
Request requestPost = new Request.Builder()
.url("http://10.12.253.23:20600/api/ebuilder/coms/digitalpanel/getData")
.method("POST", body)
.addHeader("Cookie", headcookie)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(requestPost).execute();
int code = response.code();
log.error("getSaleInfo lkhxshtjeObj:"+code);
String data = response.body().string();
log.error("getSaleInfo lkhxshtjeObj:"+data);
if(StringUtils.isNotBlank(data)){
lkhxshtjeObj = JSONObject.parseObject(data);
}
} catch (IOException e) {
e.printStackTrace();
log.error("getSaleInfo lkhxshtjeObj:"+e);
}
map.put("lkhxshtjeObj",lkhxshtjeObj);
//已收款合同金额
JSONObject yskhtjeObj = new JSONObject();
try {
JSONObject params = new JSONObject();
params.put("compId","f03ca1dcaecd456ebb573a23dbe5075b");
params.put("pageId","880065951867256872");
params.put("filter","[{\"value\":\"f26759ae44ef4e2f866b8dc3359b8c8a\",\"conditionComId\":\"d84ed5ccd4204ef595885cad8dde1822\",\"funcType\":\"\",\"filterFields\":[],\"dataType\":\"classification\",\"conditionType\":\"and\"}]");
params.put("pageFilter","[{\"dataset\":{\"id\":\"30\",\"text\":\"合同收款表\",\"type\":\"LOGIC\",\"groupId\":\"weaver-ebuilder-contract-servicecmdatauFJXHS\",\"isPhysical\":false}}]");
params.put("cusMenuId","838181366272991264");
params.put("urlPageTitle","5ZCI5ZCM6Zeo5oi3");
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, params.toJSONString());
Request requestPost = new Request.Builder()
.url("http://10.12.253.23:20600/api/ebuilder/coms/digitalpanel/getData")
.method("POST", body)
.addHeader("Cookie", headcookie)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(requestPost).execute();
int code = response.code();
log.error("getSaleInfo yskhtjeObj:"+code);
String data = response.body().string();
log.error("getSaleInfo yskhtjeObj:"+data);
if(StringUtils.isNotBlank(data)){
yskhtjeObj = JSONObject.parseObject(data);
}
} catch (IOException e) {
e.printStackTrace();
log.error("getSaleInfo yskhtjeObj:"+e);
}
map.put("yskhtjeObj",yskhtjeObj);
map.put("yxht","0");
map.put("xkh","0");;
map.put("lkh","0");
map.put("yskhtje","0");
return map;
}
}

@ -0,0 +1,122 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/14
*/
@Component
public class ProjectAcceptanceInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(ProjectAcceptanceInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84" ;
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = new HashMap<String,Object>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
String employeeId = request.getParameter("employeeId");
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
dataMap.put("employeeId",employeeId);
dataMap.put("startday",startday);
dataMap.put("endday",endday);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql =" select CONVERT(ifnull(sum(cast(t1.htzje as decimal(18,2))),0),CHAR) as htzje," +
" CONVERT(ifnull(sum(cast(t1.htyxje as decimal(18,2))),0),CHAR) as htyxje," +
" CONVERT(ifnull(sum(cast(t1.sumsk as decimal(18,2))),0),CHAR) as sumsk " +
" from uf_jxhs_xmys t1 \n" +
" where t1.ysrq>=? and t1.ysrq<=? " +
" and ( t1.qyjl = ? "+
" or t1.qyjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.ysry = ?\n" +
" or t1.ysry in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.dqfzr = ?\n" +
" or t1.dqfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.tdjl = ?\n" +
" or t1.tdjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.tdfzr = ?\n" +
" or t1.tdfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.jgfzr = ?\n" +
" or t1.jgfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.dqzj = ?\n" +
" or t1.dqzj in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?) " +
" ) " ;
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
dataMap.put("datas",recordList.get(0));
} catch (Exception e) {
e.printStackTrace();
log.error("PorojectAcceptanceInfoCmd:"+e.getMessage());
}
return dataMap;
}
}

@ -0,0 +1,237 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* +
*
* @author wangj
* @version 1.00
* @Date 2024/3/14
*/
@Component
public class ProjectCollaborationInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(ProjectCollaborationInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84";
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = new HashMap<String,Object>();
String employeeId = request.getParameter("employeeId");
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
//项目验收信息
Map<String,Object> ysMap = getYsInfo(employeeId,startday,endday);
Map<String,Object> ysdata = (Map<String, Object>) ysMap.get("datas");
//项目收款信息
Map<String,Object> skMap = getSkInfo(employeeId,startday,endday);
Map<String,Object> skdata = (Map<String, Object>) skMap.get("datas");
dataMap.put("ysdata",ysdata);
dataMap.put("skdata",skdata);
return dataMap;
}
private Map<String,Object> getYsInfo(String employeeId,String startday,String endday){
Map<String,Object> dataMap = new HashMap<String,Object>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
dataMap.put("employeeId",employeeId);
dataMap.put("startday",startday);
dataMap.put("endday",endday);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql =" select CONVERT(ifnull(sum(cast(t1.htzje as decimal(18,2))),0),CHAR) as htzje," +
" CONVERT(ifnull(sum(cast(t1.htyxje as decimal(18,2))),0),CHAR) as htyxje," +
" CONVERT(ifnull(sum(cast(t1.sumsk as decimal(18,2))),0),CHAR) as sumsk " +
" from uf_jxhs_xmys t1 \n" +
" where t1.ysrq>=? and t1.ysrq<=? " +
" and ( t1.qyjl = ? "+
" or t1.qyjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.ysry = ?\n" +
" or t1.ysry in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.dqfzr = ?\n" +
" or t1.dqfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.tdjl = ?\n" +
" or t1.tdjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.tdfzr = ?\n" +
" or t1.tdfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.jgfzr = ?\n" +
" or t1.jgfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.dqzj = ?\n" +
" or t1.dqzj in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?) " +
" ) " ;
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
dataMap.put("datas",recordList.get(0));
} catch (Exception e) {
e.printStackTrace();
log.error("PorojectAcceptanceInfoCmd:"+e.getMessage());
}
return dataMap;
}
public Map<String, Object> getSkInfo(String employeeId,String startday,String endday) {
Map<String,Object> dataMap = new HashMap<String,Object>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
dataMap.put("employeeId",employeeId);
dataMap.put("startday",startday);
dataMap.put("endday",endday);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql =" SELECT \n" +
" CONVERT(ifnull(sum(cast(t1.skje as decimal(18,2))),0),CHAR) as skje,\n" + //收款金额
" CONVERT(ifnull(sum(cast(t1.xmskje as decimal(18,2))),0),CHAR) as xmskje,\n" + // 项目收款金额
" CONVERT(ifnull(sum(cast(t1.xsyxje as decimal(18,2))),0),CHAR) as xsyxje," + // 销售有效金额
" CONVERT(ifnull(sum(cast(t1.xsje as decimal(18,2))),0),CHAR) as xsje," + // 销售金额
" CONVERT(ifnull(sum(cast(t1.xmyxje as decimal(18,2))),0),CHAR) as xmyxje," + //项目有效金额
" CONVERT(ifnull(sum(cast(t1.xsjxhk as decimal(18,2))),0),CHAR) as xsjxhk," + //有效绩效回款
" CONVERT(ifnull(sum(cast(t1.sumsk as decimal(18,2))),0),CHAR) as sumsk," + //总收款金额
" CONVERT(ifnull(sum(cast(t1.sjjsk as decimal(18,2))),0),CHAR) as sjjsk," + //实际结算款
" CONVERT(ifnull(sum(cast(t1.skjs as decimal(18,2))),0),CHAR) as skjs " + //收款结算
" FROM uf_jxhs_skmx t1\n" +
" LEFT JOIN uf_jxhs_zxhtzb t2 ON t1.hth = t2.hth AND t2.hth != '' AND t2.hth IS NOT NULL \n" +
" LEFT JOIN ebdf_physical_data epd on t1.id = epd.form_data_id and epd.delete_type = 0 \n" +
" WHERE t1.skje != 0 \n" +
" and t1.skje IS NOT NULL " +
" and t1.xshsny >= ? and t1.xshsny <=? "+
" and (" +
" ? IN ( 2, 27, 166, 10285, 11661, 300, 876, 3593, 1416, 1647, 1844,3044480226941419013,794508876297846787 ) \n" +
" or cast(t1.xsjl AS decimal(25,0)) in( \n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.kfry AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.qdjl AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.xmjl AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" )\n" +
" order by t1.id " ;
log.error("PorojectReceiptsInfoCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
;
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!CollectionUtils.isEmpty(recordList)){
dataMap.put("datas",recordList.get(0));
}
} catch (Exception e) {
e.printStackTrace();
log.error("PorojectReceiptsInfoCmd Exception:"+e);
}
return dataMap;
}
}

@ -0,0 +1,139 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/14
*/
@Component
public class ProjectReceiptsInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(ProjectReceiptsInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84" ;
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = new HashMap<String,Object>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
dataMap.put("employeeId",employeeId);
dataMap.put("startday",startday);
dataMap.put("endday",endday);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql =" SELECT \n" +
" CONVERT(ifnull(sum(cast(t1.skje as decimal(18,2))),0),CHAR) as skje,\n" + //收款金额
" CONVERT(ifnull(sum(cast(t1.xmskje as decimal(18,2))),0),CHAR) as xmskje,\n" + // 项目收款金额
" CONVERT(ifnull(sum(cast(t1.xsyxje as decimal(18,2))),0),CHAR) as xsyxje," + // 销售有效金额
" CONVERT(ifnull(sum(cast(t1.xsje as decimal(18,2))),0),CHAR) as xsje," + // 销售金额
" CONVERT(ifnull(sum(cast(t1.xmyxje as decimal(18,2))),0),CHAR) as xmyxje," + //项目有效金额
" CONVERT(ifnull(sum(cast(t1.xsjxhk as decimal(18,2))),0),CHAR) as xsjxhk," + //有效绩效回款
" CONVERT(ifnull(sum(cast(t1.sumsk as decimal(18,2))),0),CHAR) as sumsk," + //总收款金额
" CONVERT(ifnull(sum(cast(t1.sjjsk as decimal(18,2))),0),CHAR) as sjjsk," + //实际结算款
" CONVERT(ifnull(sum(cast(t1.skjs as decimal(18,2))),0),CHAR) as skjs " + //收款结算
" FROM uf_jxhs_skmx t1\n" +
" LEFT JOIN uf_jxhs_zxhtzb t2 ON t1.hth = t2.hth AND t2.hth != '' AND t2.hth IS NOT NULL \n" +
" LEFT JOIN ebdf_physical_data epd on t1.id = epd.form_data_id and epd.delete_type = 0 \n" +
" WHERE t1.skje != 0 \n" +
" and t1.skje IS NOT NULL " +
" and t1.xshsny >= ? and t1.xshsny <=? "+
" and (" +
" ? IN ( 2, 27, 166, 10285, 11661, 300, 876, 3593, 1416, 1647, 1844,3044480226941419013,794508876297846787 ) \n" +
" or cast(t1.xsjl AS decimal(25,0)) in( \n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.kfry AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.qdjl AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.xmjl AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" )\n" +
" order by t1.id " ;
log.error("PorojectReceiptsInfoCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
;
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!CollectionUtils.isEmpty(recordList)){
dataMap.put("datas",recordList.get(0));
}
} catch (Exception e) {
e.printStackTrace();
log.error("PorojectReceiptsInfoCmd Exception:"+e);
}
return dataMap;
}
}

@ -0,0 +1,764 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.seconddev.jcldoor.util.JucailinPortalUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/19
*/
@Component
public class SelfServiceInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(SelfServiceInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
@Autowired
private JucailinPortalUtils jucailinPortalUtils;
public String tenant_key = "t7akvdnf84";
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> recordMap = new HashMap<String,Object>();
String pkey = "uf_zzfwcsh.taby.fieldId";
String field_id = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwcsh.taby.url";
String taburl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String employeeId = request.getParameter("employeeId");
//type: 0 系统默认 1 自定义配置
String type = "0";
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
//返回自助服务tab信息
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
//返回近期访问数据
List<Map<String,Object>> record = new ArrayList<Map<String,Object>>();
try{
String sql = " select distinct taby from uf_zzfwrkpz where ry=? and qy is not null and taby is not null and delete_type=0 and tenant_key =?";
log.error("sql:"+sql);
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, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
// /api/file/preview?type=redirect&imgFormat=small&fileId=977697615197618177&module=ebuilderform&authModule=ebuilderform&source=form&fieldId=977686869110833154&customParam=%7B%22dataId%22%3A%22977697666574729218%22%7D&refId=977697666574729218&folderId=8120831157448215424
dataList = getCustomeServiceData(groupId,sourceType,employeeId);
record = getCustomeServiceRecord(groupId,sourceType,employeeId);
type = "1";
}else{
dataList = getDefaultServiceData(groupId,sourceType,field_id);
record = getDefaultServiceRecord(groupId,sourceType,employeeId);
type = "0";
}
}catch (Exception e){
log.error("testSapi51-Exception:"+e.getMessage());
}
recordMap.put("list",dataList);
recordMap.put("record",record);
recordMap.put("type",type);
recordMap.put("taburl",taburl);
return recordMap;
}
public List<Map<String,Object>> getCustomeServiceData(String groupId,String sourceType,String employeeId){
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
Map<String,String> optionMap = new HashMap<String,String>();
List<String> tbyList = new ArrayList<String>();
try{
String sql = " select id,tabymmc from uf_zzfwrktaby where qy is not null and ry=? and delete_type=0 and tenant_key = ? order by ifnull(xssx,0) ";
log.error("getCustomServiceTypeName-sql:"+sql);
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, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap = recordList.get(i);
String value = String.valueOf(recordMap.get("id"));
String name = String.valueOf(recordMap.get("tabymmc"));
log.error("getCustomServiceTypeName-value:"+value+" name:"+name);
optionMap.put(value,name);
tbyList.add(value);
}
log.error("getCustemSelfServiceType-tbyList:"+tbyList.size());
for(int i=0;i<tbyList.size();i++){
Map<String,Object> recordMap = new HashMap<String,Object>();
String taby = String.valueOf(tbyList.get(i));
log.error("getCustemSelfServiceType-taby:"+taby);
recordMap.put("taby",taby);
String tabyName = optionMap.get(taby);
List<Map<String,Object>> customList = getCustomeServiceDataByType(groupId,sourceType,taby,employeeId);
log.error("getCustemSelfServiceType-tabyName:"+tabyName);
recordMap.put("menus",customList);
recordMap.put("name",tabyName);
dataList.add(recordMap);
}
}catch (Exception e){
log.error("getCustomServiceTypeName-e:"+e);
}
log.error("getCustemSelfServiceType-dataList:"+dataList.size());
return dataList;
}
public List<Map<String,Object>> getCustomeServiceDataByType(String groupId,String sourceType,String value,String employeeId){
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
try{
String sql = " select id,fwmc,fwdz,fwtb,taby from uf_zzfwrkpz where ry=? and qy is not null and taby is not null and taby=? and delete_type=0 and tenant_key = ? order by ifnull(xssx,0) ";
log.error("getSelfServiceData--sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(value);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap = recordList.get(i);
String fwtb = String.valueOf(recordMap.get("fwtb"));
String fwtburl = "";
if(StringUtils.isNotBlank(fwtb)){
fwtburl = "/api/file/preview?fileId="+fwtb+"&module=ebuilderform&authModule=ebuilderform&type=imgs&source=form&fieldId="+fwtb+"&imgFormat=small";
}
recordMap.put("fwtburl",fwtburl);
dataList.add(recordMap);
}
}catch (Exception e){
e.printStackTrace();
log.error("getCustomeServiceDataByType-e:"+e);
}
return dataList;
}
/***
*
* @param groupId
* @param sourceType
* @return
*/
public List<Map<String,Object>> getDefaultServiceData(String groupId,String sourceType,String field_id){
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
try{
String sql = " select name,value_key as taby from field_option where field_id=? and delete_type=0 and tenant_key = ?";
log.info("sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(field_id);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap = recordList.get(i);
String taby = String.valueOf(recordMap.get("taby"));
List<Map<String,Object>> defaultList = getDefaultServiceDataByType(groupId,sourceType,taby);
recordMap.put("menus",defaultList);
dataList.add(recordMap);
}
}catch (Exception e){
e.printStackTrace();
log.error("getDefaultServiceData-e:"+e);
}
return dataList;
}
/***
*
* @param groupId
* @param sourceType
* @param value
* @return
*/
public List<Map<String,Object>> getDefaultServiceDataByType(String groupId,String sourceType,String value){
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
try{
String sql =" select t.taby,t.fwtb,t.fwmc,t.fwdz " +
" from uf_zzfwcsh t \n" +
" where t.delete_type=0 \n" +
" and t.taby= ?" +
" and t.tenant_key = ?" +
" order by ifnull(t.xssx,0) ";
log.error("getSelfServiceData--sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(value);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap = recordList.get(i);
String fwtb = String.valueOf(recordMap.get("fwtb"));
String fwtburl = "";
if(StringUtils.isNotBlank(fwtb)){
fwtburl = "/api/file/preview?fileId="+fwtb+"&module=ebuilderform&authModule=ebuilderform&type=imgs&source=form&fieldId="+fwtb+"&imgFormat=small";
}
recordMap.put("fwtburl",fwtburl);
dataList.add(recordMap);
}
}catch (Exception e){
e.printStackTrace();
log.error("getDefaultServiceDataByType-e:"+e);
}
return dataList;
}
/***
*
* @param groupId
* @param sourceType
* @return
*/
public Map<String,String> getCustomServiceTypeName(String groupId,String sourceType,String employeeId){
Map<String,String> optionMap = new HashMap<String,String>();
try{
String sql = " select id,tabymmc from uf_zzfwrktaby where qy is not null and ry=? and delete_type=0 and tenant_key = ? order by ifnull(xssx,0) ";
log.error("getCustomServiceTypeName-sql:"+sql);
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, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap = recordList.get(i);
String value = String.valueOf(recordMap.get("id"));
String name = String.valueOf(recordMap.get("tabymmc"));
log.error("getCustomServiceTypeName-value:"+value+" name:"+name);
optionMap.put(value,name);
}
}catch (Exception e){
log.error("getCustomServiceTypeName-e:"+e);
}
return optionMap;
}
/**
* 访
* @param groupId
* @param sourceType
* @param employeeId
* @return
*/
public List<Map<String,Object>> getCustomeServiceRecord(String groupId,String sourceType,String employeeId){
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
try {
String sql = " select id,fwmc,fwdz,fwtb,taby from uf_zzfwrkpz where ry=? and qy is not null and taby is not null and delete_type=0 and tenant_key = ? order by djcs desc limit 6";
log.info("getCustomeServiceRecord--sql:"+sql);
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, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap = recordList.get(i);
String fwtb = String.valueOf(recordMap.get("fwtb"));
String fwtburl = "";
if(StringUtils.isNotBlank(fwtb)){
fwtburl = "/api/file/preview?fileId="+fwtb+"&module=ebuilderform&authModule=ebuilderform&type=imgs&source=form&fieldId="+fwtb+"&imgFormat=small";
}
recordMap.put("fwtburl",fwtburl);
dataList.add(recordMap);
}
}catch (Exception e){
e.printStackTrace();
log.error("getCustomeServiceRecord-e:"+e);
}
return dataList;
}
/**
*
* @param request
* @param simpleEmployee
* @return
*/
public Map<String, Object> addSelfServiceCount(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> recordMap = new HashMap<String,Object>();
String id = request.getParameter("id");
if(StringUtils.isBlank(id)){
recordMap.put("status",false);
}else {
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql = "update uf_zzfwrkpz set djcs = ifnull(djcs,0) + 1 where id = ?";
List<String> strlist = new ArrayList<>(100);
strlist.add(id);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
recordMap.put("status",true);
}
return recordMap;
}
/**
* 访
* @param groupId
* @param sourceType
* @param employeeId
* @return
*/
public List<Map<String,Object>> getDefaultServiceRecord(String groupId,String sourceType,String employeeId){
String sql = "select t.taby,t.fwtb,t.fwmc,t.fwdz from uf_zzfwcsh t where t.delete_type=0 and t.tenant_key = ? limit 6";
log.info("getDefaultServiceRecord--sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
return recordList;
}
/***
*
* @param paramMap
* @return
*/
public Map<String,Object> initSelfServiceData(Map<String,Object> paramMap){
String employeeId = String.valueOf(paramMap.get("employeeId"));
log.error("employeeId:"+employeeId);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
Map<String,Object> recordMap = new HashMap<String,Object>();
String pkey = "uf_zzfwcsh.taby.fieldId";
String field_id = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrktaby.qy.value";
String uf_zzfwrktaby_qy = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrkpz.qy.value";
String uf_zzfwrkpz_qy = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
try{
String sql = " select distinct taby from uf_zzfwrkpz where ry=? and qy is not null and taby is not null and delete_type=0 and tenant_key =?";
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, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
recordMap.put("code","200");
recordMap.put("type","1");
}else{
log.error("uf_zzfwrkpz is null ");
int count = initCustomServiceData(groupId,sourceType,field_id,employeeId,uf_zzfwrktaby_qy,uf_zzfwrkpz_qy);
if(count > 0){
recordMap.put("code","-100");
}else{
recordMap.put("code","200");
}
recordMap.put("type","0");
}
}catch (Exception e){
log.error("testSapi51-Exception:"+e.getMessage());
recordMap.put("code","-200");
}
return recordMap;
}
/***
*
* @param groupId
* @param sourceType
* @return
*/
public int initCustomServiceData(String groupId,String sourceType,String field_id,String employeeId,String uf_zzfwrktaby_qy,String uf_zzfwrkpz_qy){
int errcount = 0;
try{
List<Map<String,Object>> recordList = getFieldOptionList(sourceType,groupId,field_id);
log.error("initCustomServiceData-recordList:"+recordList.size());
updateServiceTabData(employeeId,sourceType,groupId,uf_zzfwrktaby_qy,recordList);
for(int i=0;i<recordList.size();i++) {
Map<String, Object> recordMap = recordList.get(i);
String name = String.valueOf(recordMap.get("name"));
String taby = String.valueOf(recordMap.get("taby"));
String tabid = getServiceTabId(employeeId, name, groupId, sourceType, uf_zzfwrktaby_qy,"1");
log.error("initCustomServiceData-tabid:"+tabid);
if(StringUtils.isNotBlank(tabid)){
initCustomServiceDataByType(employeeId,groupId,sourceType,taby,tabid,uf_zzfwrkpz_qy);
}
}
}catch (Exception e){
errcount++;
e.printStackTrace();
log.error("Exception-e:"+e);
}
return errcount;
}
/***
*
* @param sourceType
* @param groupId
* @param field_id
* @return
*/
public List<Map<String,Object>> getFieldOptionList(String sourceType,String groupId,String field_id){
List<Map<String,Object>> recordList = new ArrayList<Map<String,Object>>();
try{
String sql = " select name,value_key as taby from field_option where field_id=? and delete_type=0 and tenant_key = ?";
log.error("sql:"+sql);
List<String> paramList = new ArrayList<>(100);
paramList.add(field_id);
paramList.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(paramList);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
recordList = databaseUtils.getDataSourceList(result);
}catch (Exception e){
log.error("getFieldOptionList-e:"+e);
}
return recordList;
}
/***
*
* @param employeeId
* @param sourceType
* @param groupId
* @param recordList
* @return
*/
public String updateServiceTabData(String employeeId,String sourceType,String groupId,String uf_zzfwrktaby_qy,List<Map<String,Object>> recordList){
String code = "200" ;
try{
// String field_ry = "977243460998938628";
// String field_tabymmc = "977680413716267009";
// String field_qy = "977701557798322178";
// String field_xssx = "981394667260444674";
// String objId = "977243418007322626";
String pkey = "uf_zzfwrktaby.ry";
String field_ry = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrktaby.tabymmc";
String field_tabymmc = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrktaby.qy";
String field_qy = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrktaby.xssx";
String field_xssx = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrktaby.objId";
String objId = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
List<EBDataReqDto> insertEbDataReqDtoList = Lists.newArrayList();
List<EBDataReqDto> updateEbDataReqDtoList = Lists.newArrayList();
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap = recordList.get(i);
String name = String.valueOf(recordMap.get("name"));
String tabid = getServiceTabId(employeeId,name,groupId,sourceType,uf_zzfwrktaby_qy,"0");
log.error("tabid:"+tabid);
if(StringUtils.isNotBlank(tabid)){
// 数据1
EBDataReqDto ebDataReqDto = new EBDataReqDto();
List<EBDataReqDetailDto> mainData = Lists.newArrayList();
// 设置更新id
mainData.add(new EBDataReqDetailDto("id", tabid));
// 单行文本
mainData.add(new EBDataReqDetailDto(field_tabymmc, name));
// 选择框根据选项名赋值
mainData.add(new EBDataReqDetailDto(field_qy, uf_zzfwrktaby_qy));
mainData.add(new EBDataReqDetailDto(field_xssx, i+""));
ebDataReqDto.setMainDatas(mainData);
updateEbDataReqDtoList.add(ebDataReqDto);
}else{
EBDataReqDto ebDataReqDto = new EBDataReqDto();
List<EBDataReqDetailDto> mainData = Lists.newArrayList();
mainData.add(new EBDataReqDetailDto(field_ry, employeeId));
mainData.add(new EBDataReqDetailDto(field_tabymmc, name));
mainData.add(new EBDataReqDetailDto(field_qy, uf_zzfwrktaby_qy));
mainData.add(new EBDataReqDetailDto(field_xssx, i+""));
ebDataReqDto.setMainDatas(mainData);
insertEbDataReqDtoList.add(ebDataReqDto);
}
}
log.error("insertEbDataReqDtoList:"+insertEbDataReqDtoList.size());
if(insertEbDataReqDtoList !=null && insertEbDataReqDtoList.size()>0){
jucailinPortalUtils.saveModeData(objId,employeeId,tenant_key,insertEbDataReqDtoList);
}
log.error("updateEbDataReqDtoList:"+updateEbDataReqDtoList.size());
if(updateEbDataReqDtoList !=null && updateEbDataReqDtoList.size()>0){
jucailinPortalUtils.updateModeDataById(objId,employeeId,tenant_key,updateEbDataReqDtoList,false);
}
}catch (Exception e){
code = "-200";
log.error("insertTabData-e:"+e);
}
log.error("insertTabData-code:"+code);
return code;
}
/***
*
* @param employeeId
* @param name
* @param groupId
* @param sourceType
* @return
*/
public String getServiceTabId(String employeeId,String name,String groupId,String sourceType,String uf_zzfwrktaby_qy,String type){
String tabid = "" ;
try{
if("1".equals(type)){
String sql = "select id from uf_zzfwrktaby where ry = ? and tabymmc = ? and qy = ? and delete_type=0 and tenant_key = ?";
List<String> paramList = new ArrayList<>(100);
paramList.add(employeeId);
paramList.add(name);
paramList.add(uf_zzfwrktaby_qy);
paramList.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(paramList);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty() && recordList.size()>0){
Map<String, Object> recordMap = recordList.get(0);
tabid = String.valueOf(recordMap.get("id"));
}
}else{
String sql = "select id from uf_zzfwrktaby where ry = ? and tabymmc = ? and delete_type=0 and tenant_key = ?";
List<String> paramList = new ArrayList<>(100);
paramList.add(employeeId);
paramList.add(name);
paramList.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(paramList);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty() && recordList.size()>0){
Map<String, Object> recordMap = recordList.get(0);
tabid = String.valueOf(recordMap.get("id"));
}
}
}catch (Exception e){
log.error("getTabId-e:"+e);
}
return tabid;
}
/**
*
* @param employeeId
* @param groupId
* @param sourceType
* @param selectvalue
* @param tabid
* @return
*/
public int initCustomServiceDataByType(String employeeId,String groupId,String sourceType,String selectvalue,String tabid,String uf_zzfwrktaby_qy){
int errcount = 0 ;
// String field_ry = "977242052157390850";
// String field_fwmc = "977686396664430594";
// String field_fwdz = "977686396664430595";
// String field_fwtb = "977686869110833154";
// String field_qy = "977703984547119105";
// String field_xssx = "981394744418861058";
// String field_taby = "977686869110833157";
// String objId = "977240471802363906";
String pkey = "uf_zzfwrkpz.ry";
String field_ry = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrkpz.fwmc";
String field_fwmc = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrkpz.fwdz";
String field_fwdz = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrkpz.fwtb";
String field_fwtb = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrkpz.qy";
String field_qy = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrkpz.xssx";
String field_xssx = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrkpz.taby";
String field_taby = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_zzfwrkpz.objId";
String objId = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
try{
String sql =" select t.taby,t.fwtb,t.fwmc,t.fwdz " +
" from uf_zzfwcsh t \n" +
" where t.delete_type=0 \n" +
" and t.taby= ?" +
" and t.tenant_key = ?" +
" order by ifnull(t.xssx,0) ";
log.error("initCustomServiceDataByType--sql:"+sql);
List<String> paramList = new ArrayList<>(100);
paramList.add(selectvalue);
paramList.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(paramList);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
log.error("initCustomServiceDataByType--recordList:"+recordList.size());
List<EBDataReqDto> EBDataReqDtoList = Lists.newArrayList();
for(int i=0;i<recordList.size();i++){
Map<String,Object> recordMap = recordList.get(i);
String fwtb = String.valueOf(recordMap.get("fwtb"));
String fwmc = String.valueOf(recordMap.get("fwmc"));
String fwdz = String.valueOf(recordMap.get("fwdz"));
EBDataReqDto ebDataReqDto = new EBDataReqDto();
List<EBDataReqDetailDto> mainData = Lists.newArrayList();
mainData.add(new EBDataReqDetailDto(field_ry, employeeId));
mainData.add(new EBDataReqDetailDto(field_fwmc, fwmc));
mainData.add(new EBDataReqDetailDto(field_fwdz, fwdz));
mainData.add(new EBDataReqDetailDto(field_fwtb, fwtb));
mainData.add(new EBDataReqDetailDto(field_qy, uf_zzfwrktaby_qy));
mainData.add(new EBDataReqDetailDto(field_xssx, i+""));
mainData.add(new EBDataReqDetailDto(field_taby, tabid));
ebDataReqDto.setMainDatas(mainData);
EBDataReqDtoList.add(ebDataReqDto);
}
log.error("EBDataReqDtoList:"+EBDataReqDtoList.size());
if(EBDataReqDtoList !=null && EBDataReqDtoList.size()>0){
jucailinPortalUtils.saveModeData(objId,employeeId,tenant_key,EBDataReqDtoList);
}
}catch (Exception e){
errcount++;
}
return errcount;
}
/***
*
* @param employeeId
* @return
*/
public Map<String,Object> updateSelfServiceData(String employeeId){
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
Map<String,Object> recordMap = new HashMap<String,Object>();
String code1 = "" ;
String code2 = "" ;
try{
if(StringUtils.isNotBlank(employeeId)){
String sql1 =" update uf_zzfwrktaby set delete_type = 1,is_delete=1 where ry ="+employeeId+" and tenant_key='"+tenant_key+"' ";
Map<String, Object> result1 = databaseUtils.execute(sourceType, groupId, sql1);
Iterator<Map.Entry<String, Object>> iterator1 = result1.entrySet().iterator();
while (iterator1.hasNext()){
Map.Entry<String, Object> next = iterator1.next();
log.error("insertCustomServiceData--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
}
if(result1.containsKey("code")){
code1 = String.valueOf(result1.get("code"));
}
String sql2 =" update uf_zzfwrkpz set delete_type = 1,is_delete=1 where ry ="+employeeId+" and tenant_key='"+tenant_key+"'";
Map<String, Object> result2 = databaseUtils.execute(sourceType, groupId, sql2);
Iterator<Map.Entry<String, Object>> iterator2 = result2.entrySet().iterator();
while (iterator2.hasNext()){
Map.Entry<String, Object> next = iterator2.next();
log.error("insertCustomServiceData--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
}
if(result2.containsKey("code")){
code2 = String.valueOf(result2.get("code"));
}
}
}catch (Exception e){
log.error("testSapi51-Exception:"+e.getMessage());
recordMap.put("code","-200");
}
recordMap.put("code1",code1);
recordMap.put("code2",code2);
return recordMap;
}
}

@ -0,0 +1,526 @@
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;
import com.weaver.seconddev.jcldoor.util.CommonUtils;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.seconddev.jcldoor.util.JucailinPortalUtils;
import com.weaver.teams.client.doc.remote.DocClientService;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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;
import java.time.Period;
import java.time.temporal.ChronoUnit;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/4
*/
@Component
public class UserInfoCmd {
//日志
private final static Logger log = LoggerFactory.getLogger(UserInfoCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
@RpcReference
DocClientService docClientService;
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
@RpcReference
private com.weaver.em.msg.api.rest.OaRest oaRest;
@Autowired
private JucailinPortalUtils jucailinPortalUtils;
public String tenant_key = "t7akvdnf84";
/**
* -:478:80:128:128:239:439
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getUserInfo(SimpleEmployee simpleEmployee) {
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
Map<String, Object> map = new HashMap<>(100);
Long employeeId = simpleEmployee.getEmployeeId();
String username = simpleEmployee.getName();
String userimageurl = "/profile/" + employeeId + "/personal";
String department = simpleEmployee.getDepartment().getName();
String position = simpleEmployee.getPosition().getName();
String days = "";
String doccreate = "0";
String wfcreate = "0";
String wfdeal = "0";
String cyqlsl = "0";
String mtgtrs = "0";
try{
if (StringUtils.isNotBlank(employeeId+"")) {
String dataSql =" select a.hiredate " +
" from eteams.employee a " +
" 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)) {
Map<String, Object> recordMap = recordList.get(0);
String hiredate = CommonUtils.null2String(recordMap.get("hiredate"));
if (StringUtils.isNotBlank(hiredate)) {
try {
days = calculateMinute2(hiredate);
} catch (Exception e) {
log.error("calculateMinute2-e:" + e);
}
if (StringUtils.isBlank(days)) {
days = String.valueOf(calculateMinute(hiredate));
}
}
}
}
}catch (Exception e){
e.printStackTrace();
log.error("getUserInfo--hiredate:" + e);
}
try {
if (StringUtils.isNotBlank(employeeId+"")) {
//文档创建
doccreate = getDocCreateNum(employeeId);
//流程创建
wfcreate = getWfCreateNum(simpleEmployee);
//流程处理
wfdeal = getWfDealNum(simpleEmployee);
//参与群聊数量
cyqlsl = getCyqlNumNew(employeeId);
mtgtrs = getPjMtgtcsNew(employeeId);
}
} 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);
return map;
}
/**
*
*
* @param employeeId
* @return
*/
public String getDocCreateNum(Long employeeId) {
String num = "0";
try {
int doccreatecount = docClientService.countByCreator(employeeId);
num = doccreatecount + "";
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return num;
}
/**
*
*
* @return
*/
public String getWfCreateNum(SimpleEmployee employee) {
String num = "0";
try {
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
WeaResult<RequestCountInfoPAEntity> RequestCountInfoPAEntity = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), conditionEntity);
Long count = RequestCountInfoPAEntity.getData().getCount();
num = count + "";
} catch (Exception e) {
e.printStackTrace();
log.error("getWfCreateNum:" + e);
}
return num;
}
/**
*
*
* @return
*/
public String getWfDealNum(SimpleEmployee employee) {
String num = "0";
try {
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
WeaResult<RequestCountInfoPAEntity> RequestCountInfoPAEntity = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
int code = RequestCountInfoPAEntity.getCode();
if (code == 200) {
Long count = RequestCountInfoPAEntity.getData().getCount();
num = count + "";
}
} catch (Exception e) {
e.printStackTrace();
log.error("getWfDealNum:" + e);
}
return num;
}
/**
*
*
* @param sdate
* @return
* @throws ParseException
*/
public int calculateMinute(String sdate) throws ParseException {
long l = 0;
boolean flag = isTimestampFormat(sdate);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date etime = new Date();
if (flag) {
Date stime = df.parse(sdate);
l = etime.getTime() - stime.getTime();
} else {
l = etime.getTime() - new Long(sdate);
}
int day = (int) (l / (24 * 60 * 60 * 1000));
return day;
}
public String calculateMinute2(String sdate) throws ParseException {
String rzsj = "";
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();
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);
}
return rzsj;
}
public boolean isTimestampFormat(String inputDate) {
// 使用 simpleDateFormat 尝试将输入日期解析为时间戳格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
sdf.parse(inputDate);
return true;
} catch (Exception e) {
return false;
}
}
/**
*
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getUserType(SimpleEmployee simpleEmployee) {
Map<String, Object> map = new HashMap<>(100);
String type = "3";
try {
String field69 = "";
SimpleEmployee employee = UserContext.getCurrentUser();
log.error("getUserType-employee:" + employee.getEmployeeId());
long formdata = employee.getFormdata();
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 sourceType = "LOGIC";
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) {
// 销售 0项目 1,技术 2其它 3
field69 = String.valueOf(recordList.get(0).get("field69"));
}
log.error("field69:" + field69);
if (StringUtils.isNotBlank(field69)) {
type = getfield69Type(field69);
}
} catch (Exception e) {
e.printStackTrace();
log.error("getUserType-e:" + e);
}
map.put("type", type);
return map;
}
private String getfield69Type(String key) {
String type = "3";
switch (key) {
case "1":
type = "0";
break;
case "2":
type = "1";
break;
case "3":
type = "2";
break;
default:
type = "3";
}
return type;
}
/**
*
* @param employeeId
* @return
*/
public String getCyqlNumNew(Long employeeId) {
String amount = "0";
try{
String sql = "select amount from uf_nj_cyqltjb where ry = ? and delete_type=0 and tenant_key = ?";
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId+"");
strlist.add(tenant_key);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
amount = String.valueOf(recordList.get(0).get("amount"));
}
}catch (Exception e){
e.printStackTrace();
log.error("getCyqlNumNew-e:" + e);
}
return amount;
}
// public 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 = "20";
// 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+"";
//
// }
/**
*
* @param employeeId
* @return
*/
public String getPjMtgtcsNew(Long employeeId) {
String amount = "0.0";
try{
String sql = "select amount from uf_nj_pjmrdlhhsl where ry = ? and delete_type=0 and tenant_key = ?";
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId+"");
strlist.add(tenant_key);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
amount = String.valueOf(recordList.get(0).get("amount"));
}
}catch (Exception e){
e.printStackTrace();
log.error("getPjMtgtcsNew-e:"+e);
}
return amount;
}
// 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 = "20";
// 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+"";
// }
}

@ -0,0 +1,979 @@
package com.weaver.seconddev.jcldoor.cmd;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.jcldoor.util.CommonUtils;
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
import com.weaver.seconddev.jcldoor.util.JucailinPortalUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workflow.common.constant.list.api.DateTimeConditionEnum;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2024/3/25
*/
@Component
public class WorkDataCmd {
private final static Logger log = LoggerFactory.getLogger(WorkDataCmd.class);
@Autowired
private DatabaseUtils databaseUtils;
public String tenant_key = "t7akvdnf84";
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
@Autowired
private JucailinPortalUtils jucailinPortalUtils;
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String, Object> recordMap = new HashMap<String, Object>();
List<Map<String,String>> list = new ArrayList<>(100);
Map<String,String> oneMap = new HashMap<>(100);
Map<String,String> twoMap = new HashMap<>(100);
Map<String,String> threeMap = new HashMap<>(100);
Map<String,String> fourMap = new HashMap<>(100);
Map<String,Object> typeMap = getUserType(simpleEmployee);
//销售 0项目 1,技术 2其它 3
String znlx = (String) typeMap.get("type");
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = String.valueOf(simpleEmployee.getEmployeeId());
String one = "0";
String oneword = "";
String oneurl = "";
String two = "0";
String twoword = "";
String twourl = "";
String three = "0";
String threeword = "";
String threeurl = "";
String four = "0";
String fourword = "";
String foururl = "";
//销售 0项目 1,技术 2其它 3
if("2".equals(znlx)){
Map<String, Object> wtMap = getQuestInfo(startday, endday, employeeId);
one = (String) wtMap.get("count");
oneword = "本年问题处理数";
String pkey = "workdata.technology.wtclsl";
oneurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String, Object> rtMap = getDaysInfo(startday, endday, employeeId);
two = (String) rtMap.get("count");
twoword = "本年开发人天";
pkey = "workdata.technology.kfrt";
twourl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String, Object> gtxzMap = getInteractInfo(startday, endday, employeeId);
three = (int) gtxzMap.get("count")+"";
threeword = "本年协作沟通数";
pkey = "workdata.technology.gtxz";
threeurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String, Object> wfMap = getWfInfo();
four = (Long) wfMap.get("count")+"";
fourword = "本年处理流程数";
pkey = "workdata.technology.cllc";
foururl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
}else if("1".equals(znlx)){
one = "0.00";
oneword = "本年验收指标";
String pkey = "workdata.project.yszb";
oneurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
//项目验收信息
Map<String,Object> ysMap = getYsInfo(employeeId,startday,endday);
Map<String,Object> ysdata = (Map<String, Object>) ysMap.get("datas");
two = (String) ysdata.get("htzje");
two = parseJe(two);
twoword = "本年验收金额";
pkey = "workdata.project.ysje";
twourl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
three = "0.00";
threeword = "本年指标达成率";
pkey = "workdata.project.zbdcl";
threeurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
//项目收款信息
Map<String,Object> skMap = getSkInfo(employeeId,startday,endday);
Map<String,Object> skdata = (Map<String, Object>) skMap.get("datas");
four = (String) skdata.get("skje");
four = parseJe(four);
fourword = "本年收款金额";
pkey = "workdata.project.skje";
foururl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
}else if("3".equals(znlx)){
Map<String,Object> wfMap = getWfInfo();
one = (Long) wfMap.get("count")+"";
oneword = "本年处理流程数";
String pkey = "workdata.other.cllc";
oneurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> wdMap = getDocInfo(startday,endday,employeeId);
two = (int) wdMap.get("count")+"";
twoword = "本年文档贡献度";
pkey = "workdata.other.wdgx";
twourl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> wbMap = getDailyInfo(startday,endday,employeeId);
three = (int) wbMap.get("count")+"";
threeword = "本年微博填写数";
pkey = "workdata.other.wbtx";
threeurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> gtxzMap = getInteractInfo(startday,endday,employeeId);
four = (int) gtxzMap.get("count")+"";
fourword = "本年沟通协作数";
pkey = "workdata.other.gtxz";
foururl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
}else{
Map<String,Object> wfMap = getWfInfo();
one = (Long) wfMap.get("count")+"";
oneword = "本年处理流程数";
String pkey = "workdata.other.cllc";
oneurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> wdMap = getDocInfo(startday,endday,employeeId);
two = (int) wdMap.get("count")+"";
twoword = "本年文档贡献度";
pkey = "workdata.other.wdgx";
twourl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> wbMap = getDailyInfo(startday,endday,employeeId);
three = (int) wbMap.get("count")+"";
threeword = "本年微博填写数";
pkey = "workdata.other.wbtx";
threeurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> gtxzMap = getInteractInfo(startday,endday,employeeId);
four = (int) gtxzMap.get("count")+"";
fourword = "本年沟通协作数";
pkey = "workdata.other.gtxz";
foururl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
}
oneMap.put("name",oneword);
oneMap.put("value",one);
oneMap.put("url",oneurl);
twoMap.put("name",twoword);
twoMap.put("value",two);
twoMap.put("url",twourl);
threeMap.put("name",threeword);
threeMap.put("value",three);
threeMap.put("url",threeurl);
fourMap.put("name",fourword);
fourMap.put("value",four);
fourMap.put("url",foururl);
list.add(oneMap);
list.add(twoMap);
list.add(threeMap);
list.add(fourMap);
recordMap.put("list",list);
return recordMap;
}
public Map<String, Object> getInfoByType(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String, Object> recordMap = new HashMap<String, Object>();
String znlx = CommonUtils.null2String(request.getParameter("type"));
List<Map<String,String>> list = new ArrayList<>(100);
Map<String,String> oneMap = new HashMap<>(100);
Map<String,String> twoMap = new HashMap<>(100);
Map<String,String> threeMap = new HashMap<>(100);
Map<String,String> fourMap = new HashMap<>(100);
String startday = request.getParameter("startday");
String endday = request.getParameter("endday");
String employeeId = request.getParameter("employeeId");
String one = "0";
String oneword = "";
String oneurl = "";
String two = "0";
String twoword = "";
String twourl = "";
String three = "0";
String threeword = "";
String threeurl = "";
String four = "0";
String fourword = "";
String foururl = "";
//销售 0项目 1,技术 2其它 3
if("2".equals(znlx)){
Map<String, Object> wtMap = getQuestInfo(startday, endday, employeeId);
one = (String) wtMap.get("count");
oneword = "本年问题处理数";
String pkey = "workdata.technology.wtclsl";
oneurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String, Object> rtMap = getDaysInfo(startday, endday, employeeId);
two = (String) rtMap.get("count");
twoword = "本年开发人天";
pkey = "workdata.technology.kfrt";
twourl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String, Object> gtxzMap = getInteractInfo(startday, endday, employeeId);
three = (int) gtxzMap.get("count")+"";
threeword = "本年协作沟通数";
pkey = "workdata.technology.gtxz";
threeurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String, Object> wfMap = getWfInfo();
four = (Long) wfMap.get("count")+"";
fourword = "本年处理流程数";
pkey = "workdata.technology.cllc";
foururl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
}else if("1".equals(znlx)){
one = "0.00";
oneword = "本年验收指标";
String pkey = "workdata.project.cllc";
oneurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
//项目验收信息
Map<String,Object> ysMap = getYsInfo(employeeId,startday,endday);
Map<String,Object> ysdata = (Map<String, Object>) ysMap.get("datas");
two = (String) ysdata.get("htzje");
twoword = "本年验收金额";
pkey = "workdata.project.ysje";
twourl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
three = "0.00";
threeword = "本年指标达成率";
pkey = "workdata.project.zbdcl";
threeurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
//项目收款信息
Map<String,Object> skMap = getSkInfo(employeeId,startday,endday);
Map<String,Object> skdata = (Map<String, Object>) skMap.get("datas");
four = (String) skdata.get("skje");
fourword = "本年收款金额";
pkey = "workdata.project.skje";
foururl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
}else if("3".equals(znlx)){
Map<String,Object> wfMap = getWfInfo();
one = (Long) wfMap.get("count")+"";
oneword = "本年处理流程数";
String pkey = "workdata.other.cllc";
oneurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> wdMap = getDocInfo(startday,endday,employeeId);
two = (int) wdMap.get("count")+"";
twoword = "本年文档贡献度";
pkey = "workdata.other.wdgx";
twourl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> wbMap = getDailyInfo(startday,endday,employeeId);
three = (int) wbMap.get("count")+"";
threeword = "本年微博填写数";
pkey = "workdata.other.wbtx";
threeurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> gtxzMap = getInteractInfo(startday,endday,employeeId);
four = (int) gtxzMap.get("count")+"";
fourword = "本年协作沟通数";
pkey = "workdata.other.gtxz";
foururl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
}else{
Map<String,Object> wfMap = getWfInfo();
one = (Long) wfMap.get("count")+"";
oneword = "本年处理流程数";
String pkey = "workdata.other.cllc";
oneurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> wdMap = getDocInfo(startday,endday,employeeId);
two = (int) wdMap.get("count")+"";
twoword = "本年文档贡献度";
pkey = "workdata.other.wdgx";
twourl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> wbMap = getDailyInfo(startday,endday,employeeId);
three = (int) wbMap.get("count")+"";
threeword = "本年微博填写数";
pkey = "workdata.other.wbtx";
threeurl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
Map<String,Object> gtxzMap = getInteractInfo(startday,endday,employeeId);
four = (int) gtxzMap.get("count")+"";
fourword = "本年协作沟通数";
pkey = "workdata.other.gtxz";
foururl = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
}
oneMap.put("name",oneword);
oneMap.put("value",one);
oneMap.put("url",oneurl);
twoMap.put("name",twoword);
twoMap.put("value",two);
twoMap.put("url",twourl);
threeMap.put("name",threeword);
threeMap.put("value",three);
threeMap.put("url",threeurl);
fourMap.put("name",fourword);
fourMap.put("value",four);
fourMap.put("url",foururl);
list.add(oneMap);
list.add(twoMap);
list.add(threeMap);
list.add(fourMap);
recordMap.put("list",list);
return recordMap;
}
public Map<String, Object> getDaysInfo(String startday, String endday, String employeeId) {
log.error("DevDaysCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
Map<String, Object> dataMap = new HashMap<String, Object>();
String devcou = "0";
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
if (StringUtils.isNotBlank(employeeId)) {
String dataSql = " select count(1) as devcou \n" +
" from wfc_form_data l\n" +
" inner join fto_83 d on d.id = l.dataid\n" +
" inner join wfc_requestbase p on p.requestid = l.requestid\n" +
" where d.mutiresource= ?\n" +
" and d.xsjfrq >= ?" +
" and d.xsjfrq <= ?" +
" and d.tenant_key= ?\n" +
" and d.is_delete='0'\n" +
" and l.tenant_key=?\n" +
" and l.delete_type=0\n" +
" and p.tenant_key=?\n" +
" and p.delete_type=0\n" +
" order by d.id desc ";
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
strlist.add(tenant_key);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
log.info("DevDaysCountCmd sql:" + dataSql);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
devcou = String.valueOf(recordList.get(0).get("devcou"));
}
}
dataMap.put("count", devcou);
} catch (Exception e) {
log.error("DevDaysCountCmd-Exception:" + e);
}
return dataMap;
}
public Map<String, Object> getQuestInfo(String startday, String endday, String employeeId) {
log.error("DevQuestCountCmd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-workflow-report-serviceworkflowreport";
String sourceType = "LOGIC";
Map<String, Object> dataMap = new HashMap<String, Object>();
String devcou = "0";
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
if (StringUtils.isNotBlank(employeeId)) {
String dataSql = " select ifnull(sum(d.integer2),0) as devcou \n" +
" from wfc_form_data l\n" +
" inner join fto_62 d on d.id = l.dataid\n" +
" inner join wfc_requestbase p on p.requestid = l.requestid\n" +
" where d.multiresource5=?\n" +
" and d.date2 >=?" +
" and d.date2 <=?" +
" and d.tenant_key=?\n" +
" and d.is_delete='0'\n" +
" and l.tenant_key=?\n" +
" and l.delete_type=0\n" +
" and p.tenant_key=?\n" +
" and p.delete_type=0\n" +
" order by d.id desc ";
log.info("DevQuestCountCmd dataSql:" + dataSql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
strlist.add(tenant_key);
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(recordList.size()>0){
devcou = String.valueOf(recordList.get(0).get("devcou"));
}
}
dataMap.put("count", devcou);
} catch (Exception e) {
log.error("DevQuestCountCmd-Exception:" + e);
}
return dataMap;
}
/**
*
*
* @param
* @return
*/
public Map<String, Object> getInteractInfo(String startday, String endday, String employeeId) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-cowork-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if (StringUtils.isBlank(startday)) {
startday = year + "-01-01";
}
if (StringUtils.isBlank(endday)) {
endday = sdf.format(new Date());
}
if (StringUtils.isBlank(employeeId)) {
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql = " select count(1) as count from cw_content " +
" where CREATOR=?\n" +
" and left(CREATE_TIME,10)>=? and left(CREATE_TIME,10) <= ?";
log.error("getInteractInfo sql:" + sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (recordList.size() > 0) {
dataMap = recordList.get(0);
}
}catch (Exception e){
log.error("getInteractInfo-Exception:"+e.getMessage());
}
return dataMap;
}
/**
*
*
* @param
* @return
*/
public Map<String, Object> getWfInfo() {
Map<String, Object> data = new HashMap<>(100);
Long count = 0L ;
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
SimpleEmployee employee = UserContext.getCurrentUser();
conditionEntity.setOperatedate(DateTimeConditionEnum.CURRENT_YEAR);
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
int code = requestCountInfo.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
count = requestCountInfoPAEntity.getCount();
}
} catch (Exception e) {
log.error("getWfInfo-Exception:" + e);
}
data.put("count", count);
return data;
}
public Map<String, Object> getDailyInfo(String startday,String endday,String employeeId) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-blog-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try{
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql =" select count(1) as count\n" +
" from blog " +
" where creator=?\n" +
" and left(BLOG_TIME,10) >=?\n" +
" and left(BLOG_TIME,10) <=?\n" +
" and type='blog'\n" +
" and TENANT_KEY = ?\n" +
" and MODULE = 'blog'\n" +
" and DELETE_TYPE = 0\n" +
" and CONTENT is not null" ;
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
dataMap = recordList.get(0);
}
}catch (Exception e){
dataMap.put("count",0);
}
return dataMap;
}
/**
*
* @param
* @return
*/
public Map<String, Object> getDocInfo(String startday,String endday,String employeeId) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
Map<String,Object> dataMap = new HashMap<String,Object>();
try{
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
String sql = " select count(1) as count from document " +
" where CREATOR=?\n" +
" and left(create_time,10)>=? and left(create_time,10) <= ?" ;
log.error("PortalDocCreateCountCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(startday);
strlist.add(endday);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){
dataMap = recordList.get(0);
}
}catch (Exception e){
dataMap.put("count",0);
}
return dataMap;
}
public Map<String,Object> getYsInfo(String employeeId,String startday,String endday){
Map<String,Object> dataMap = new HashMap<String,Object>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
dataMap.put("employeeId",employeeId);
dataMap.put("startday",startday);
dataMap.put("endday",endday);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql =" select CONVERT(ifnull(sum(cast(t1.htzje as decimal(18,2))),0),CHAR) as htzje," +
" CONVERT(ifnull(sum(cast(t1.htyxje as decimal(18,2))),0),CHAR) as htyxje," +
" CONVERT(ifnull(sum(cast(t1.sumsk as decimal(18,2))),0),CHAR) as sumsk " +
" from uf_jxhs_xmys t1 \n" +
" where t1.ysrq>=? and t1.ysrq<=? " +
" and ( t1.qyjl = ? "+
" or t1.qyjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.ysry = ?\n" +
" or t1.ysry in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.dqfzr = ?\n" +
" or t1.dqfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.tdjl = ?\n" +
" or t1.tdjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.tdfzr = ?\n" +
" or t1.tdfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.jgfzr = ?\n" +
" or t1.jgfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" +
" or t1.dqzj = ?\n" +
" or t1.dqzj in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?) " +
" ) " ;
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
dataMap.put("datas",recordList.get(0));
} catch (Exception e) {
e.printStackTrace();
log.error("PorojectAcceptanceInfoCmd:"+e.getMessage());
}
return dataMap;
}
public Map<String, Object> getSkInfo(String employeeId,String startday,String endday) {
Map<String,Object> dataMap = new HashMap<String,Object>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
if(StringUtils.isBlank(startday)){
startday = year+"-01-01";
}
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
dataMap.put("employeeId",employeeId);
dataMap.put("startday",startday);
dataMap.put("endday",endday);
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
String sql =" SELECT \n" +
" CONVERT(ifnull(sum(cast(t1.skje as decimal(18,2))),0),CHAR) as skje,\n" + //收款金额
" CONVERT(ifnull(sum(cast(t1.xmskje as decimal(18,2))),0),CHAR) as xmskje,\n" + // 项目收款金额
" CONVERT(ifnull(sum(cast(t1.xsyxje as decimal(18,2))),0),CHAR) as xsyxje," + // 销售有效金额
" CONVERT(ifnull(sum(cast(t1.xsje as decimal(18,2))),0),CHAR) as xsje," + // 销售金额
" CONVERT(ifnull(sum(cast(t1.xmyxje as decimal(18,2))),0),CHAR) as xmyxje," + //项目有效金额
" CONVERT(ifnull(sum(cast(t1.xsjxhk as decimal(18,2))),0),CHAR) as xsjxhk," + //有效绩效回款
" CONVERT(ifnull(sum(cast(t1.sumsk as decimal(18,2))),0),CHAR) as sumsk," + //总收款金额
" CONVERT(ifnull(sum(cast(t1.sjjsk as decimal(18,2))),0),CHAR) as sjjsk," + //实际结算款
" CONVERT(ifnull(sum(cast(t1.skjs as decimal(18,2))),0),CHAR) as skjs " + //收款结算
" FROM uf_jxhs_skmx t1\n" +
" LEFT JOIN uf_jxhs_zxhtzb t2 ON t1.hth = t2.hth AND t2.hth != '' AND t2.hth IS NOT NULL \n" +
" LEFT JOIN ebdf_physical_data epd on t1.id = epd.form_data_id and epd.delete_type = 0 \n" +
" WHERE t1.skje != 0 \n" +
" and t1.skje IS NOT NULL " +
" and t1.xshsny >= ? and t1.xshsny <=? "+
" and (" +
" ? IN ( 2, 27, 166, 10285, 11661, 300, 876, 3593, 1416, 1647, 1844,3044480226941419013,794508876297846787 ) \n" +
" or cast(t1.xsjl AS decimal(25,0)) in( \n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.kfry AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.qdjl AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" or cast(t1.xmjl AS decimal(25,0)) in(\n" +
" SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" +
" UNION " +
" SELECT id FROM eteams.employee WHERE id = ? " +
" )\n" +
" )\n" +
" order by t1.id " ;
log.error("PorojectReceiptsInfoCmd sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
strlist.add(employeeId);
;
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!CollectionUtils.isEmpty(recordList)){
dataMap.put("datas",recordList.get(0));
}
} catch (Exception e) {
e.printStackTrace();
log.error("PorojectReceiptsInfoCmd Exception:"+e);
}
return dataMap;
}
/**
*
* @param simpleEmployee
* @return
*/
public Map<String, Object> getUserType(SimpleEmployee simpleEmployee) {
Map<String, Object> map = new HashMap<>(100);
String type = "3";
try{
SimpleEmployee employee = UserContext.getCurrentUser();
log.error("employee:"+employee.getEmployeeId());
long formdata = employee.getFormdata();
log.error("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 sourceType = "LOGIC";
String sql =" select field69 from eteams.Hrmemployeedefined where form_data_id='"+formdata+"'" ;
log.error("getSelfServiceData--sql:"+sql);
String field69 = "";
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
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)){
type = getfield69Type(field69);
}
}catch (Exception e){
e.printStackTrace();
log.error("getUserType-e:"+e);
}
map.put("type",type);
return map;
}
public String getfield69Type(String key){
String type = "3";
switch (key){
case "1":
type = "0";
break;
case "2":
type = "1";
break;
case "3":
type = "2";
break;
default:
type = "3";
}
return type;
}
public static String parseJe(String value){
if("".equals(value)){
return "0.00";
}
BigDecimal dividend = new BigDecimal(value); // 被除数
BigDecimal divisor = new BigDecimal("10000"); // 除数
// 设置小数点后两位,并进行四舍五入
BigDecimal result = dividend.divide(divisor, 2, RoundingMode.HALF_UP);
return result.toString();
}
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,686 @@
package com.weaver.seconddev.jcldoor.controller;
import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.jcldoor.service.JucailinPortalService;
import com.weaver.seconddev.jcldoor.util.CommonUtils;
import com.weaver.seconddev.jcldoor.util.JucailinPortalUtils;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
import com.weaver.workflow.common.entity.list.api.publicapi.RequestListInfoPAEntity;
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
import groovy.util.logging.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController
@RequestMapping("/api/secondev/njjucailin/portal")
public class JucailinPortalController {
private final Logger log = LoggerFactory.getLogger(JucailinPortalController.class);
@Autowired
private JucailinPortalService jucailinPortalService;
@RpcReference(group = "workflow")
WflRequestListRest wflRequestListRest;
@Autowired
private JucailinPortalUtils jucailinPortalUtils;
/**
*
* @param request
* @return
*/
@GetMapping("/getPortalUser")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalUser(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalUserData(simpleEmployee);
}catch (Exception e){
log.error("getPortalUser-Exception:"+e);
}
return WeaResult.success(recordMap);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getPortalAttendance")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalAttendance(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
Long employeeId = UserContext.getCurrentEmployeeId();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalAttendanceData(simpleEmployee);
}catch (Exception e){
log.error("testSapi-Exception:"+e);
}
return WeaResult.success(recordMap);
}
@GetMapping("/getPortalPerformance")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalPerformance(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
Long employeeId = UserContext.getCurrentEmployeeId();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalPerformanceData(simpleEmployee);
}catch (Exception e){
log.error("testSapi-Exception:"+e);
}
return WeaResult.success(recordMap);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getPortalBirthdayWishes")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalBirthdayWishes(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalBirthdayWishes(request,simpleEmployee);
}catch (Exception e){
log.error("getPortalBirthdayWishes-Exception:"+e);
}
return WeaResult.success(recordMap);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getPortalRiskInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalRiskInfo(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalRiskInfo(request,simpleEmployee);
}catch (Exception e){
log.error("getPortalRiskInfo-Exception:"+e);
}
return WeaResult.success(recordMap);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getPortalPerformanceInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalPerformanceInfo(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalPerformanceInfo(request,simpleEmployee);
}catch (Exception e){
log.error("getPortalPerformanceInfo-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getWorkFlowInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getWfInfoCreate(HttpServletRequest request){
List<RequestListInfoPAEntity> requestListInfoPAEntityList = new ArrayList<RequestListInfoPAEntity>();
try{
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
SimpleEmployee employee = UserContext.getCurrentUser();
String keyword = CommonUtils.null2String(request.getParameter("keyword"));
if(!"".equals(keyword)){
conditionEntity.setRequestname(keyword);
}
String type = CommonUtils.null2String(request.getParameter("type"),"0");
int pageSize = CommonUtils.getIntValue(request.getParameter("pageSize"),10);
int pageNo = CommonUtils.getIntValue(request.getParameter("pageNo"),1);
// 0 我发起的; 1 我的待办; 2 我的已办
if("0".equals(type)){
WeaResult<List<RequestListInfoPAEntity>> requestResult = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity);
int code = requestResult.getCode();
if(code == 200){
requestListInfoPAEntityList = requestResult.getData();
}
}else if("1".equals(type)){
WeaResult<List<RequestListInfoPAEntity>> requestResult = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity);
int code = requestResult.getCode();
if(code == 200){
requestListInfoPAEntityList = requestResult.getData();
}
}else if("2".equals(type)){
WeaResult<List<RequestListInfoPAEntity>> requestResult = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity);
int code = requestResult.getCode();
if(code == 200){
requestListInfoPAEntityList = requestResult.getData();
}
}
}catch (Exception e){
log.error("getWorkFlowInfo-Exception:"+e.getMessage());
return WeaResult.fail(500,"程序执行异常");
}
return WeaResult.success(requestListInfoPAEntityList);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getWorkFlowInfoCount")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getWorkFlowInfoCount(HttpServletRequest request){
int code = 0;
long count = 0;
Map<String,Object> dataMap = new HashMap<String,Object>();
String type = CommonUtils.null2String(request.getParameter("type"),"0");
try {
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
String keyword = CommonUtils.null2String(request.getParameter("keyword"));
if(!"".equals(keyword)){
conditionEntity.setRequestname(keyword);
}
SimpleEmployee employee = UserContext.getCurrentUser();
if("0".equals(type)){
WeaResult<RequestCountInfoPAEntity> requestResult = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), conditionEntity);
code = requestResult.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestResult.getData();
count = requestCountInfoPAEntity.getCount();
}
}else if("1".equals(type)){
WeaResult<RequestCountInfoPAEntity> requestResult = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid(), conditionEntity);
code = requestResult.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestResult.getData();
count = requestCountInfoPAEntity.getCount();
}
}else if("2".equals(type)){
WeaResult<RequestCountInfoPAEntity> requestResult = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity);
code = requestResult.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestResult.getData();
count = requestCountInfoPAEntity.getCount();
}
}else{
WeaResult<RequestCountInfoPAEntity> requestResult = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), conditionEntity);
code = requestResult.getCode();
if(code == 200){
RequestCountInfoPAEntity requestCountInfoPAEntity = requestResult.getData();
count = requestCountInfoPAEntity.getCount();
}
}
dataMap.put("code",code);
dataMap.put("count",count);
} catch (Exception e) {
e.printStackTrace();
log.error("testSapi10:"+e);
dataMap.put("count","-1");
dataMap.put("code","500");
}
return WeaResult.success(dataMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getPortalInteractCount")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalInteractCount(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalInteractCount(request,simpleEmployee);
}catch (Exception e){
log.error("getPortalInteractCount-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getPortalDocCreateCount")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalDocCreateCount(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalDocCreateCount(request,simpleEmployee);
}catch (Exception e){
log.error("getPortalDocCreateCount-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getPortalWfDealCount")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalWfDealCount(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalWfDealCount(request,simpleEmployee);
}catch (Exception e){
log.error("getPortalWfDealCount-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getPortalDailyCount")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalDailyCount(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalDailyCount(request,simpleEmployee);
}catch (Exception e){
log.error("getPortalDailyCount-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
* +++
* @param request
* @return
*/
@GetMapping("/getPortalCollaborationInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPortalCollaborationInfo(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getPortalCollaborationInfo(request,simpleEmployee);
}catch (Exception e){
log.error("getPortalCollaborationInfo-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getPorojectAcceptanceInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPorojectAcceptanceInfo(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getProjectAcceptanceInfo(request,simpleEmployee);
}catch (Exception e){
log.error("getPorojectAcceptanceInfo-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getPorojectReceiptsInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPorojectReceiptsInfo(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getProjectReceiptsInfo(request,simpleEmployee);
}catch (Exception e){
log.error("getPorojectReceiptsInfo-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
* +
* @param request
* @return
*/
@GetMapping("/getPorojectCollaborationInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getPorojectCollaborationInfo(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getProjectCollaborationInfo(request,simpleEmployee);
}catch (Exception e){
log.error("getPorojectCollaborationInfo-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getDevQuestCount")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getDevQuestCount(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getDevQuestCount(request,simpleEmployee);
}catch (Exception e){
log.error("getDevQuestCount-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getDevDaysCount")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getDevDaysCount(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getDevDaysCount(request,simpleEmployee);
}catch (Exception e){
log.error("getDevDaysCount-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/***
*
* @param request
* @return
*/
@GetMapping("/getDevCollaborationInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getDevCollaborationInfo(HttpServletRequest request){
Map<String, Object> recordMap = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
recordMap = jucailinPortalService.getDevCollaborationInfo(request,simpleEmployee);
}catch (Exception e){
log.error("getDevCollaborationInfo-Exception:"+e.getMessage());
}
return WeaResult.success(recordMap);
}
/**
*
* @param request
* @return
*/
@GetMapping("/selfServiceInfo")
@WeaPermission(publicPermission = true)
public WeaResult<Object> selfServiceInfo(HttpServletRequest request){
log.error("selfServiceInfo");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
dataList = jucailinPortalService.getSelfServiceInfo(request,simpleEmployee);
}catch (Exception e){
log.error("selfServiceInfo-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
/**
* ()
* @param request
* @return
*/
@GetMapping("/addSelfServiceCount")
@WeaPermission(publicPermission = true)
public WeaResult<Object> addSelfServiceCount(HttpServletRequest request){
log.error("addSelfServiceCount");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
dataList = jucailinPortalService.addSelfServiceCount(request,simpleEmployee);
}catch (Exception e){
log.error("addSelfServiceCount-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getWorkData")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getWorkData(HttpServletRequest request){
log.error("getWorkData");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
dataList = jucailinPortalService.getWorkData(request,simpleEmployee);
}catch (Exception e){
log.error("getWorkData-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getWorkDataByType")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getWorkDataByType(HttpServletRequest request){
log.error("getWorkDataByType");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
dataList = jucailinPortalService.getWorkDataByType(request,simpleEmployee);
}catch (Exception e){
log.error("getWorkDataByType-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
/**
*
* @param request
* @return
*/
@GetMapping("/getUserType")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getUserType(HttpServletRequest request){
log.error("getUserType");
Map<String, Object> dataList = new HashMap<String, Object>();
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
try{
dataList = jucailinPortalService.getUserType(request,simpleEmployee);
}catch (Exception e){
log.error("getUserType-Exception:"+e.getMessage());
}
return WeaResult.success(dataList);
}
/**
* ()
* @param request
* @return
*/
@GetMapping("/initSelfServiceData")
@WeaPermission(publicPermission = true)
public WeaResult<Object> initSelfServiceData(HttpServletRequest request){
log.error("initSelfServiceData");
Map<String, Object> dataMap = new HashMap<String, Object>();
try{
SimpleEmployee employee = UserContext.getCurrentUser();
String employeeId = request.getParameter("employeeId");
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(employee.getEmployeeId());
}
log.error("employeeId:"+employeeId);
Map<String, Object> paramMap = jucailinPortalUtils.request2Map(request);
paramMap.put("employeeId",employeeId);
dataMap = jucailinPortalService.initSelfServiceData(paramMap);
}catch (Exception e){
log.error("addSelfServiceCount-Exception:"+e.getMessage());
}
return WeaResult.success(dataMap);
}
/**
* ()
* @param request
* @return
*/
@GetMapping("/updateSelfServiceData")
@WeaPermission(publicPermission = true)
public WeaResult<Object> updateSelfServiceData(HttpServletRequest request){
log.error("updateSelfServiceData");
Map<String, Object> dataMap = new HashMap<String, Object>();
try{
String employeeId = request.getParameter("employeeId");
if(StringUtils.isBlank(employeeId)){
employeeId = String.valueOf(UserContext.getCurrentEmployeeId());
}
log.error("employeeId:"+employeeId);
dataMap = jucailinPortalService.updateSelfServiceData(employeeId);
}catch (Exception e){
log.error("addSelfServiceCount-Exception:"+e.getMessage());
}
return WeaResult.success(dataMap);
}
}

@ -0,0 +1,152 @@
package com.weaver.seconddev.jcldoor.domain;
public class JucailinUserInfo {
protected Long userid;
protected Long lastname;
protected Long userinfourl;
protected Long userimageurl;
protected Long jobtitlename;
protected Long doccreate;
protected Long doccreateurl;
protected Long wfcreate;
protected Long wfcreateurl;
protected Long wfdeal;
protected Long wfdealurl;
protected Long rzts;
protected Long rznf;
protected Long rzsyts;
protected Long cyqlsl;
protected Long mtgtrs;
public Long getUserid() {
return userid;
}
public void setUserid(Long userid) {
this.userid = userid;
}
public Long getLastname() {
return lastname;
}
public void setLastname(Long lastname) {
this.lastname = lastname;
}
public Long getUserinfourl() {
return userinfourl;
}
public void setUserinfourl(Long userinfourl) {
this.userinfourl = userinfourl;
}
public Long getUserimageurl() {
return userimageurl;
}
public void setUserimageurl(Long userimageurl) {
this.userimageurl = userimageurl;
}
public Long getJobtitlename() {
return jobtitlename;
}
public void setJobtitlename(Long jobtitlename) {
this.jobtitlename = jobtitlename;
}
public Long getDoccreate() {
return doccreate;
}
public void setDoccreate(Long doccreate) {
this.doccreate = doccreate;
}
public Long getDoccreateurl() {
return doccreateurl;
}
public void setDoccreateurl(Long doccreateurl) {
this.doccreateurl = doccreateurl;
}
public Long getWfcreate() {
return wfcreate;
}
public void setWfcreate(Long wfcreate) {
this.wfcreate = wfcreate;
}
public Long getWfcreateurl() {
return wfcreateurl;
}
public void setWfcreateurl(Long wfcreateurl) {
this.wfcreateurl = wfcreateurl;
}
public Long getWfdeal() {
return wfdeal;
}
public void setWfdeal(Long wfdeal) {
this.wfdeal = wfdeal;
}
public Long getWfdealurl() {
return wfdealurl;
}
public void setWfdealurl(Long wfdealurl) {
this.wfdealurl = wfdealurl;
}
public Long getRzts() {
return rzts;
}
public void setRzts(Long rzts) {
this.rzts = rzts;
}
public Long getRznf() {
return rznf;
}
public void setRznf(Long rznf) {
this.rznf = rznf;
}
public Long getRzsyts() {
return rzsyts;
}
public void setRzsyts(Long rzsyts) {
this.rzsyts = rzsyts;
}
public Long getCyqlsl() {
return cyqlsl;
}
public void setCyqlsl(Long cyqlsl) {
this.cyqlsl = cyqlsl;
}
public Long getMtgtrs() {
return mtgtrs;
}
public void setMtgtrs(Long mtgtrs) {
this.mtgtrs = mtgtrs;
}
}

@ -0,0 +1,26 @@
package com.weaver.seconddev.jcldoor.esb;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service("esb_njjucailin_im_Action")
public class EsbRpcRemoteUpdateImDataAction implements EsbServerlessRpcRemoteInterface {
private static final Logger log = LoggerFactory.getLogger(EsbRpcRemoteUpdateImDataAction.class);
@Override
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
log.error("EsbRpcRemoteUpdateImDataimpl");
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("code","200");
returnMap.put("name","111");
returnMap.put("data","2222");
return WeaResult.success(returnMap);
}
}

@ -0,0 +1,58 @@
package com.weaver.seconddev.jcldoor.service;
import com.weaver.teams.domain.user.SimpleEmployee;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
public interface JucailinPortalService {
public Map<String, Object> getPortalUserData(SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalAttendanceData(SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalPerformanceData(SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalBirthdayWishes(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalRiskInfo(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalPerformanceInfo(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalInteractCount(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalDocCreateCount(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalWfDealCount(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalDailyCount(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getPortalCollaborationInfo(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getProjectAcceptanceInfo(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getProjectReceiptsInfo(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getProjectCollaborationInfo(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getDevQuestCount(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getDevDaysCount(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getDevCollaborationInfo(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getSelfServiceInfo(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> addSelfServiceCount(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getWorkData(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getWorkDataByType(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> getUserType(HttpServletRequest request,SimpleEmployee simpleEmployee);
public Map<String, Object> initSelfServiceData(Map<String, Object> paramMap);
public Map<String, Object> updateSelfServiceData(String employeeId);
}

@ -0,0 +1,344 @@
package com.weaver.seconddev.jcldoor.service.impl;
import com.weaver.seconddev.jcldoor.cmd.*;
import com.weaver.seconddev.jcldoor.service.JucailinPortalService;
import com.weaver.teams.domain.user.SimpleEmployee;
import groovy.util.logging.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
@Service
public class JucailinPortalServiceImpl implements JucailinPortalService {
private final Logger log = LoggerFactory.getLogger(JucailinPortalServiceImpl.class);
@Autowired
private UserInfoCmd userInfoCmd;
@Autowired
private PortalBirthdayWishesCmd portalBirthdayWishesCmd;
@Autowired
private PortalPerformanceInfoCmd portalPerformanceInfoCmd;
@Autowired
private PortalRiskInfoCmd portalRiskInfoCmd;
@Autowired
private PortalInteractCountCmd portalInteractCountCmd;
@Autowired
private PortalDocCreateCountCmd portalDocCreateCountCmd;
@Autowired
private PortalWfDealCountCmd portalWfDealCountCmd;
@Autowired
private PortalDailyCountCmd portalDailyCountCmd;
@Autowired
private PortalCollaborationInfoCmd portalCollaborationInfoCmd;
@Autowired
private ProjectAcceptanceInfoCmd projectAcceptanceInfoCmd;
@Autowired
private ProjectReceiptsInfoCmd projectReceiptsInfoCmd;
@Autowired
private ProjectCollaborationInfoCmd projectCollaborationInfoCmd;
@Autowired
private DevDaysCountCmd devDaysCountCmd;
@Autowired
private DevQuestCountCmd devQuestCountCmd;
@Autowired
private DevCollaborationInfoCmd devCollaborationInfoCmd;
@Autowired
private SelfServiceInfoCmd selfServiceInfoCmd;
@Autowired
private WorkDataCmd workDataCmd;
@Override
public Map<String, Object> getPortalUserData(SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = userInfoCmd.getUserInfo(simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getPortalAttendanceData(SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = new HashMap<String,Object>();
String zjkqnj = "0.00";
String lnkqnj = "0.00";
String jnkqnj = "0.00";
String ycqts = "0.00";
String wcts = "0.00" ;
double xjts = 0.00;
int cdsc = 0;
int qkcs = 0;
String ydkcs = "0.00";
dataMap.put("zjkqnj",zjkqnj); //总计可请年假
dataMap.put("lnkqnj",lnkqnj); //历年可请年假
dataMap.put("jnkqnj",jnkqnj); //今年可请年假
dataMap.put("wcts",wcts); //外出天数
dataMap.put("xjts",xjts); //休假天数
dataMap.put("cdsc",cdsc); //迟到次数
dataMap.put("qkcs",qkcs); // 缺卡次数
dataMap.put("ydkcs",ydkcs); //已打卡次数
dataMap.put("ycqts",ycqts); //应出勤天数
dataMap.put("employeeid",simpleEmployee.getEmployeeId()); //应出勤天数
return dataMap;
}
@Override
public Map<String, Object> getPortalPerformanceData(SimpleEmployee simpleEmployee) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String type = "";
String year = "2024";
String month = "02";
String startdate = "";
String enddate = "";
int currentYear = 0 ;
int currentMonth = 0;
int lastYear = 0;
int lastMonth = 0 ;
int last2Year = 0;
int last2Month = 0 ;
if("1".equals(type)){
try {
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(year+"-"+month+"-01"));
currentYear = cal.get(Calendar.YEAR);//获取年
currentMonth = cal.get(Calendar.MONTH)+1;//获取月月份从0开始如果按照中国的习惯需要加一
} catch (ParseException e) {
e.printStackTrace();
}
try {
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(year+"-"+month+"-01"));
cal.add(Calendar.MONTH, -1);
lastYear = cal.get(Calendar.YEAR);//获取年
lastMonth = cal.get(Calendar.MONTH)+1;//获取月月份从0开始如果按照中国的习惯需要加一
} catch (ParseException e) {
e.printStackTrace();
}
try {
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(year+"-"+month+"-01"));
cal.add(Calendar.MONTH, -2);
last2Year = cal.get(Calendar.YEAR);//获取年
last2Month = cal.get(Calendar.MONTH)+1;//获取月月份从0开始如果按照中国的习惯需要加一
} catch (ParseException e) {
e.printStackTrace();
}
if(currentMonth == 1){
startdate = (currentYear-1)+"-01-01";
enddate = (currentYear-1)+"-12-31";
}else{
startdate = currentYear+"-01-01";
enddate = currentYear+"-12-31";
}
}else{
Calendar cal1 = Calendar.getInstance();
currentYear = cal1.get(Calendar.YEAR);//获取年
currentMonth = cal1.get(Calendar.MONTH)+1;//获取月月份从0开始如果按照中国的习惯需要加一
Calendar cal2 = Calendar.getInstance();
cal2.setTime(new Date());
cal2.add(Calendar.MONTH, -1);
lastYear = cal2.get(Calendar.YEAR);//获取年
lastMonth = cal2.get(Calendar.MONTH)+1;//获取月月份从0开始如果按照中国的习惯需要加一
Calendar cal3 = Calendar.getInstance();
cal3.setTime(new Date());
cal3.add(Calendar.MONTH, -2);
last2Year = cal3.get(Calendar.YEAR);//获取年
last2Month = cal3.get(Calendar.MONTH)+1;//获取月月份从0开始如果按照中国的习惯需要加一
if(currentMonth == 1){
startdate = (currentYear-1)+"-01-01";
enddate = (currentYear-1)+"-12-31";
}else{
startdate = currentYear+"-01-01";
enddate = currentYear+"-12-31";
}
}
Long userid = simpleEmployee.getEmployeeId();
List<String> monthList = new ArrayList<String>();
List<Map<String,String>> data = new ArrayList<Map<String,String>>();
List<Map<String,String>> item = new ArrayList<Map<String,String>>();
Map<String,String> lastscop = new HashMap<String,String>();
Map<String,Object> dataMap = new HashMap<String,Object>();
dataMap.put("scoreData",data);
dataMap.put("scoreYear",currentYear);
dataMap.put("itemData",item);
dataMap.put("lastScoreData",lastscop);
dataMap.put("startdate",startdate);
dataMap.put("enddate",enddate);
dataMap.put("userid",userid);
return dataMap;
}
@Override
public Map<String, Object> getPortalBirthdayWishes(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = portalBirthdayWishesCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getPortalRiskInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = portalRiskInfoCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getPortalPerformanceInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = portalPerformanceInfoCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getPortalInteractCount(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = portalInteractCountCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getPortalDocCreateCount(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = portalDocCreateCountCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getPortalWfDealCount(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = portalWfDealCountCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getPortalDailyCount(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = portalDailyCountCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getPortalCollaborationInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = portalCollaborationInfoCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getProjectAcceptanceInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = projectAcceptanceInfoCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getProjectReceiptsInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = projectReceiptsInfoCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getProjectCollaborationInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = projectCollaborationInfoCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getDevQuestCount(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = devQuestCountCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getDevDaysCount(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = devDaysCountCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getDevCollaborationInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = devCollaborationInfoCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getSelfServiceInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = selfServiceInfoCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> addSelfServiceCount(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = selfServiceInfoCmd.addSelfServiceCount(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getWorkData(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = workDataCmd.getInfo(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getWorkDataByType(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = workDataCmd.getInfoByType(request,simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> getUserType(HttpServletRequest request, SimpleEmployee simpleEmployee) {
Map<String,Object> dataMap = userInfoCmd.getUserType(simpleEmployee);
return dataMap;
}
@Override
public Map<String, Object> initSelfServiceData(Map<String, Object> paramMap) {
Map<String,Object> dataMap = selfServiceInfoCmd.initSelfServiceData(paramMap);
return dataMap;
}
@Override
public Map<String, Object> updateSelfServiceData(String employeeId) {
Map<String,Object> dataMap = selfServiceInfoCmd.updateSelfServiceData(employeeId);
return dataMap;
}
}

@ -0,0 +1,286 @@
package com.weaver.seconddev.jcldoor.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
//import com.weaver.common.distribution.genid.IdGenerator;
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
import com.weaver.em.msg.api.entity.Request;
import com.weaver.em.msg.api.entity.Response;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*;
@Component
public class ChatDayUtils {
private final Logger log = LoggerFactory.getLogger(ChatDayUtils.class);
@RpcReference
private com.weaver.em.msg.api.rest.OaRest oaRest;
@Autowired
private DatabaseUtils databaseUtils;
@Autowired
private JucailinPortalUtils jucailinPortalUtils;
public Map<String,Object> getChatDay(String tenant_key, String tablename,String pageSize,String pageNum,String startDate){
Map<String,Object> dataMap = new HashMap<String,Object>();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
try {
// String field_ry = "985461236726857729" ;
// String field_amount = "985461236726857730";
// String objId = "985461167965437954";
String pkey = "uf_nj_pjmrdlhhsl.ry";
String field_ry = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_nj_pjmrdlhhsl.amount";
String field_amount = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_nj_pjmrdlhhsl.objId";
String objId = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
SimpleEmployee employee = UserContext.getCurrentUser();
if(StringUtils.isBlank(startDate)){
startDate = "2001-01-01";
}
Calendar cal = Calendar.getInstance();
//设置当前时间
cal.setTime(new Date());
//同理增加一天的方法:
cal.add(Calendar.DATE, -1);
String endDate = format.format(cal.getTime());
log.error("startDate:"+startDate);
log.error("endDate:"+endDate);
Long cid = employee.getCid();
log.error("ChatDayUtils--cid:"+cid);
Long employeeId = employee.getEmployeeId();
Map<String, Object> json = new HashMap<String, Object>();
json.put("cid",cid);
json.put("pageNum",pageNum);
json.put("pageSize",pageSize);
json.put("startDate",startDate);
json.put("endDate",endDate);
log.error("json:"+ JSON.toJSONString(json));
dataMap.put("json",JSON.toJSONString(json));
Request request = new Request();
request.setUrl("/user-profile/dailySingleSession");
request.setParamsMap(json);
request.setAsync(false);
log.error("request:"+ request.toString());
Response response = oaRest.executeIm(request);
log.error("getChatDay--isSuccess"+response.isSuccess());
if (response.isSuccess()){
dataMap.put("isSuccess","1");
String data = response.getData();
dataMap.put("data",data);
if(StringUtils.isNotBlank(data)){
JSONObject dataJson = JSONObject.parseObject(data);
JSONObject actionMsg = dataJson.getJSONObject("actionMsg");
if(actionMsg.containsKey("code")){
String code = actionMsg.getString("code");
if("0".equals(code)){
JSONObject dataObject = dataJson.getJSONObject("data");
if(dataObject.containsKey("data")){
JSONArray dataArray = dataObject.getJSONArray("data");
log.error("getChatDay--dataArray"+dataArray.size());
List<EBDataReqDto> insertEbDataReqDtoList = Lists.newArrayList();
List<EBDataReqDto> updateEbDataReqDtoList = Lists.newArrayList();
for(int i=0;i<dataArray.size();i++){
JSONObject dataInfo = dataArray.getJSONObject(i);
String userid = dataInfo.getString("userid");
String amount = dataInfo.getString("amount");
log.error("getChatDay--userid"+userid+" amount:"+amount);
String sql = " select id from "+tablename+" where ry='"+userid+"' and tenant_key='"+tenant_key+"' and delete_type=0 ";
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty()){
log.error("getChatDay--!isEmpty");
String id = String.valueOf(recordList.get(0).get("id"));
log.error("id:"+id);
EBDataReqDto ebDataReqDto = new EBDataReqDto();
List<EBDataReqDetailDto> mainData = Lists.newArrayList();
// 设置更新id
mainData.add(new EBDataReqDetailDto("id", id));
mainData.add(new EBDataReqDetailDto(field_amount, amount));
ebDataReqDto.setMainDatas(mainData);
updateEbDataReqDtoList.add(ebDataReqDto);
}else{
log.error("getChatDay--isEmpty");
EBDataReqDto ebDataReqDto = new EBDataReqDto();
List<EBDataReqDetailDto> mainData = Lists.newArrayList();
mainData.add(new EBDataReqDetailDto(field_ry, userid));
mainData.add(new EBDataReqDetailDto(field_amount, amount));
ebDataReqDto.setMainDatas(mainData);
insertEbDataReqDtoList.add(ebDataReqDto);
}
}
log.error("getChatDay-insertEbDataReqDtoList:"+insertEbDataReqDtoList.size());
if(insertEbDataReqDtoList !=null && insertEbDataReqDtoList.size()>0){
jucailinPortalUtils.saveModeData(objId,employeeId+"",tenant_key,insertEbDataReqDtoList);
}
log.error("getChatDay-updateEbDataReqDtoList:"+updateEbDataReqDtoList.size());
if(updateEbDataReqDtoList !=null && updateEbDataReqDtoList.size()>0){
jucailinPortalUtils.updateModeDataById(objId,employeeId+"",tenant_key,updateEbDataReqDtoList,false);
}
}
}
}
}
}else{
dataMap.put("isSuccess","0");
}
} catch (Exception e) {
e.printStackTrace();
log.error("testSapi13:"+e);
}
return dataMap;
}
/***
*
* @param userid
* @param amount
* @param employeeId
* @param sourceType
* @param groupId
* @param tenant_key
*/
// public void insertChatDayDate(String userid,String amount,long employeeId,String sourceType,String groupId,String tenant_key,String tablename){
// String code = "";
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// try {
// long generate = IdGenerator.generate();
// log.error("insertChatDayDate-generate:"+generate+" userid:"+userid+" amount"+amount+" employeeId:"+employeeId);
//
// SimpleEmployee user = jucailinPortalUtils.getSimpleEmployee(Long.parseLong(userid));
// String username = user.getUsername();
// String name = user.getName();
// log.error("username:"+username);
// log.error("name:"+name);
//
// String modename = "平均每日单聊会话数量-"+username+" "+sdf.format(new Date());
//
// String sql =" insert into "+tablename+"(id,ry,amount,form_data_id,data_index,create_time,update_time,tenant_key,is_delete,creator,delete_type,updater,name,is_flow,data_status) " +
// " values (" + generate + "," + userid + ",'"+amount+"'," + generate + ",0,now(),now(),'"+tenant_key+"',0," + employeeId + ",0,"+employeeId+",'"+modename+"',0,1)";
//
// log.error("insertChatDayDate-sql:"+sql);
// Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
//
// Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Object> next = iterator.next();
// log.error("insertCustomServiceData--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
//
// if(result.containsKey("code")){
// code = String.valueOf(result.get("code"));
// }
//
// }catch (Exception e){
// e.printStackTrace();
// log.error("insertChatDayDate:"+e);
// code = "-100";
// }
// log.error("insertChatDayDate-code:"+code);
// }
//
// /***
// *
// * @param userid
// * @param amount
// * @param sourceType
// * @param groupId
// * @param tenant_key
// */
// public String updateChatDayDate(String userid,String amount,String sourceType,String groupId,String tenant_key,String tablename,long employeeId){
// String code = "" ;
//
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// try {
//// String sql =" update "+tablename+" set amount=?,update_time=now() where ry = ? and tenant_key= ? and delete_type=0 ";
//// log.error("insertChatDayDate-sql:"+sql + " amount:"+amount+" userid:"+userid);
//// List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
//// SqlParamEntity sqlParamEntity = new SqlParamEntity();
//// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
//// sqlParamEntity.setValue(amount+"");
//// sqlparam.add(sqlParamEntity);
////
//// sqlParamEntity = new SqlParamEntity();
//// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
//// sqlParamEntity.setValue(userid+"");
//// sqlparam.add(sqlParamEntity);
////
//// sqlParamEntity = new SqlParamEntity();
//// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
//// sqlParamEntity.setValue(tenant_key);
//// sqlparam.add(sqlParamEntity);
//// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
//
// SimpleEmployee user = jucailinPortalUtils.getSimpleEmployee(Long.parseLong(userid));
// String username = user.getUsername();
// String name = user.getName();
// log.error("username:"+username);
// log.error("name:"+name);
//
// String modename = "平均每日单聊会话数量-"+username+" "+sdf.format(new Date());
//
// String sql =" update "+tablename+" set amount='"+amount+"',updater="+employeeId+",update_time=now(),is_flow=0,data_status=1,modename='"+modename+"' where ry = "+userid+" and tenant_key= '"+tenant_key+"' and delete_type=0 ";
// log.error("insertChatDayDate-sql:"+sql );
//
//
// Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
// Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Object> next = iterator.next();
// log.error("updateChatDayDate--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
//
// if(result.containsKey("code")){
// code = String.valueOf(result.get("code"));
// }
// }catch (Exception e){
// e.printStackTrace();
// log.error("insertChatDayDate:"+e);
// code = "-100";
// }
// return code;
// }
}

@ -0,0 +1,281 @@
package com.weaver.seconddev.jcldoor.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.common.distribution.genid.IdGenerator;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
import com.weaver.em.msg.api.entity.Request;
import com.weaver.em.msg.api.entity.Response;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.seconddev.cm.rpcutil.HrmCommonRpcUtil;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.teams.security.context.UserContext;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.weaver.em.msg.api.rest.OaRest;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*;
@Component
public class ChatGroupUtils {
private final Logger log = LoggerFactory.getLogger(ChatGroupUtils.class);
@RpcReference
private OaRest oaRest;
@Autowired
private DatabaseUtils databaseUtils;
@Autowired
private JucailinPortalUtils jucailinPortalUtils;
/***
*
*
*/
public Map<String,Object> getChatGroup(String tenant_key, String tablename,String pageSize,String pageNum){
Map<String,Object> dataMap = new HashMap<String,Object>();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
try {
// String field_ry = "985460777098248194" ;
// String field_amount = "985460777098248195";
// String objId = "985460643895541762";
String pkey = "uf_nj_cyqltjb.ry";
String field_ry = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_nj_cyqltjb.amount";
String field_amount = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
pkey = "uf_nj_cyqltjb.objId";
String objId = jucailinPortalUtils.getUfPropData(pkey,tenant_key);
String startDate = "2001-01-01";
//设置当前时间
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
//同理增加一天的方法:
cal.add(Calendar.DATE, -1);
String endDate = format.format(cal.getTime());
log.error("startDate:"+startDate);
log.error("endDate:"+endDate);
SimpleEmployee employee = UserContext.getCurrentUser();
Long cid = employee.getCid();
long employeeId = employee.getEmployeeId();
log.error("getChatGroup--cid:"+cid);
Map<String, Object> json = new HashMap<String, Object>();
json.put("cid",cid);
json.put("pageNum",pageNum);
json.put("pageSize",pageSize);
json.put("startDate",startDate);
json.put("endDate",endDate);
dataMap.put("json",JSON.toJSONString(json));
log.error("json:"+ JSON.toJSONString(json));
Request request = new Request();
request.setUrl("/user-profile/groupSession");
request.setParamsMap(json);
request.setAsync(false);
Response response = oaRest.executeIm(request);
log.error("getChatGroup--isSuccess"+response.isSuccess());
if(response.isSuccess()){
dataMap.put("isSuccess","1");
String data = response.getData();
dataMap.put("data",data);
if(StringUtils.isNotBlank(data)){
JSONObject dataJson = JSONObject.parseObject(data);
JSONObject actionMsg = dataJson.getJSONObject("actionMsg");
if(actionMsg.containsKey("code")){
String code = actionMsg.getString("code");
log.error("getChatGroup--code"+code);
if("0".equals(code)){
JSONObject dataObject = dataJson.getJSONObject("data");
if(dataObject.containsKey("data")){
JSONArray dataArray = dataObject.getJSONArray("data");
log.error("getChatGroup--dataArray"+dataArray.size());
List<EBDataReqDto> insertEbDataReqDtoList = Lists.newArrayList();
List<EBDataReqDto> updateEbDataReqDtoList = Lists.newArrayList();
for(int i=0;i<dataArray.size();i++){
JSONObject dataInfo = dataArray.getJSONObject(i);
String userid = dataInfo.getString("userid");
String amount = dataInfo.getString("amount");
log.error("getChatGroup--userid"+userid+" amount:"+amount);
String sql = " select id from "+tablename+" where ry='"+userid+"' and tenant_key='"+tenant_key+"' and delete_type=0 ";
log.error("getChatGroup--sql"+sql);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty()){
log.error("getChatGroup--!isEmpty");
String id = String.valueOf(recordList.get(0).get("id"));
log.error("id:"+id);
EBDataReqDto ebDataReqDto = new EBDataReqDto();
List<EBDataReqDetailDto> mainData = Lists.newArrayList();
// 设置更新id
mainData.add(new EBDataReqDetailDto("id", id));
mainData.add(new EBDataReqDetailDto(field_amount, amount));
ebDataReqDto.setMainDatas(mainData);
updateEbDataReqDtoList.add(ebDataReqDto);
}else{
log.error("getChatGroup--isEmpty");
EBDataReqDto ebDataReqDto = new EBDataReqDto();
List<EBDataReqDetailDto> mainData = Lists.newArrayList();
mainData.add(new EBDataReqDetailDto(field_ry, userid));
mainData.add(new EBDataReqDetailDto(field_amount, amount));
ebDataReqDto.setMainDatas(mainData);
insertEbDataReqDtoList.add(ebDataReqDto);
}
}
log.error("getChatDay-insertEbDataReqDtoList:"+insertEbDataReqDtoList.size());
if(insertEbDataReqDtoList !=null && insertEbDataReqDtoList.size()>0){
jucailinPortalUtils.saveModeData(objId,employeeId+"",tenant_key,insertEbDataReqDtoList);
}
log.error("getChatDay-updateEbDataReqDtoList:"+updateEbDataReqDtoList.size());
if(updateEbDataReqDtoList !=null && updateEbDataReqDtoList.size()>0){
jucailinPortalUtils.updateModeDataById(objId,employeeId+"",tenant_key,updateEbDataReqDtoList,false);
}
}
}
}
}
}else{
dataMap.put("isSuccess","0");
}
} catch (Exception e) {
e.printStackTrace();
log.error("getChatGroup:"+e);
}
return dataMap;
}
/***
*
* @param userid
* @param amount
* @param employeeId
* @param sourceType
* @param groupId
* @param tenant_key
*/
// public String insertChatGroupDate(String userid,String amount,long employeeId,String sourceType,String groupId,String tenant_key,String tablename){
//
// String code = "";
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// try {
//
// SimpleEmployee user = jucailinPortalUtils.getSimpleEmployee(Long.parseLong(userid));
// String username = user.getUsername();
// String name = user.getName();
// log.error("username:"+username);
// log.error("name:"+name);
// String modename = "参与群聊统计表-"+username+" "+sdf.format(new Date());
//
// long generate = IdGenerator.generate();
// log.error("insertChatGroupDate-generate:"+generate+" userid:"+userid+" amount"+amount+" employeeId:"+employeeId);
//
// String sql =" insert into "+tablename+"(id,ry,amount,form_data_id,data_index,create_time,update_time,tenant_key,is_delete,creator,delete_type,updater,name,is_flow,data_status) " +
// " values(" + generate + "," + userid + ",'"+amount+"'," + generate + ",0,now(),now(),'"+tenant_key+"',0," + employeeId + ",0,"+employeeId+",'"+modename+"',0,1)";
//
// log.error("insertChatGroupDate-sql:"+sql);
// Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
//
// Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Object> next = iterator.next();
// log.error("insertChatGroupDate--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
//
// if(result.containsKey("code")){
// code = String.valueOf(result.get("code"));
// }
//
// }catch (Exception e){
// e.printStackTrace();
// log.error("insertChatGroupDate:"+e);
// }
// log.error("insertChatGroupDate-code:"+code);
// return code ;
// }
//
// /***
// *
// * @param userid
// * @param amount
// * @param sourceType
// * @param groupId
// * @param tenant_key
// */
// public String updateChatGroupDate(String userid,String amount,String sourceType,String groupId,String tenant_key,String tablename,long employeeId){
//
// String code = "";
//
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// try {
//
// SimpleEmployee user = jucailinPortalUtils.getSimpleEmployee(Long.parseLong(userid));
// String username = user.getUsername();
// String name = user.getName();
// log.error("username:"+username);
// log.error("name:"+name);
// String modename = "参与群聊统计表-"+username+" "+sdf.format(new Date());
//
// String sql =" update "+tablename+" set amount='"+amount+"',updater="+employeeId+",update_time=now(),is_flow=0,data_status=1,modename='"+modename+"' where ry = "+userid+" and tenant_key= '"+tenant_key+"' and delete_type=0 ";
// log.error("updateChatGroupDate-sql:"+sql);
//
// Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
// Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Object> next = iterator.next();
// log.error("updateChatGroupDate--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
//
// if(result.containsKey("code")){
// code = String.valueOf(result.get("code"));
// }
//
// }catch (Exception e){
// e.printStackTrace();
// log.error("updateChatGroupDate:"+e);
// code = "-200";
// }
//
// return code ;
// }
}

@ -0,0 +1,395 @@
package com.weaver.seconddev.jcldoor.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Component
public class CommonUtils {
private final static Logger log = LoggerFactory.getLogger(CommonUtils.class);
public static JSONObject toJSON(String data){
if(!StringUtils.isEmpty(data)){
try {
return JSONObject.parseObject(data);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static Long getJSONLong(JSONObject json,String key){
if(json != null && json.containsKey(key)){
try {
return json.getLong(key);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static Integer getJSONInteger(JSONObject json,String key){
if(json != null && json.containsKey(key)){
try {
return json.getInteger(key);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return -1;
}
public static String getJSONString(JSONObject json,String key){
if(json != null && json.containsKey(key)){
try {
return null2String(json.getString(key));
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return "";
}
public static JSONObject getJSONObject(JSONObject json,String key){
if(json != null && json.containsKey(key)){
try {
return json.getJSONObject(key);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static JSONArray getJSONArray(JSONObject json, String key){
if(json != null && json.containsKey(key)){
try {
return json.getJSONArray(key);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static JSONObject getJSONObject(JSONArray json, int idx){
if(json != null && json.size() > idx){
try {
return json.getJSONObject(idx);
}catch (Throwable t){
log.error(t.getMessage(),t);
}
}
return null;
}
public static String mapToStrData(Map<String, Object> para){
if(para != null) {
return JSONObject.toJSON(para).toString();
}
return "";
}
public static void strToLongList(List<Long> list,String strs){
strToLongList(list,strs,true);
}
public static void strToLongList(List<Long> list,String strs,boolean isDist){
if(list == null){
return;
}
if(StringUtils.isEmpty(strs)){
return;
}
String[] strList = StringUtils.split(strs, ",");
for(String str:strList){
if(StringUtils.isEmpty(str)){
continue;
}
long id = getLongValue(str);
if(id > 0l && (isDist == false || !list.contains(id))){
list.add(id);
}
}
}
public static long getLongValue(Object v){
return getLongValue(null2String(v));
}
public static long getLongValue(String v) {
return getLongValue(v, -1);
}
public static long getLongValue(String v, long def) {
try {
return Long.parseLong(v);
} catch (Exception ex) {
return def;
}
}
public static int getIntValue(Object o){
return getIntValue(null2String(o));
}
public static int getIntValue(String s){
return getIntValue(s,-1);
}
public static int getIntValue(String s, int def){
try {
return NumberUtils.toInt(s);
} catch (Exception ex) {
return def;
}
}
public static String null2String(Object s) {
return s == null ? "" : s.toString();
}
public static String null2String(Object s, String def) {
return s == null ? (def == null ? "" : def) : s.toString();
}
public static String stringReplace(String sou, String s1, String s2) {
//int idx = sou.indexOf(s1);
//if (idx < 0) {
// return sou;
//}
//return sou.substring(0, idx) + s2 + StringReplace(sou.substring(idx + s1.length()), s1, s2);
sou = null2String(sou);
s1 = null2String(s1);
s2 = null2String(s2);
try{
sou = sou.replace(s1, s2);
}catch(Exception e){
//System.out.println(e);//将未知异常打印出来,便于检查错误。
}
return sou;
}
/**
*
*
* @param s
* @return
*/
public static String toScreen(String s) {
char c[] = s.toCharArray();
char ch;
int i = 0;
StringBuffer buf = new StringBuffer();
while (i < c.length) {
ch = c[i++];
if (ch == '\r')
buf.append("");
else if (ch == '\n')
buf.append("");
else
buf.append(ch);
}
return buf.toString();
}
/**
*
*
* @param s
* @return
*/
public static String toExcel(String s) {
if (s == null) return "";
//因本方法会将字符串 &符号转换故先将欧元符号转义符转换为其Unicode码
s = s.replaceAll("&euro;", "\u20AC");
String str = toScreen(s);
str = stringReplace(str, "&ang;", "∠");
str = stringReplace(str, "&phi;", "φ");
str = stringReplace(str, "&quot;", "\"");
str = stringReplace(str, "&nbsp", "%nbsp");
//str=Util.StringReplace(str,"'","");
str = stringReplace(str, "&lt;", "<");
str = stringReplace(str, "&gt;", ">");
str = stringReplace(str, "&dt;&at;", "<br>");
str = stringReplace(str, "&", "&amp;");
str = stringReplace(str, "<br>", "&dt;&at;");
if ("&dt;&at;".equals(str)) {
str = "";
}
//在方法最后,又将欧元符号置换为转义符
str = str.replaceAll("\u20AC", "&euro;");
return str;
}
public static String delHtml(final String inputString) {
String htmlStr = toExcel(inputString); // 含html标签的字符串
String textStr = "";
java.util.regex.Pattern p_script;
java.util.regex.Matcher m_script;
java.util.regex.Pattern p_html;
java.util.regex.Matcher m_html;
try {
String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
String regEx_script = "<[/s]*?script[^>]*?>[/s/S]*?<[/s]*?//[/s]*?script[/s]*?>"; // 定义script的正则表达式{或<script[^>]*?>[/s/S]*?<//script>
p_script = java.util.regex.Pattern.compile(regEx_script, java.util.regex.Pattern.CASE_INSENSITIVE);
m_script = p_script.matcher(htmlStr);
htmlStr = m_script.replaceAll(""); // 过滤script标签
p_html = java.util.regex.Pattern.compile(regEx_html, java.util.regex.Pattern.CASE_INSENSITIVE);
m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll(""); // 过滤html标签
textStr = htmlStr;
} catch (Exception e) {
System.err.println("Html2Text: " + e.getMessage());
}
return htmlToTxt(textStr).trim();// 返回文本字符串
}
/**
* html
*
* @param input
* @return
*/
public static String htmlToTxt(String input) {
if (input == null || input.trim().equals("")) {
return "";
}
// 去掉所有html元素,
String str = input.replaceAll("<[a-zA-Z]+[1-9]?[^><]*>", "");
return str;
}
//==new=
public static int getIntValue(Object s, int def){
return getIntValue(null2String(s));
}
public static List<Long> strToLongList(String strs){
List<Long> list = new ArrayList<Long>();
strToLongList(list,strs,true);
return list;
}
public static int dateInterval(String fromdate, String todate) {
Calendar fromcalendar = getCalendar(fromdate);
Calendar tocalendar = getCalendar(todate);
if (fromcalendar == null || tocalendar == null)
return 0;
return (int) ((tocalendar.getTimeInMillis() - fromcalendar.getTimeInMillis()) / 3600 / 24 / 1000);
}
/**
* @param datetime - '2004-05-12 12:00:23' '2004-05-12'
* @return null
*/
public static Calendar getCalendar(String datetime) {
int datetimelength = datetime.length() ;
switch(datetimelength) {
case 19 :
return getCalendar(datetime , "yyyy'-'MM'-'dd' 'HH:mm:ss") ;
case 10 :
return getCalendar(datetime , "yyyy'-'MM'-'dd") ;
default :
return null ;
}
}
/**
* @param datetime -
* @param formart -
* @return null
*/
public static Calendar getCalendar(String datetime, String formart) {
SimpleDateFormat SDF = new SimpleDateFormat(formart) ;
Calendar calendar = Calendar.getInstance() ;
try {
calendar.setTime(SDF.parse(datetime)) ;
} catch (ParseException e) {
return null ;
}
return calendar ;
}
/**
* @return yyyy'-'MM'-'dd
*
* yyyy'-'MM'-'dd
*
* 2004-09-07
*/
public static String getCurrentDateString() {
String timestrformart = "yyyy'-'MM'-'dd" ;
SimpleDateFormat SDF = new SimpleDateFormat(timestrformart) ;
Calendar calendar = Calendar.getInstance() ;
return SDF.format(calendar.getTime()) ;
}
public static String getMessage(String msgMode,String key,String val){
key = null2String(key).trim();
val = null2String(val).trim();
msgMode = null2String(msgMode).trim();
if(!"".equals(msgMode) && !"".equals(key)) {
msgMode = msgMode.replaceAll(key, val);
}
return msgMode;
}
public static List<Long> tranStrToLongList(Object idListObj){
List<Long> docIds = new ArrayList<Long>();
if(idListObj != null) {
try {
JSONArray idObjs = JSONArray.parseArray(null2String(idListObj));
for (Object idObj : idObjs) {
long id = getLongValue(idObj);
if (id > 0l) {
docIds.add(id);
}
}
} catch (Exception e) {
log.error("trans error :{}", idListObj);
log.error(e.getMessage(), e);
}
}
return docIds;
}
}

@ -0,0 +1,293 @@
package com.weaver.seconddev.jcldoor.util;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.ebuilder.datasource.api.query.dto.dw.DynamicParamDto;
import com.weaver.ebuilder.datasource.api.query.dto.dw.FieldQuery;
import com.weaver.ebuilder.datasource.api.query.dto.dw.GroupQuery;
import com.weaver.ebuilder.datasource.api.query.dto.dw.TableQuery;
import com.weaver.ebuilder.datasource.api.entity.ExecuteSqlEntity;
import com.weaver.ebuilder.datasource.api.enums.SourceType;
import com.weaver.ebuilder.datasource.api.service.DataSetService;
import com.weaver.ebuilder.datasource.api.service.impl.EbFormDataService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
/**
* DatabaseUtil SQL
*/
@Component
public class DatabaseUtils {
private final static Logger log = LoggerFactory.getLogger(DatabaseUtils.class);
@Autowired
private DataSetService dataSetService;
@Autowired
private EbFormDataService dataService;
/**
* SQL
*
* @param entity SQL
* @return Map
* @throws RuntimeException SQL
*/
public Map<String, Object> executeSql(ExecuteSqlEntity entity) {
Map<String, Object> map = dataSetService.executeSql(entity);
if ("FAIL".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT))) {
log.error("sql执行失败=>{}", JSONObject.toJSONString(map));
throw new RuntimeException("sql执行异常");
} else {
return map;
}
}
/**
* SQL
*
* @param entity SQL
* @param pageNo
* @param pageSize
* @return Map
* @throws RuntimeException SQL
*/
public Map<String, Object> executeSql(ExecuteSqlEntity entity, int pageNo, int pageSize) {
entity.setPageNo(pageNo);
entity.setPageSize(pageSize);
Map<String, Object> map = dataSetService.executeForQuery(entity);
if ("FAIL".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT))) {
log.error("sql执行失败=>{}", JSONObject.toJSONString(map));
throw new RuntimeException("sql执行异常");
} else {
return map;
}
}
/**
* SQL
*
* @param sql SQL
* @param groupId ID
* @paramDesc ID select APPLICATION_MARK,APPLICATION_name from eteams.ds_mark_service_relation
* @return SQL
*/
public ExecuteSqlEntity getExecuteSqlEntity(String sql, String groupId) {
log.error("sql=>{}", sql);
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
executeSqlEntity.setSql(base64(sql));
executeSqlEntity.setGroupId(groupId);
executeSqlEntity.setSourceType(SourceType.LOGIC);
executeSqlEntity.setGroupKey("0");
return executeSqlEntity;
}
/**
* SQL Base64
*
* @param sql SQL
* @return
*/
public String base64(String sql) {
return Base64.encode(sql);
}
/**
*
*
* @param map Map
* @return Map
*/
public List<Map<String, Object>> getDataSourceList(Map<String, Object> map) {
List<Map<String, Object>> entity = new ArrayList();
if ("OK".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT)) && map.get("count") != null && CommonUtils.getIntValue(map.get("count")) > 0) {
entity = (List) map.get("records");
}
return keyToLowerCase((List) entity);
}
public Map<String, Object> getOneDataSource(Map<String, Object> map) {
List<Map<String, Object>> entity = getDataSourceList(map);
return (Map)(CollectionUtil.isNotEmpty(entity) ? (Map)entity.get(0) : new HashMap());
}
/**
* Map
*
* @param orgMapList Map
* @return Map
*/
public List<Map<String, Object>> keyToLowerCase(List<Map<String, Object>> orgMapList) {
List<Map<String, Object>> resultList = new ArrayList();
Iterator var2 = orgMapList.iterator();
while (var2.hasNext()) {
Map<String, Object> stringObjectMap = (Map) var2.next();
resultList.add(keyToLowerCase(stringObjectMap));
}
return resultList;
}
/**
* Map
*
* @param orgMap Map
* @return Map
*/
public Map<String, Object> keyToLowerCase(Map<String, Object> orgMap) {
Map<String, Object> resultMap = new HashMap();
if (orgMap != null && !orgMap.isEmpty()) {
Set<Map.Entry<String, Object>> entrySet = orgMap.entrySet();
Iterator var3 = entrySet.iterator();
while (var3.hasNext()) {
Map.Entry<String, Object> entry = (Map.Entry) var3.next();
String key = (String) entry.getKey();
Object value = entry.getValue();
resultMap.put(key.toLowerCase(), value);
}
return resultMap;
} else {
return resultMap;
}
}
/**
*
*
* @param sourceType sourceType
* ETEAMS :
* FORM: ebuilder
* LOGIC: ()
* EXTERNAL
* @return
*/
public List<Map<String, Object>> getDataGroups(String sourceType, Boolean flag) {
GroupQuery query = new GroupQuery();
query.setSourceType(SourceType.valueOf(sourceType));
query.setShowSqlDataset(flag);
DynamicParamDto dynamicParamDto = new DynamicParamDto();
dynamicParamDto.setUserId(10000L);
dynamicParamDto.setTenantKey("tk");
query.setDynamicParamDto(dynamicParamDto);
return dataSetService.getDataGroups(query);
}
/**
*
*
* @param sourceType
* @param groupId
* @param pageNum
* @param pageSize
* @return
*/
public Map<String, Object> getDataSets(String sourceType, String groupId, Integer pageNum, Integer pageSize) {
TableQuery tableQuery = new TableQuery();
tableQuery.setSourceType(SourceType.valueOf(sourceType));
tableQuery.setGroupId(groupId);
//非必传
//tableQuery.setName(name);
tableQuery.setPageNo(pageNum);
tableQuery.setPageSize(pageSize);
return dataSetService.getDataSetsByPage(tableQuery);
}
/**
*
* sourceType :LOGIC
* sourceId : 8494845523559165780
* groupId : weaver-crm-service
*
* @param
* @return
*/
public List<Map<String, Object>> getFields(String sourceType, String sourceId, String groupId) {
FieldQuery query = new FieldQuery();
query.setSourceType(SourceType.valueOf(sourceType));
query.setSourceId(sourceId);
query.setGroupId(groupId);
return dataSetService.getFields(query);
}
/**
* sql
* sourceType :LOGIC
* groupId : weaver-ebuilder-app-service
* sql : select * from ebda_app limit 10
*
* @param
* @return
*/
public Map<String, Object> execute(String sourceType, String groupId, String sql) {
//执行sql 参数sourceType groupId sql
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
executeSqlEntity.setSql(base64(sql));
executeSqlEntity.setGroupId(groupId);
executeSqlEntity.setSourceType(SourceType.valueOf(sourceType));
return dataSetService.executeSql(executeSqlEntity);
}
public Map<String, Object> executeForQuery(String sourceType, String groupId, String sql,List<SqlParamEntity> sqlparam) {
//执行sql 参数sourceType groupId sql sqlparam
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
executeSqlEntity.setSql(base64(sql));
executeSqlEntity.setGroupId(groupId);
executeSqlEntity.setSourceType(SourceType.valueOf(sourceType));
executeSqlEntity.setParams(sqlparam);
return dataSetService.executeSql(executeSqlEntity);
}
public String getMysqlPagedSql(String sql,int pageNo, int pageSize) {
if(pageNo<=0){
pageNo = 1;
}
if(pageSize<=0){
pageSize = 20;
}
int start = (pageNo-1)*pageSize;
int end = pageNo*pageSize;
return new StringBuffer().append(sql).append(
" LIMIT "+start+","+(end-start)).toString();
}
/**
* sql
* @param list
* @return
*/
public List<SqlParamEntity> getSqlParamEntity(List<String> list){
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
for (String str : list){
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(str);
sqlparam.add(sqlParamEntity);
}
return sqlparam;
}
}

@ -0,0 +1,739 @@
package com.weaver.seconddev.jcldoor.util;
import com.weaver.common.hrm.entity.employee.HrmEmployee;
import com.weaver.common.hrm.service.HrmCommonEmployeePlusService;
import com.weaver.common.hrm.util.HrmCommonUtil;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.ebuilder.form.client.entity.data.*;
import com.weaver.framework.rpc.annotation.RpcReference;
import com.weaver.teams.domain.user.SimpleEmployee;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.weaver.ebuilder.form.client.service.data.RemoteSimpleDataService;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Component
public class JucailinPortalUtils {
private final Logger log = LoggerFactory.getLogger(JucailinPortalUtils.class);
@RpcReference
private com.weaver.em.msg.api.rest.OaRest oaRest;
@Autowired
private DatabaseUtils databaseUtils;
@Autowired
private HrmCommonEmployeePlusService hrmCommonEmployeePlusService;
@Autowired
private HrmCommonUtil hrmCommonUtil;
@RpcReference(group="ebuilderform")
private RemoteSimpleDataService remoteSimpleDataService;
public String getUfPropData(String pkey,String tenant_key) {
String pvalue = "" ;
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
try{
log.error("pkey:"+pkey);
if(StringUtils.isNotBlank(pkey))
{
String dataSql =" select pvalue \n" +
" from uf_nj_prop \n" +
" where pkey = ? \n" +
" and delete_type = 0 \n" +
" and tenant_key='"+tenant_key+"'" ;
log.error("dataSql:"+dataSql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(pkey);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
log.error("recordList:"+recordList.size());
if(CollectionUtils.isNotEmpty(recordList) && recordList.size() >0 ) {
Map<String,Object> recordMap = recordList.get(0);
if(recordMap.containsKey("pvalue")){
pvalue = String.valueOf(recordMap.get("pvalue"));
}
}
}
}catch (Exception e){
e.printStackTrace();
log.error("getUfPropData-Exception:"+e);
}
return pvalue;
}
/***
*
*
*/
// public Map<String,Object> getChatGroup(String tenant_key,String tablename){
// Map<String,Object> dataMap = new HashMap<String,Object>();
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// try {
//
// String startDate = "2001-01-01";
// //设置当前时间
//
// Calendar cal = Calendar.getInstance();
// cal.setTime(new Date());
// //同理增加一天的方法:
// cal.add(Calendar.DATE, -1);
// String endDate = format.format(cal.getTime());
//
// log.error("startDate:"+startDate);
// log.error("endDate:"+endDate);
//
// SimpleEmployee employee = UserContext.getCurrentUser();
// Long cid = employee.getCid();
// long employeeId = employee.getEmployeeId();
// log.error("getChatGroup--cid:"+cid);
//
// String pageSize = "10";
// 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",startDate);
// json.put("endDate",endDate);
//
// log.error("json:"+ JSON.toJSONString(json));
//
// Request request = new Request();
// request.setUrl("/user-profile/groupSession");
// request.setParamsMap(json);
// request.setAsync(false);
//
// log.error("request:"+ request.toString());
// Response response = oaRest.executeIm(request);
// log.error("getChatGroup--isSuccess"+response.isSuccess());
// log.error("response2:"+ response.toString());
// if (response.isSuccess()){
// String data = response.getData();
// dataMap.put("data",data);
// if(StringUtils.isNotBlank(data)){
// JSONObject dataJson = JSONObject.parseObject(data);
// JSONObject actionMsg = dataJson.getJSONObject("actionMsg");
// if(actionMsg.containsKey("code")){
// String code = actionMsg.getString("code");
// if("0".equals(code)){
// JSONObject dataObject = dataJson.getJSONObject("data");
// String count = dataObject.getString("count");
// dataMap.put("count",count);
// if(StringUtils.isNotBlank(count)){
// int cou = Integer.parseInt(count);
// updateUserChatGroup(cou,cid,startDate,endDate,employeeId,tenant_key,tablename);
// }
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// log.error("getChatGroup:"+e);
// }
// return dataMap;
// }
//
//
// /***
// *
// * @param count
// * @param cid
// * @param startDate
// * @param endDate
// * @param employeeId
// */
// public void updateUserChatGroup(int count,long cid,String startDate,String endDate,long employeeId,String tenant_key,String tablename){
// int pagesize = 1000;
// int num = (int)Math.ceil(count/1000.0);
// log.error("updateUserChatGroup-num:"+num);
// for(int i=1;i<=num;i++){
// updateUserChatGroup2Mode(cid,startDate,endDate,i,pagesize,employeeId,tenant_key,tablename);
// }
// }
//
//
// /***
// *
// * @param cid
// * @param startDate
// * @param endDate
// * @param pageNum
// * @param pageSize
// * @param employeeId
// */
// public void updateUserChatGroup2Mode(long cid,String startDate,String endDate,int pageNum,int pageSize,long employeeId,String tenant_key,String tablename){
// try {
// String groupId = "weaver-ebuilder-form-service";
// String sourceType = "LOGIC";
//
// Map<String, Object> json = new HashMap<String, Object>();
// json.put("cid",cid);
// json.put("pageNum",pageNum);
// json.put("pageSize",pageSize);
// json.put("startDate",startDate);
// json.put("endDate",endDate);
//
// log.error("json:"+ JSON.toJSONString(json));
//
// Request request = new Request();
// request.setUrl("/user-profile/groupSession");
// request.setParamsMap(json);
// request.setAsync(false);
//
// log.error("request:"+ request.toString());
// Response response = oaRest.executeIm(request);
// log.error("getChatGroup--isSuccess"+response.isSuccess());
// log.error("response2:"+ response.toString());
// if (response.isSuccess()){
// String data = response.getData();
// if(StringUtils.isNotBlank(data)){
// JSONObject dataJson = JSONObject.parseObject(data);
// JSONObject actionMsg = dataJson.getJSONObject("actionMsg");
// if(actionMsg.containsKey("code")){
// String code = actionMsg.getString("code");
// if("0".equals(code)){
// JSONObject dataObject = dataJson.getJSONObject("data");
// if(dataObject.containsKey("data")){
// JSONArray dataArray = dataObject.getJSONArray("data");
// for(int i=0;i<dataArray.size();i++){
// JSONObject dataInfo = dataArray.getJSONObject(i);
// String userid = dataInfo.getString("userid");
// String amount = dataInfo.getString("amount");
//
// String sql = " select id from "+tablename+" where ry=? and tenant_key=? and delete_type=0 ";
// List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
// SqlParamEntity sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(userid+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(tenant_key+"");
// sqlparam.add(sqlParamEntity);
//
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
// List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
// if(!recordList.isEmpty()){
// updateChatGroupDate(userid,amount,sourceType,groupId,tenant_key,tablename);
// }else{
// insertChatGroupDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename);
// }
// }
// }
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// log.error("updateUserChatGroup2Mode:"+e);
// }
// }
//
// /***
// *
// * @param userid
// * @param amount
// * @param employeeId
// * @param sourceType
// * @param groupId
// * @param tenant_key
// */
// public void insertChatGroupDate(String userid,String amount,long employeeId,String sourceType,String groupId,String tenant_key,String tablename){
//
// try {
// long generate = IdGenerator.generate();
// String sql =" insert into "+tablename+"(id,ry,amount,form_data_id,data_index,create_time,update_time,tenant_key,is_delete,creator,delete_type) " +
// " values (" + generate + "," + userid + ",'"+amount+"'," + generate + ",0,now(),now(),'"+tenant_key+"',0," + employeeId + ",0)";
// log.error("insertChatGroupDate-sql:"+sql);
// Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
// Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Object> next = iterator.next();
// log.error("insertChatGroupDate--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
//
// List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
// for(int i=0;i<recordList.size();i++){
// Map<String,Object> map = recordList.get(i);
// for (String key:map.keySet()){
// System.out.println("insertChatGroupDate--key= "+key+" and value= "+String.valueOf(map.get(key)));
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// log.error("insertChatGroupDate:"+e);
// }
// }
//
// /***
// *
// * @param userid
// * @param amount
// * @param sourceType
// * @param groupId
// * @param tenant_key
// */
// public void updateChatGroupDate(String userid,String amount,String sourceType,String groupId,String tenant_key,String tablename){
// try {
// String sql =" update "+tablename+" set amount=?,update_time=now() where ry = ? and tenant_key= ? and delete_type=0 ";
// List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
// SqlParamEntity sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(amount+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(userid+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(tenant_key);
// sqlparam.add(sqlParamEntity);
//
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
// Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Object> next = iterator.next();
// log.error("insertChatDayDate--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
//
// List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
// for(int i=0;i<recordList.size();i++){
// Map<String,Object> map = recordList.get(i);
// for (String key:map.keySet()){
// System.out.println("insertChatDayDate222--key= "+key+" and value= "+String.valueOf(map.get(key)));
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// log.error("updateChatGroupDate:"+e);
// }
// }
//
//
// public Map<String,Object> getChatDay(String tenant_key,String tablename){
// Map<String,Object> dataMap = new HashMap<String,Object>();
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// try {
// SimpleEmployee employee = UserContext.getCurrentUser();
//
// String startDate = "2001-01-01";
//
// Calendar cal = Calendar.getInstance();
// //设置当前时间
// cal.setTime(new Date());
// //同理增加一天的方法:
// cal.add(Calendar.DATE, -1);
// String endDate = format.format(cal.getTime());
//
// log.error("startDate:"+startDate);
// log.error("endDate:"+endDate);
// Long cid = employee.getCid();
// log.error("getChatGroup--cid:"+cid);
// Long employeeId = employee.getEmployeeId();
//
// String pageSize = "10";
// 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",startDate);
// json.put("endDate",endDate);
//
// log.error("json:"+ JSON.toJSONString(json));
//
// Request request = new Request();
// request.setUrl("/user-profile/dailySingleSession");
// request.setParamsMap(json);
// request.setAsync(false);
//
// log.error("request:"+ request.toString());
// Response response = oaRest.executeIm(request);
// log.error("getChatGroup--isSuccess"+response.isSuccess());
// log.error("response2:"+ response.toString());
// if (response.isSuccess()){
// String data = response.getData();
// dataMap.put("data",data);
// if(StringUtils.isNotBlank(data)){
// JSONObject dataJson = JSONObject.parseObject(data);
// JSONObject actionMsg = dataJson.getJSONObject("actionMsg");
// if(actionMsg.containsKey("code")){
// String code = actionMsg.getString("code");
// if("0".equals(code)){
// JSONObject dataObject = dataJson.getJSONObject("data");
// String count = dataObject.getString("count");
// dataMap.put("count",count);
//
// if(StringUtils.isNotBlank(count)){
// int cou = Integer.parseInt(count);
// updateUserChatDay(cou,cid,startDate,endDate,employeeId,tenant_key,tablename);
// }
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// log.error("testSapi13:"+e);
// }
// return dataMap;
// }
//
//
// public void updateUserChatDay(int count,long cid,String startDate,String endDate,long employeeId,String tenant_key,String tablename){
// int pagesize = 1000;
// int num = (int)Math.ceil(count/1000.0);
// log.error("updateUserChatGroup-num:"+num);
// for(int i=1;i<=num;i++){
// updateUserChatDay2Mode(cid,startDate,endDate,i,pagesize,employeeId,tenant_key,tablename);
// }
// }
//
//
// /***
// *
// * @param cid
// * @param startDate
// * @param endDate
// * @param pageNum
// * @param pageSize
// * @param employeeId
// */
// public void updateUserChatDay2Mode(long cid,String startDate,String endDate,int pageNum,int pageSize,long employeeId,String tenant_key,String tablename){
// try {
// String groupId = "weaver-ebuilder-form-service";
// String sourceType = "LOGIC";
//
// Map<String, Object> json = new HashMap<String, Object>();
// json.put("cid",cid);
// json.put("pageNum",pageNum);
// json.put("pageSize",pageSize);
// json.put("startDate",startDate);
// json.put("endDate",endDate);
//
// log.error("json:"+ JSON.toJSONString(json));
//
// Request request = new Request();
// request.setUrl("/user-profile/groupSession");
// request.setParamsMap(json);
// request.setAsync(false);
//
// log.error("request:"+ request.toString());
// Response response = oaRest.executeIm(request);
// log.error("getChatGroup--isSuccess"+response.isSuccess());
// log.error("response2:"+ response.toString());
// if (response.isSuccess()){
// String data = response.getData();
// if(StringUtils.isNotBlank(data)){
// JSONObject dataJson = JSONObject.parseObject(data);
// JSONObject actionMsg = dataJson.getJSONObject("actionMsg");
// if(actionMsg.containsKey("code")){
// String code = actionMsg.getString("code");
// if("0".equals(code)){
// JSONObject dataObject = dataJson.getJSONObject("data");
// if(dataObject.containsKey("data")){
// JSONArray dataArray = dataObject.getJSONArray("data");
// for(int i=0;i<dataArray.size();i++){
// JSONObject dataInfo = dataArray.getJSONObject(i);
// String userid = dataInfo.getString("userid");
// String amount = dataInfo.getString("amount");
//
// String sql = " select id from "+tablename+" where ry=? and tenant_key=? and delete_type=0 ";
// List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
// SqlParamEntity sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(userid+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(tenant_key+"");
// sqlparam.add(sqlParamEntity);
//
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
// List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
// if(!recordList.isEmpty()){
// updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename);
// }else{
// insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename);
// }
// }
// }
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// log.error("updateUserChatGroup2Mode:"+e);
// }
// }
//
//
// /***
// *
// * @param userid
// * @param amount
// * @param employeeId
// * @param sourceType
// * @param groupId
// * @param tenant_key
// */
// public void insertChatDayDate(String userid,String amount,long employeeId,String sourceType,String groupId,String tenant_key,String tablename){
//
// try {
// long generate = IdGenerator.generate();
// String sql =" insert into "+tablename+"(id,ry,amount,form_data_id,data_index,create_time,update_time,tenant_key,is_delete,creator,delete_type) " +
// " values (" + generate + "," + userid + ",'"+amount+"'," + generate + ",0,now(),now(),'"+tenant_key+"',0," + employeeId + ",0)";
// log.error("insertChatDayDate-sql:"+sql);
// Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
//
// Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Object> next = iterator.next();
// log.error("insertChatDayDate--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
//
// List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
// for(int i=0;i<recordList.size();i++){
// Map<String,Object> map = recordList.get(i);
// for (String key:map.keySet()){
// System.out.println("insertChatDayDate222--key= "+key+" and value= "+String.valueOf(map.get(key)));
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// log.error("insertChatGroupDate:"+e);
// }
// }
//
// /***
// *
// * @param userid
// * @param amount
// * @param sourceType
// * @param groupId
// * @param tenant_key
// */
// public void updateChatDayDate(String userid,String amount,String sourceType,String groupId,String tenant_key,String tablename){
// try {
// String sql =" update "+tablename+" set amount=?,update_time=now() where ry = ? and tenant_key= ? and delete_type=0 ";
// log.error("updateChatDayDate-sql:"+sql);
//
// List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
// SqlParamEntity sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(amount+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(userid+"");
// sqlparam.add(sqlParamEntity);
//
// sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(tenant_key);
// sqlparam.add(sqlParamEntity);
//
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
// Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<String, Object> next = iterator.next();
// log.error("insertChatDayDate--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
//
// List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
// for(int i=0;i<recordList.size();i++){
// Map<String,Object> map = recordList.get(i);
// for (String key:map.keySet()){
// System.out.println("insertChatDayDate222--key= "+key+" and value= "+String.valueOf(map.get(key)));
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// log.error("updateChatGroupDate:"+e);
// }
// }
public HrmEmployee getHrmEmployee(Long employId) {
HrmEmployee hrmEmployee = (HrmEmployee)hrmCommonEmployeePlusService.getById(employId);
return hrmEmployee;
}
public SimpleEmployee getSimpleEmployee(Long employId) {
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(employId);
return simpleEmployee;
}
// objid = 977243418007322629
// operator = 6488080121949444347
public void saveModeData(String objId,String operator,String tenant_key,List<EBDataReqDto> datas){
log.error("saveModeData-objid:"+objId);
log.error("saveModeData-operator:"+operator);
log.error("saveModeData-tenant_key:"+tenant_key);
log.error("saveModeData-datas:"+datas.size());
EBDataChangeReqDto ebDataChangeReqDto = new EBDataChangeReqDto();
// 构建基础参数; objId 表单id, operator 操作人, tenantKey 租户
ebDataChangeReqDto.setHeader(new EBDataReqHeader(objId, operator,tenant_key));
// List<EBDataReqDto> datas = Lists.newArrayList();
//// 数据1
// EBDataReqDto ebDataReqDto1 = new EBDataReqDto();
// List<EBDataReqDetailDto> mainData1 = Lists.newArrayList();
//// 单行文本
// mainData1.add(new EBDataReqDetailDto("845949549147324416", "单行文本数据1"));
//// 选择框根据选项名赋值
// mainData1.add(new EBDataReqDetailDto("845949549147324419", "选项1", true));
// ebDataReqDto1.setMainDatas(mainData1);
//
//// 数据2
// EBDataReqDto ebDataReqDto2 = new EBDataReqDto();
// List<EBDataReqDetailDto> mainData2 = Lists.newArrayList();
//// 单行文本
// mainData2.add(new EBDataReqDetailDto("845949549147324416", "单行文本数据2"));
//// 选择框根据选项key赋值
// mainData2.add(new EBDataReqDetailDto("845949549147324419", "845949643627814915", false));
// ebDataReqDto2.setMainDatas(mainData2);
// datas.add(ebDataReqDto1);
// datas.add(ebDataReqDto2);
ebDataChangeReqDto.setDatas(datas);
EBDataChangeResult insertEbDataChangeResult = remoteSimpleDataService.saveFormData(ebDataChangeReqDto);
log.error("insertEbDataChangeResult:"+insertEbDataChangeResult.getMessage());
log.error("insertEbDataChangeResult:"+insertEbDataChangeResult.toString());
log.error("insertEbDataChangeResult:"+insertEbDataChangeResult.getStatus());
}
/***
*
*/
public void updateModeDataById(String objId,String operator,String tenant_key,List<EBDataReqDto> datas,boolean isNeedAdd){
/**
* id update table set a = '11' where id = 1
*/
EBDataChangeReqDto ebDataChangeReqDto = new EBDataChangeReqDto();
// 构建基础参数; objId 表单id, operator 操作人, tenantKey 租户
ebDataChangeReqDto.setHeader(new EBDataReqHeader(objId, operator, tenant_key));
// 请求操作信息
EBDataReqOperation ebDataReqOperation = new EBDataReqOperation();
ebDataReqOperation.setUpdateType(EBDataUpdateType.ids);
// 数据没有找到的时候是否新增数据
EBDataReqOperationInfo ebDataReqOperationInfo = new EBDataReqOperationInfo();
ebDataReqOperationInfo.setNeedAdd(isNeedAdd);
ebDataReqOperation.setMainData(ebDataReqOperationInfo);
ebDataChangeReqDto.setOperation(ebDataReqOperation);
// 数据组装
// List<EBDataReqDto> datas = Lists.newArrayList();
//// 数据1
// EBDataReqDto ebDataReqDto1 = new EBDataReqDto();
// List<EBDataReqDetailDto> mainData1 = Lists.newArrayList();
//// 设置更新id
// mainData1.add(new EBDataReqDetailDto("id", "845949549147324400"));
//// 单行文本
// mainData1.add(new EBDataReqDetailDto("845949549147324416", "单行文本数据1"));
//// 选择框根据选项名赋值
// mainData1.add(new EBDataReqDetailDto("845949549147324419", "选项1", true));
// ebDataReqDto1.setMainDatas(mainData1);
//
//// 数据2
// EBDataReqDto ebDataReqDto2 = new EBDataReqDto();
// List<EBDataReqDetailDto> mainData2 = Lists.newArrayList();
//// 设置更新id
// mainData2.add(new EBDataReqDetailDto("id", "845949549147324401"));
//// 单行文本
// mainData2.add(new EBDataReqDetailDto("845949549147324416", "单行文本数据2"));
//// 选择框根据选项key赋值
// mainData2.add(new EBDataReqDetailDto("845949549147324419", "845949643627814915", false));
// ebDataReqDto2.setMainDatas(mainData2);
//
// datas.add(ebDataReqDto1);
// datas.add(ebDataReqDto2);
ebDataChangeReqDto.setDatas(datas);
EBDataChangeResult updateEbDataChangeResult = remoteSimpleDataService.updateFormData(ebDataChangeReqDto);
log.error("updateEbDataChangeResult:"+updateEbDataChangeResult.getMessage());
log.error("updateEbDataChangeResult:"+updateEbDataChangeResult.toString());
log.error("updateEbDataChangeResult:"+updateEbDataChangeResult.getStatus());
}
/***
*
* @param request
* @return
*/
public Map<String, Object> request2Map(HttpServletRequest request) {
// 参数Map
Map properties = request.getParameterMap();
// 返回值Map
Map<String, Object> returnMap = new HashMap<String, Object>();
Iterator<Map.Entry> entries = properties.entrySet().iterator();
Map.Entry entry;
String name = "";
Object value = null;
while (entries.hasNext()) {
entry = (Map.Entry) entries.next();
name = (String) entry.getKey();
Object valueObj = entry.getValue();
if (null == valueObj) {
value = null;
} else if (valueObj instanceof String[]) {
String[] values = (String[]) valueObj;
if (values.length == 1) {
value = values[0];
} else {
value = values;
}
} else {
value = valueObj.toString();
}
returnMap.put(name, value);
}
return returnMap;
}
}
Loading…
Cancel
Save