This commit is contained in:
linfso 2024-06-18 08:27:13 +08:00
parent 020517d6db
commit f7b7e003e7
5 changed files with 174 additions and 11 deletions

View File

@ -32,6 +32,7 @@ import com.xdadan.erp.emis.domain.EmisBrand;
import com.xdadan.erp.emis.domain.EmisCountry;
import com.xdadan.erp.emis.domain.EmisTmsScanRecord;
import com.xdadan.erp.emis.domain.enumtype.ScanType;
import com.xdadan.erp.emis.domain.enumtype.WaybillStatus;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.*;
import com.xdadan.erp.emis.service.*;
@ -44,6 +45,7 @@ import com.xdadan.erp.system.service.ISysFileInfoService;
import com.xdadan.erp.system.service.ISysUserService;
import com.xdadan.erp.system.service.impl.SysUserServiceImpl;
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.dao.DuplicateKeyException;
@ -438,6 +440,102 @@ public class EmisWaybillController extends EmisBaseController
return getDataTable(list);
}
/**
* 获取运单统计信息
* @param emisWaybill
* @return
*/
@RequestMapping("/getWaybillStatMap")
public AjaxResult getWaybillStatMap(EmisWaybill emisWaybill)
{
// 设置通用权限查询参数
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);
return AjaxResult.success("查询成功",statInfoMap);
}
@RequestMapping("/selectEmisWaybillByMutiBillCode")
public TableDataInfo selectEmisWaybillByMutiBillCode(EmisWaybill emisWaybill)

View File

@ -31,8 +31,9 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
public List<Map> selectWaybillStatByEmpCode(@Param("empCode")String empCode,@Param("waybillStatus")String waybillStatus);
public List<Map> selectCommissionStatDataByEmp(@Param("empCode")String empCode);
public List<Map> selectCommissionStatData(EmisWaybill emisWaybill);
public List<Map> getWaybillStatMap(EmisWaybill emisWaybill);
public EmisWaybill selectEmisWaybillByOrderSn(@Param("orderSn")String orderSn);

View File

@ -218,18 +218,33 @@ public class EmisBaseService {
}
/**
* 获取员工提成信息
* @param empNo
* 获取运单统计信息
* @return
*/
public List<Map> getCommissionStatByEmpCode(String empNo){
public List<Map> getWaybillStatMap(EmisWaybill emisWaybill){
if(StringUtils.isEmpty(empNo)){
if(emisWaybill==null){
return null;
}
return emisWaybillMapper.selectCommissionStatDataByEmp(empNo);
return emisWaybillMapper.getWaybillStatMap(emisWaybill);
}
/**
* 获取员工提成
* @param emisWaybill
* @return
*/
public List<Map> selectCommissionStatData(EmisWaybill emisWaybill){
if(emisWaybill==null){
return null;
}
return emisWaybillMapper.selectCommissionStatData(emisWaybill);
}
/**
* 获取目的地信息
* @param destCode

View File

@ -117,7 +117,7 @@ public interface IEmisWaybillService
/**
* 获取多个运单
* @param billCodes
* @param emisWaybill
* @return
*/
public List<EmisWaybill> selectEmisWaybillByMutiBillCode(EmisWaybill emisWaybill);

View File

@ -238,7 +238,7 @@
</select>
<select id="selectCommissionStatDataByEmp" parameterType="String" resultType="map">
<select id="selectCommissionStatData" parameterType="String" resultType="map">
select waybill_status as waybillStatus,count(1) as cnt from emis_waybill
where take_piece_employee_code is not null
group by waybill_status
@ -584,17 +584,19 @@
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code in (
a.send_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
)
or a.salesmen=#{params.privEmpCode}
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
@ -619,6 +621,53 @@
a.create_time desc
</select>
<!-- where take_piece_employee_code is not null-->
<select id="getWaybillStatMap" parameterType="EmisWaybill" resultType="Map">
select a.waybill_status as waybillStatus,count(1) as cnt from emis_waybill a
<where>
a.del_flag='0'
<if test="id != null "> and a.id = #{id}</if>
<if test="orderSn != null and orderSn != ''"> and ( FIND_IN_SET(`order_sn`,#{orderSn}) or order_sn like concat('%', #{orderSn}, '%') ) </if>
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') ) </if>
<if test="sendSiteCode != null and sendSiteCode != ''"> and a.send_site_code= #{sendSiteCode}</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
or a.operate_employee_code=#{params.privEmpCode}
or a.take_piece_employee_code=#{params.privEmpCode}
)
</if>
</where>
group by a.waybill_status
</select>
<!-- 通用权限判断 参数 isPrivQuery -->
<select id="selectEmisWaybillById" parameterType="Long" resultMap="EmisWaybillResult">