查询及 导出修改、排序修改

This commit is contained in:
haozq 2025-01-20 18:19:02 +08:00
parent 57a90faca8
commit 93d3133e14
12 changed files with 84 additions and 26 deletions

View File

@ -122,6 +122,11 @@ public class CarBalanceController {
if("未付".equals(exp.getStatus())){
exp.setPayMoney("未付");
}
if("1".equals(exp.getType())){
exp.setType("车辆");
}else{
exp.setType("吊车");
}
exp.setXh(num[0]);
num[0]++;
export.add(exp);

View File

@ -1,9 +1,11 @@
package com.bonus.gzcar.business.backstage.controller;
import cn.afterturn.easypoi.cache.manager.IFileLoader;
import com.bonus.gzcar.business.backstage.entity.*;
import com.bonus.gzcar.business.backstage.service.CarStatisticsService;
import com.bonus.gzcar.business.utils.ExportExcelUtil;
import com.bonus.gzcar.manager.annotation.DecryptAndVerify;
import com.bonus.gzcar.manager.common.util.StringHelper;
import com.bonus.gzcar.manager.core.entity.EncryptedReq;
import com.bonus.gzcar.manager.webResult.ServerResponse;
import com.github.pagehelper.PageHelper;
@ -60,6 +62,9 @@ public class CarStatisticsController {
list.forEach(vo->{
CarBalanceExport1Vo exp=new CarBalanceExport1Vo();
BeanUtils.copyProperties(vo,exp);
if(StringHelper.isEmpty(exp.getFkTime())){
exp.setFkTime("--");
}
exp.setXh(num[0]);
num[0]++;
export.add(exp);

View File

@ -5,7 +5,9 @@ import com.bonus.gzcar.business.backstage.entity.*;
import com.bonus.gzcar.business.backstage.service.DispatchCarService;
import com.bonus.gzcar.business.backstage.service.SupDispatchCarService;
import com.bonus.gzcar.business.utils.ExportExcelUtil;
import com.bonus.gzcar.business.utils.ListHelpUtil;
import com.bonus.gzcar.manager.annotation.DecryptAndVerify;
import com.bonus.gzcar.manager.common.util.StringHelper;
import com.bonus.gzcar.manager.common.util.UserUtil;
import com.bonus.gzcar.manager.core.entity.EncryptedReq;
import com.bonus.gzcar.manager.webResult.ServerResponse;
@ -61,14 +63,19 @@ public class SupDispatchCarController {
@PostMapping("export")
public void export(HttpServletResponse response, @RequestBody CarNeedPlanVo dto) {
try {
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
dto.setCreator(userId);dto.setUserId(userId);
List<CarNeedPlanVo> list = service.getPlanListBySup(dto);
List<SupCarNeedPlanExportVo> exportVos=new ArrayList<SupCarNeedPlanExportVo>();
final int[] num = {1};
list.forEach(vo->{
SupCarNeedPlanExportVo copy=new SupCarNeedPlanExportVo();
BeanUtils.copyProperties(vo,copy);
vo.setXh(num[0]);
copy.setXh(num[0]);
num[0]++;
if(StringHelper.isEmpty(copy.getDispatchDay())){
copy.setDispatchDay("-");
}
exportVos.add(copy);
});
ExportExcelUtil.export(response,"派车录入", SupCarNeedPlanExportVo.class,exportVos);
@ -173,13 +180,14 @@ public class SupDispatchCarController {
list.forEach(vo->{
CarNeedPlanExport1Vo exp=new CarNeedPlanExport1Vo();
BeanUtils.copyProperties(vo,exp);
if("0".equals(exp.getFileNum())){
if(ListHelpUtil.isNotEmpty(exp.getFileList())){
exp.setFileNum("已上传");
}else{
exp.setFileNum("待上传");
}
exp.setStatusName("已派车");
vo.setXh(num[0]);
exp.setXh(num[0]);
num[0]++;
exportList.add(exp);
});

View File

@ -18,7 +18,7 @@ public class CarBalanceExport4Vo extends ParentVo {
/**
* 供应商名称
*/
@Excel(name = "供应商名称", width = 10.0, orderNum = "1")
@Excel(name = "供应商名称", width = 10.0, orderNum = "2")
private String supName;
/**
* 合同状态
@ -36,18 +36,18 @@ public class CarBalanceExport4Vo extends ParentVo {
/**
* 车辆数量
*/
@Excel(name = "用车数量", width = 10.0, orderNum = "3")
@Excel(name = "用车数量", width = 10.0, orderNum = "4")
private int carNum;
/**
* 租赁金额
*/
@Excel(name = "应付金额(元)", width = 10.0, orderNum = "4")
@Excel(name = "应付金额(元)", width = 10.0, orderNum = "5")
private String money;
/**
* 已付金额
*/
@Excel(name = "已付金额(元)", width = 10.0, orderNum = "5")
@Excel(name = "已付金额(元)", width = 10.0, orderNum = "6")
private String payMoney;
/**
* 待付金额
@ -74,15 +74,17 @@ public class CarBalanceExport4Vo extends ParentVo {
/**
* 计划编码
*/
@Excel(name = "需求计划编号", width = 10.0, orderNum = "6")
@Excel(name = "需求计划编号", width = 10.0, orderNum = "3")
private String code;
/**
* 吊车类型
*/
@Excel(name = "类型", width = 10.0, orderNum = "1")
private String type;
/**
* 工程名称
*/
@Excel(name = "工程名称", width = 10.0, orderNum = "7")
private String proName;
/**
* 是否是本年度
@ -91,7 +93,7 @@ public class CarBalanceExport4Vo extends ParentVo {
/**
* 工程数量
*/
@Excel(name = "工程名称", width = 10.0, orderNum = "2")
private String porNum;
/**
* 分公司名称

View File

@ -99,7 +99,7 @@ public class CarNeedPlanExport1Vo extends ParentVo {
/**
* 计划数量
*/
@Excel(name = "派车数量", width = 10.0, orderNum = "6")
private int carNum;
/**
* 用车数量
@ -108,6 +108,7 @@ public class CarNeedPlanExport1Vo extends ParentVo {
/**
* 已派车数量
*/
@Excel(name = "派车数量", width = 10.0, orderNum = "6")
private int dispatchNum;
/**
* 待派车数量

View File

@ -18,6 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.genid.GenId;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -81,8 +83,12 @@ public class DispatchCarServiceImpl implements DispatchCarService{
try{
DispatchCarVo vo=mapper.getProStatisticsDetails(data);
if(vo!=null){
Integer ypcNum=mapper.getProTypeNum(1,vo.getProId());
Integer dpcNum=mapper.getProTypeNum(2,vo.getProId());
String proId="";
if(data!=null){
proId=data.getProId();
}
Integer ypcNum=mapper.getProTypeNum(1,proId);
Integer dpcNum=mapper.getProTypeNum(2,proId);
if(ypcNum==null){
ypcNum=0;
}
@ -90,14 +96,23 @@ public class DispatchCarServiceImpl implements DispatchCarService{
dpcNum=0;
}
map.put("dpcNum",ypcNum);
map.put("ypcNum",dpcNum);
map.put("dpcNum",dpcNum);
map.put("ypcNum",ypcNum);
map.put("planNum",vo.getPlanNum());
map.put("needNum",vo.getNeedNum());
map.put("dispatchNum",vo.getDispatchNum());
map.put("noDispatchNum",vo.getNoDispatchNum());
map.put("dpcRatio",dpcNum/vo.getPlanNum());
map.put("ypcRatio",ypcNum/vo.getPlanNum());
BigDecimal bd1 = new BigDecimal(dpcNum);
BigDecimal bd0 = new BigDecimal(100);
BigDecimal bd2 = new BigDecimal(ypcNum);
BigDecimal bd3 = new BigDecimal(vo.getPlanNum());
// 设置小数点保留两位并进行四舍五入
BigDecimal result = bd1.divide(bd3, 2, RoundingMode.HALF_UP).multiply(bd0);
BigDecimal result2 = bd2.divide(bd3, 2, RoundingMode.HALF_UP).multiply(bd0);
map.put("dpcRatio",result);
map.put("ypcRatio",result2);
}else{
map.put("dpcRatio","0");
map.put("ypcRatio","0");

View File

@ -118,9 +118,10 @@
where cpo.sup_id=#{supId} and cpo.status=1
<if test="keyWord!=null and keyWord!=''">
and (
cpa.`code` like concat('%',#{keyWord},'%') or
pro.name like concat('%',#{keyWord},'%') or
cs.name like concat('%',#{keyWord},'%')
cpa.`code` like concat('%',#{keyWord},'%') or
pro.name like concat('%',#{keyWord},'%') or
cs.name like concat('%',#{keyWord},'%') or
if(cpo.type=1,'运输车辆','吊车') like concat('%',#{keyWord},'%')
)
</if>
<if test="status!=null and status!=''">
@ -132,6 +133,7 @@
</if>
</if>
GROUP BY cpo.apply_id
order by cpo.create_time desc
</select>
<select id="getSltDetailsInfo" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceDetailsVo">
select cpa.code,cs.name supName ,pro.name proName ,cpa.id planId ,cpa.dispatch_num carNum ,

View File

@ -75,6 +75,7 @@
pro.name like concat('%',#{keyWord},'%')
)
</if>
ORDER BY cpa.create_time desc
</select>
<select id="getPlanCode" resultType="java.lang.Integer">
select count(1)

View File

@ -24,7 +24,7 @@
cpa.apply_type applyType, cpa.status_type statusType,cpa.user_name userName
from car_plan_apply cpa
left join bm_project pro on pro.bid_id=cpa.pro_id
where 1=1
where 1=1 and cpa.apply_type=0
<if test="auditStatus!=null and auditStatus!=''">
and status=#{auditStatus}
</if>
@ -36,6 +36,7 @@
cpa.project_content like concat('%',#{keyWord},'%')
)
</if>
ORDER BY cpa.create_time desc
</select>
<select id="getCarAuditDetails" resultType="com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo">
select

View File

@ -135,6 +135,7 @@
and cpa.`code` like concat('%',#{code},'%')
</if>
GROUP BY cpa.id
order by cpa.create_time desc
</select>
<select id="getComNum" resultType="java.lang.Integer">
select count(distinct pro.bmname)

View File

@ -28,28 +28,42 @@
from car_plan_apply cpa
left join bm_project pro on cpa.pro_id=pro.bid_id
where cpa.status_type=1
<if test="proName!=null and proName!=''">
and pro.`name` like concat('%',#{proName},'%')
</if>
GROUP BY cpa.pro_id
<if test="planStatus!=null and planStatus!=''">
<if test='planStatus=="0"'>
HAVING sum(cpa.dispatch_num)=0
</if>
<if test='planStatus=="1"'>
HAVING sum(cpa.dispatch_num)>0 and sum(cpa.need_num)!=sum(cpa.dispatch_num)
</if>
<if test='planStatus=="2"'>
HAVING sum(cpa.need_num)=sum(cpa.dispatch_num)
</if>
</if>
ORDER BY cpa.create_time desc
</select>
<select id="getProTypeNum" resultType="java.lang.Integer">
<if test='type=="1"'>
<if test='type==1'>
select count(1) num
from car_plan_apply cpa
where cpa.status_type=1 and cpa.dispatch_num>0
<if test='proId!=null and proId!=""'>
and cpa.pro_id=#{proId}
GROUP BY cpa.pro_id
</if>
GROUP BY cpa.pro_id
</if>
<if test='type=="2"'>
<if test='type==2'>
select count(1) num
from car_plan_apply cpa
where cpa.status_type=1 and cpa.dispatch_num=0
<if test='proId!=null and proId!=""'>
and cpa.pro_id=#{proId}
GROUP BY cpa.pro_id
</if>
GROUP BY cpa.pro_id
</if>
</select>
<select id="getLastDay" resultType="java.lang.String">

View File

@ -117,6 +117,7 @@
<if test="keyWord!=null and keyWord!=''">
AND (cpa.code like concat('%',#{keyWord},'%') or
pro.name like concat('%',#{keyWord},'%') or
cpa.remark like concat('%',#{keyWord},'%') or
if(cpa.type=1,'车辆','吊车') like concat('%',#{keyWord},'%') or
if(cpa.dispatch_num>0,'已派车',if(cpa.dispatch_status=0,'待审核','待派车')) like concat('%',#{keyWord},'%') or
if(cpa.dispatch_status=0,'待审核', if(cpa.dispatch_status=5,'待派车',if(cpa.dispatch_status=2,'已通过','已驳回') ) ) like concat('%',#{keyWord},'%')
@ -134,6 +135,7 @@
AND dispatch_num>0 and cpa.status!=1
</if>
</if>
ORDER BY cpa.create_time desc
</select>
<select id="getDetailsList" resultType="com.bonus.gzcar.business.backstage.entity.CarNeedPlanDetailVo">
select cpd.id, cpd.apply_id planId ,cpd.model_id modelId,cpd.need_day needDay,cpd.need_num needNum,
@ -241,11 +243,12 @@
<if test="keyWord!=null and keyWord!=''">
and (
cpa.code like concat('%',#{keyWord},'%') or
cpa.remark like concat('%',#{keyWord},'%') or
pro.name like concat('%',#{keyWord},'%') or
cpa.user_name like concat('%',#{keyWord},'%')
)
</if>
order by cpo.create_time desc
</select>
</mapper>