#E10-47# 接口优化

main
shilei 11 months ago
parent 44393e45b6
commit 184b88fb00

@ -58,10 +58,7 @@ public class CockpitWorkAchievementsCmd {
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 = "";
if(paramMap.containsKey("startday")){
@ -134,8 +131,9 @@ public class CockpitWorkAchievementsCmd {
//项目验收信息
two = getYsInfo(employeeId,startday,endday);
log.error("two:"+two);
two = parseJe(two);
log.error("four:"+four);
log.error("two2:"+two);
twoword = "本年验收金额";
pkey = "workdata.project.ysje";
twourl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
@ -199,35 +197,35 @@ public class CockpitWorkAchievementsCmd {
foururl = jucailinCockpitUtils.getUfPropData(pkey,tenantKey);
}
Map<String,String> oneMap = new HashMap<String,String>(100);
oneMap.put("name",oneword);
oneMap.put("value",one);
oneMap.put("url",oneurl);
list.add(oneMap);
log.error("1111");
Map<String,String> twoMap = new HashMap<String,String>(100);
twoMap.put("name",twoword);
twoMap.put("value",two);
twoMap.put("url",twourl);
list.add(twoMap);
log.error("2222");
Map<String,String> threeMap = new HashMap<String,String>(100);
threeMap.put("name",threeword);
threeMap.put("value",three);
threeMap.put("url",threeurl);
list.add(threeMap);
log.error("3333");
Map<String,String> fourMap = new HashMap<String,String>(100);
fourMap.put("name",fourword);
fourMap.put("value",four);
fourMap.put("url",foururl);
list.add(fourMap);
log.error("4444");
list.add(oneMap);
list.add(twoMap);
list.add(threeMap);
list.add(fourMap);
recordMap.put("datas",list);
} catch (Exception e) {
e.printStackTrace();
@ -534,17 +532,21 @@ public class CockpitWorkAchievementsCmd {
endday = sdf.format(new Date());
}
log.error("employeeId2:"+employeeId);
log.error("startday2:"+startday);
log.error("endday2:"+endday);
if(StringUtils.isNotBlank(employeeId)){
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 " + //收款结算
" ifnull(sum(cast(ifnull(t1.skje,0) as decimal(18,2))),'0') as skje,\n" + //收款金额
" ifnull(sum(cast(ifnull(t1.xmskje,0) as decimal(18,2))),'0') as xmskje,\n" + // 项目收款金额
" CONVERT(ifnull(sum(cast(ifnull(t1.xsyxje,0) as decimal(18,2))),0),CHAR(100)) as xsyxje," + // 销售有效金额
" CONVERT(ifnull(sum(cast(ifnull(t1.xsje,0) as decimal(18,2))),0),CHAR(100)) as xsje," + // 销售金额
" CONVERT(ifnull(sum(cast(ifnull(t1.xmyxje,0) as decimal(18,2))),0),CHAR(100)) as xmyxje," + //项目有效金额
" CONVERT(ifnull(sum(cast(ifnull(t1.xsjxhk,0) as decimal(18,2))),0),CHAR(100)) as xsjxhk," + //有效绩效回款
" CONVERT(ifnull(sum(cast(ifnull(t1.sumsk,0) as decimal(18,2))),0),CHAR(100)) as sumsk," + //总收款金额
" CONVERT(ifnull(sum(cast(ifnull(t1.sjjsk,0) as decimal(18,2))),0),CHAR(100)) as sjjsk," + //实际结算款
" CONVERT(ifnull(sum(cast(ifnull(t1.skjs,0) as decimal(18,2))),0),CHAR(100)) 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" +
@ -597,8 +599,9 @@ public class CockpitWorkAchievementsCmd {
if(recordList.size()>0){
skje = String.valueOf(recordList.get(0).get("skje"));
log.error("skje:"+skje);
}
log.error("skje:"+skje);
log.error("skje2:"+skje);
}
} catch (Exception e) {
e.printStackTrace();
@ -607,7 +610,13 @@ public class CockpitWorkAchievementsCmd {
return skje;
}
/***
*
* @param employeeId
* @param startday
* @param endday
* @return
*/
public String getYsInfo(String employeeId,String startday,String endday){
String groupId = "weaver-ebuilder-form-service";
@ -626,11 +635,15 @@ public class CockpitWorkAchievementsCmd {
if(StringUtils.isBlank(endday)){
endday = sdf.format(new Date());
}
log.error("employeeId:"+employeeId);
log.error("startday:"+startday);
log.error("endday:"+endday);
if(StringUtils.isNotBlank(employeeId)){
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 " +
String sql =" select ifnull(sum(cast(ifnull(t1.htzje,0) as decimal(18,2))),'0') as htzje," +
" ifnull(sum(cast(ifnull(t1.htyxje,0) as decimal(18,2))),'0') as htyxje," +
" ifnull(sum(cast(ifnull(t1.sumsk,0) as decimal(18,2))),'0') as sumsk " +
" from uf_jxhs_xmys t1 \n" +
" where t1.ysrq>=? and t1.ysrq<=? " +
" and ( t1.qyjl = ? "+
@ -648,7 +661,9 @@ public class CockpitWorkAchievementsCmd {
" or t1.dqzj = ?\n" +
" or t1.dqzj in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?) " +
" ) " ;
log.error("getYsInfo-sql:"+sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(startday);
strlist.add(endday);
@ -668,12 +683,14 @@ public class CockpitWorkAchievementsCmd {
strlist.add(employeeId);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
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()>0){
htzje = String.valueOf(recordList.get(0).get("htzje"));
log.error("htzje:"+htzje);
}
log.error("htzje2:"+htzje);
}
} catch (Exception e) {
e.printStackTrace();
@ -735,7 +752,14 @@ public class CockpitWorkAchievementsCmd {
return count;
}
/***
*
* @param startday
* @param endday
* @param employeeId
* @param tenantKey
* @return
*/
public String getDailyInfo(String startday,String endday,String employeeId,String tenantKey) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@ -790,18 +814,30 @@ public class CockpitWorkAchievementsCmd {
}
/***
*
* @param value
* @return
*/
public static String parseJe(String value){
if("".equals(value)){
return "0.00";
String convertData = "0.00";
if(StringUtils.isBlank(value)){
return convertData;
}
BigDecimal dividend = new BigDecimal(value); // 被除数
BigDecimal divisor = new BigDecimal("10000"); // 除数
// 设置小数点后两位,并进行四舍五入
BigDecimal result = dividend.divide(divisor, 2, RoundingMode.HALF_UP);
BigDecimal dividend = new BigDecimal(value); // 被除数
if(dividend.doubleValue()>100000000){
BigDecimal divisor = new BigDecimal("100000000"); // 除数
BigDecimal result = dividend.divide(divisor, 2, RoundingMode.HALF_UP); // 设置小数点后两位,并进行四舍五入
convertData = result.toString();
}else if(dividend.doubleValue()>10000){
BigDecimal divisor = new BigDecimal("10000"); // 除数
BigDecimal result = dividend.divide(divisor, 2, RoundingMode.HALF_UP); // 设置小数点后两位,并进行四舍五入
convertData = result.toString();
}
return result.toString();
return convertData;
}
}

@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
@ -247,8 +248,12 @@ public class CockpitWorkflowAnalysisCmd {
}
log.error("minutescount:"+minutescount);
if(requestLength > 0 && minutescount > 0){
double average = minutescount/(wfcount*1.0) ;
count = String.valueOf(average);
double average = minutescount/(requestLength*1.0) ;
BigDecimal dividend = new BigDecimal(average);
dividend = dividend.setScale(2, RoundingMode.HALF_UP);
count = dividend.toString();
}
}
}

@ -0,0 +1,133 @@
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.math.RoundingMode;
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 CockpitWorkflowAvgProcessTimeCmd {
//日志
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 {
Map<String,String> wfMap = getWorkflowOperateAverageTime(employee,tenantKey);
recordMap.put("data",wfMap);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
return recordMap;
}
/***
*
* @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*1.0) ;
BigDecimal dividend = new BigDecimal(average);
dividend = dividend.setScale(2, RoundingMode.HALF_UP);
count = dividend.toString();
}
}
}
} 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;
}
}

@ -111,6 +111,23 @@ public class JucailinCockpitController {
}
@GetMapping("/getWorkflowAvgProcessTime")
@WeaPermission(publicPermission = true)
public WeaResult<Object> getWorkflowAvgProcessTime(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.getWorkflowAvgProcessTime(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){

@ -14,6 +14,8 @@ public interface JucailinCockpitService {
Map<String, Object> getWorkflowAnalysis(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
Map<String, Object> getWorkflowAvgProcessTime(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);

@ -38,7 +38,8 @@ public class JucailinCockpitServiceimpl implements JucailinCockpitService {
@Autowired
private CockpitProjectDataCmd cockpitProjectDataCmd;
@Autowired
private CockpitWorkflowAvgProcessTimeCmd cockpitWorkflowAvgProcessTimeCmd;
@Override
public Map<String, Object> getMonthPerformanceData(SimpleEmployee simpleEmployee, Map<String, Object> paramMap,String tenantKey) {
@ -65,6 +66,12 @@ public class JucailinCockpitServiceimpl implements JucailinCockpitService {
return dataMap;
}
@Override
public Map<String, Object> getWorkflowAvgProcessTime(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
Map<String,Object> dataMap = cockpitWorkflowAvgProcessTimeCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
return dataMap;
}
@Override
public Map<String, Object> getDocmentAnalysis(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {

Loading…
Cancel
Save