This commit is contained in:
linfso 2024-06-18 15:26:17 +08:00
parent d78c45b5a5
commit d8fb3bbefe
3 changed files with 98 additions and 86 deletions

View File

@ -16,6 +16,7 @@ import com.xdadan.erp.common.core.controller.BaseController;
import com.xdadan.erp.common.core.domain.AjaxResult;
import com.xdadan.erp.common.core.page.TableDataInfo;
import com.xdadan.erp.emis.domain.EmisSite;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.AddressParseResult;
import com.xdadan.erp.emis.service.EmisBaseService;
@ -65,8 +66,11 @@ public class EmisCommonToolsController extends EmisBaseController
Map statMap = new HashMap();
// 获取基本订单的统计数据
List<Map> empStatList=emisBaseService.selectWaybillStatByEmpCode(getLoginUser().getUser().getEmpCode());
// List<Map> empStatList=emisBaseService.selectWaybillStatByEmpCode(getLoginUser().getUser().getEmpCode());
EmisWaybill emisWaybill = new EmisWaybill();
Map orderMap=emisBaseService.getWaybillStatMap(emisWaybill);
Map orderStatMap = new HashMap();
int waitTakeNum=(int)(Math.random()*100+20);
@ -77,14 +81,18 @@ public class EmisCommonToolsController extends EmisBaseController
statMap.put("orderStat",orderStatMap);
// 获取员工佣金信息
List<Map> statList=emisBaseService.getCommissionStatByEmpCode(getLoginUser().getUser().getEmpCode());
// List<Map> statList=emisBaseService.selectCommissionStatData(getLoginUser().getUser().getEmpCode());
Map commissionStatMap = new HashMap();
int estMoney=(int)(Math.random()*10000+100);
commissionStatMap.put("estMoney", (float)estMoney+0.80f);
commissionStatMap.put("waitPay", (float)(estMoney-100)+0.80f);
// commissionStatMap.put("estMoney", (float)estMoney+0.80f);
// commissionStatMap.put("waitPay", (float)(estMoney-100)+0.80f);
commissionStatMap.put("estMoney", 0.0f);
commissionStatMap.put("waitPay", 0.0f);
statMap.put("commStat",commissionStatMap);

View File

@ -451,86 +451,7 @@ public class EmisWaybillController extends EmisBaseController
// 设置通用权限查询参数
setPrivParams(emisWaybill);
/*
{
"waitDoNum":5,
"hasDoNum":10
"statNumList":[
{
"statType":"1",
"statName":"未接单",
"statNum":5
},
{
"statType":"2",
"statName":"已揽收",
"statNum":5
},
{
"statType":"3",
"statName":"未确认",
"statNum":6
}
]
}
*/
List<Map> statNumList = new ArrayList<>();
int waitDoNum=0;
int hasDoNum=0;
int statType_1_num=0;
int statType_2_num=0;
int statType_3_num=0;
int statType_4_num=0;
List<Map> dbStatMapList = emisBaseService.getWaybillStatMap(emisWaybill);
if(!CollectionUtils.isEmpty(dbStatMapList)){
for (Map objMap:dbStatMapList) {
String waybillStatus= MapUtils.getString(objMap,"waybillStatus",null);
int cnt= MapUtils.getIntValue(objMap,"cnt",0);
if(WaybillStatus.INIT.statusCode.equals(waybillStatus)){
waitDoNum=waitDoNum+cnt;
statType_1_num=statType_1_num+cnt;
}else{
statType_2_num=statType_1_num+cnt;
hasDoNum=hasDoNum+cnt;
}
}
}
// statType 1
Map<String,Object> statMap = new HashMap<>();
statMap.put("statType","1");
statMap.put("statNum",statType_1_num);
statNumList.add(statMap);
// statType 2
statMap = new HashMap<>();
statMap.put("statType","2");
statMap.put("statNum",statType_2_num);
statNumList.add(statMap);
// statType 3
statMap = new HashMap<>();
statMap.put("statType","3");
statMap.put("statNum",statType_3_num);
statNumList.add(statMap);
// statType 4
statMap = new HashMap<>();
statMap.put("statType","4");
statMap.put("statNum",statType_4_num);
statNumList.add(statMap);
Map<String,Object> statInfoMap = new HashMap<String,Object>();
statInfoMap.put("waitDoNum",waitDoNum);
statInfoMap.put("hasDoNum",hasDoNum);
statInfoMap.put("statNumList",statNumList);
Map statInfoMap=emisBaseService.getWaybillStatMap(emisWaybill);
return AjaxResult.success("查询成功",statInfoMap);
}

View File

@ -52,6 +52,7 @@ package com.xdadan.erp.emis.service;
import com.xdadan.erp.system.service.ISysConfigService;
import jdk.nashorn.internal.runtime.Undefined;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -250,12 +251,94 @@ public class EmisBaseService {
* 获取运单统计信息
* @return
*/
public List<Map> getWaybillStatMap(EmisWaybill emisWaybill){
public Map getWaybillStatMap(EmisWaybill emisWaybill){
if(emisWaybill==null){
return null;
}
return emisWaybillMapper.getWaybillStatMap(emisWaybill);
/*
{
"waitDoNum":5,
"hasDoNum":10
"statNumList":[
{
"statType":"1",
"statName":"未接单",
"statNum":5
},
{
"statType":"2",
"statName":"已揽收",
"statNum":5
},
{
"statType":"3",
"statName":"未确认",
"statNum":6
}
]
}
*/
int waitDoNum=0;
int hasDoNum=0;
int statType_1_num=0;
int statType_2_num=0;
int statType_3_num=0;
int statType_4_num=0;
List<Map> dbStatMapList = emisWaybillMapper.getWaybillStatMap(emisWaybill);
if(!CollectionUtils.isEmpty(dbStatMapList)){
for (Map objMap:dbStatMapList) {
String waybillStatus= MapUtils.getString(objMap,"waybillStatus",null);
int cnt= MapUtils.getIntValue(objMap,"cnt",0);
if(WaybillStatus.INIT.statusCode.equals(waybillStatus)){
waitDoNum=waitDoNum+cnt;
statType_1_num=statType_1_num+cnt;
}else{
statType_2_num=statType_1_num+cnt;
hasDoNum=hasDoNum+cnt;
}
}
}
List<Map> statNumList = new ArrayList<>();
// statType 1
Map<String,Object> statMap = new HashMap<>();
statMap.put("statType","1");
statMap.put("statNum",statType_1_num);
statNumList.add(statMap);
// statType 2
statMap = new HashMap<>();
statMap.put("statType","2");
statMap.put("statNum",statType_2_num);
statNumList.add(statMap);
// statType 3
statMap = new HashMap<>();
statMap.put("statType","3");
statMap.put("statNum",statType_3_num);
statNumList.add(statMap);
// statType 4
statMap = new HashMap<>();
statMap.put("statType","4");
statMap.put("statNum",statType_4_num);
statNumList.add(statMap);
Map<String,Object> statInfoMap = new HashMap<String,Object>();
statInfoMap.put("waitDoNum",waitDoNum);
statInfoMap.put("hasDoNum",hasDoNum);
statInfoMap.put("statNumList",statNumList);
return statInfoMap;
}
/**