结算bug修改

This commit is contained in:
haozq 2025-01-17 11:54:19 +08:00
parent 8db6d34665
commit b4196de574
8 changed files with 254 additions and 234 deletions

View File

@ -192,6 +192,8 @@ public class CarPlanOutVoDetailsVo {
private String ton;
private String supName;
private String proId;
/**
* 备注
*/
@ -240,9 +242,4 @@ public class CarPlanOutVoDetailsVo {
private int fileNum;
}

View File

@ -35,4 +35,6 @@ public class CarSltPlanVo {
private String proId;
private String carNum;
private String outId;
}

View File

@ -120,10 +120,10 @@ public class CarCarServiceImpl implements CarCarService {
int num=mapper.addCarData(carCarVo);
if(num>0){
if(!xyFile.isEmpty()){
List<FileUploadVo> fileList=uploadService.uploadImage(xyFiles,carCarVo.getId(),"car_supplier_info","2");
if(fileList.size()!=xyFiles.length){
return ServerResponse.createErroe("文件上传失败!");
}
List<FileUploadVo> fileList=uploadService.uploadImage(xyFiles,carCarVo.getId(),"car_supplier_info","2");
if(fileList.size()!=xyFiles.length){
return ServerResponse.createErroe("文件上传失败!");
}
}
List<FileUploadVo> fileList=uploadService.uploadImage(xszzFiles,carCarVo.getId(),"car_supplier_info","3");
if(fileList.size()!=xszzFiles.length){
@ -137,10 +137,10 @@ public class CarCarServiceImpl implements CarCarService {
if(fileList.size()!=xszcFiles.length){
return ServerResponse.createErroe("文件上传失败!");
}
fileList=uploadService.uploadImage(bxFiles,carCarVo.getId(),"car_supplier_info","6");
if(fileList.size()!=bxFiles.length){
return ServerResponse.createErroe("文件上传失败!");
}
fileList=uploadService.uploadImage(bxFiles,carCarVo.getId(),"car_supplier_info","6");
if(fileList.size()!=bxFiles.length){
return ServerResponse.createErroe("文件上传失败!");
}
}
return ServerResponse.createSuccess("新增成功","新增成功");
}catch (Exception e){
@ -237,28 +237,7 @@ public class CarCarServiceImpl implements CarCarService {
MultipartFile[] xszfFiles = xszfFile.toArray(new MultipartFile[0]);
MultipartFile[] xszcFiles = xszcFile.toArray(new MultipartFile[0]);
MultipartFile[] bxFiles = bxFile.toArray(new MultipartFile[0]);
List<CarCarVo> list=mapper.getCarSupDetails(carCarVo);
CarCarVo hisCar=list.get(0);
int hisXszNum=hisCar.getXszNum();
int hisXyNum= hisCar.getXyNum();
int hisBxNum=hisCar.getBxNum();
//
hisXszNum=hisXszNum-xyFileNum+xyFile.size();
hisXyNum=hisXyNum-xszzFileNum-xszzFileNum-xszcFileNum+xszzFile.size()+xszfFile.size()+xszcFile.size();
hisBxNum=hisBxNum-bxFileNum+bxFile.size();
// if(hisXyNum<1){
// return ServerResponse.createErroe("请上传协议附件!");
// }
if(hisXszNum<3){
return ServerResponse.createErroe("请上传车辆行驶证附件!");
}
if(hisBxNum<1){
return ServerResponse.createErroe("至少上传一张保险附件!");
}
carCarVo.setXszNum(hisXszNum);
carCarVo.setXyNum(hisXyNum);
carCarVo.setBxNum(hisBxNum);
if(xyFiles.length>0){
List<FileUploadVo> fileList=uploadService.uploadImage(xyFiles,carCarVo.getId(),"car_supplier_info","2");
if(fileList.size()!=xyFiles.length){
@ -319,12 +298,12 @@ public class CarCarServiceImpl implements CarCarService {
public ServerResponse getCarCarDetails(CarCarVo data) {
try{
List<CarCarVo> list=mapper.getCarSupDetails(data);
if(com.bonus.gzcar.manager.common.util.StringUtils.isNotEmpty(list)){
CarCarVo vo=list.get(0);
List<FileUploadVo> flieList=uploadService.getFileList(vo.getId(),"car_supplier_info",null);
vo.setFileList(flieList);
return ServerResponse.createSuccess("查询成功",vo);
}
if(com.bonus.gzcar.manager.common.util.StringUtils.isNotEmpty(list)){
CarCarVo vo=list.get(0);
List<FileUploadVo> flieList=uploadService.getFileList(vo.getId(),"car_supplier_info",null);
vo.setFileList(flieList);
return ServerResponse.createSuccess("查询成功",vo);
}
}catch (Exception e){
log.error(e.toString(),e);
}
@ -365,7 +344,7 @@ public class CarCarServiceImpl implements CarCarService {
public ServerResponse getCarImageList(CarCarVo data) {
List<FileUploadVo> list=new ArrayList<>();
try {
list=uploadService.getFileList(data.getId(),"car_supplier_info",null);
list=uploadService.getFileList(data.getId(),"car_supplier_info",null);
}catch (Exception e){
log.error(e.toString());
}

View File

@ -93,7 +93,7 @@ public class CarPlanAuditServiceImpl implements CarPlanAuditService{
}
if(1==statusType){
return ServerResponse.createErroe("该数据已被审核请刷新后重试");
return ServerResponse.createErroe("该数据已被审核请刷新后重试");
}
if(2==status){
return ServerResponse.createErroe("该数据已被审核请刷新后重试");
@ -118,6 +118,7 @@ public class CarPlanAuditServiceImpl implements CarPlanAuditService{
data.setNextStatus(1);
}else {
data.setStatus(1);
data.setNextStatus(vo.getStatusType()+1);
}
int num= mapper.updatePlanAudit(data);
if(num>0){
@ -144,7 +145,7 @@ public class CarPlanAuditServiceImpl implements CarPlanAuditService{
}
} else{
recordService.addRecord(data.getId(),data.getStatus()+"",vo.getStatusType()+"","3",data.getRemark(),upTimes);
int num= mapper.updatePlanAudit(data);
int num= mapper.updatePlanAudit(data);
if(num>0){
return ServerResponse.createBySuccessMsg("审核驳回成功");
}

View File

@ -8,6 +8,7 @@ import com.bonus.gzcar.business.system.entity.FileUploadVo;
import com.bonus.gzcar.business.system.service.AuditRecordService;
import com.bonus.gzcar.business.system.service.FileUploadService;
import com.bonus.gzcar.business.utils.ListHelpUtil;
import com.bonus.gzcar.manager.common.util.DateTimeHelper;
import com.bonus.gzcar.manager.common.util.RedisService;
import com.bonus.gzcar.manager.common.util.StringHelper;
import com.bonus.gzcar.manager.webResult.ServerResponse;
@ -201,45 +202,45 @@ public class DispatchCarServiceImpl implements DispatchCarService{
@Override
public ServerResponse dispatchAudit(CarPlanOutVo data) {
try{
String status=data.getStatus();
String remark=data.getRemark();
CarPlanOutVo vo=mapper.getCarPlanOut(data);
if(!"0".equals(vo.getStatus())){
return ServerResponse.createErroe("该计划已被审核,请刷新后重试");
String status=data.getStatus();
String remark=data.getRemark();
CarPlanOutVo vo=mapper.getCarPlanOut(data);
if(!"0".equals(vo.getStatus())){
return ServerResponse.createErroe("该计划已被审核,请刷新后重试");
}
CarNeedPlanVo carNeedPlanVo=mapper.getPlanInfo(data);
//审核驳回
if("2".equals(status)){
int num= mapper.updateDispatchData(data);
if(num>0){
List<CarPlanOutVo> list=mapper.getAuditList(data);
if(ListHelpUtil.isEmpty(list)){
carNeedPlanVo.setStatus(3);
}else{
carNeedPlanVo.setStatus(1);
}
//更新计划状态
mapper.updatePlanInfo(data);
}
}else{
int num= mapper.updateDispatchData(data);
if(num>0){
List<CarPlanOutVo> list=mapper.getAuditList(data);
int dispatchNum=carNeedPlanVo.getDispatchNum();
carNeedPlanVo.setDispatchDay(vo.getOutDay());
carNeedPlanVo.setDispatchNum(dispatchNum+vo.getDispatchNum());
if(ListHelpUtil.isEmpty(list)){
carNeedPlanVo.setStatus(2);
}else{
carNeedPlanVo.setStatus(1);
}
//更新计划信息
mapper.updateCarPlanInfo(carNeedPlanVo);
}
CarNeedPlanVo carNeedPlanVo=mapper.getPlanInfo(data);
//审核驳回
if("2".equals(status)){
int num= mapper.updateDispatchData(data);
if(num>0){
List<CarPlanOutVo> list=mapper.getAuditList(data);
if(ListHelpUtil.isEmpty(list)){
carNeedPlanVo.setStatus(3);
}else{
carNeedPlanVo.setStatus(1);
}
//更新计划状态
mapper.updatePlanInfo(data);
}
String uptime=recordService.getUpTimes("out-"+data.getId(),Integer.parseInt(status));
recordService.addRecord("out-"+data.getId(),status,"2","3",remark,uptime);
}else{
int num= mapper.updateDispatchData(data);
if(num>0){
List<CarPlanOutVo> list=mapper.getAuditList(data);
int dispatchNum=carNeedPlanVo.getDispatchNum();
carNeedPlanVo.setDispatchDay(DateTimeHelper.getNowDay());
carNeedPlanVo.setDispatchNum(dispatchNum+vo.getDispatchNum());
if(ListHelpUtil.isEmpty(list)){
carNeedPlanVo.setStatus(2);
}else{
carNeedPlanVo.setStatus(1);
}
//更新计划信息
mapper.updateCarPlanInfo(carNeedPlanVo);
}
}
String uptime=recordService.getUpTimes("out-"+data.getId(),Integer.parseInt(status));
recordService.addRecord("out-"+data.getId(),status,"2","3",remark,uptime);
return ServerResponse.createBySuccessMsg("审核成功");
}catch (Exception e){
log.error(e.toString(),e);

View File

@ -1,38 +1,45 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.gzcar.business.backstage.mapper.CarBalanceMapper">
<mapper namespace="com.bonus.gzcar.business.backstage.mapper.CarBalanceMapper">
<!--结算信息-->
<insert id="addBalanceData" useGeneratedKeys="true" keyProperty="id">
insert into car_slt_apply(
insert into car_slt_apply(
fk_time, sup_id, remark, creator, create_time,
updater, update_time, money
)values (#{fkTime},#{supId},#{remark},#{creator},now(),#{updater},now(),#{money})
updater, update_time, money
)values (#{fkTime},#{supId},#{remark},#{creator},now(),#{updater},now(),#{money})
</insert>
<insert id="addSltPlanInfo" >
insert into car_slt_plan
( slt_id, plan_id, sup_id, money, car_num, type, pro_id )values
( slt_id, plan_id, sup_id, money, car_num, type, pro_id )values
<foreach collection="list" item="item" separator=",">
(#{param.id},#{item.planId},#{item.supId},#{item.money},#{item.carNum},#{param.type},#{item.proId})
(#{param.id},#{item.planId},#{item.supId},#{item.money},#{item.carNum},#{item.type},#{item.proId})
</foreach>
</insert>
<insert id="addBalanceDetailsData">
insert into car_slt_details
( slt_id, plan_id, sup_id, out_id, money, type, pro_id )values
<foreach collection="list" item="item" separator=",">
(#{param.id},#{item.planId},#{item.supId},#{item.outId},#{item.money},#{param.type},#{item.proId})
(#{param.id},#{item.planId},#{item.supId},#{item.outId},#{item.money},#{item.type},#{item.proId})
</foreach>
</insert>
<!--查询 供应商集合-->
<select id="getSupPageList" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceVo">
select cpo.id,cpo.apply_id applyId ,cpo.sup_id supId,count(1) num ,cs.name supName ,
plan.planNum,pro.proNum,SUM(cpo.money) money,sum(cpo.dispatch_num) carNum
select cpo.id,cpo.apply_id applyId ,cpo.sup_id supId,count(1) num ,cs.name supName ,slt.money payMoney,
SUM(cpo.money)-slt.money noPayMoney,
plan.planNum,pro.proNum,SUM(cpo.money) money,sum(cpo.dispatch_num) carNum,
if(CURRENT_DATE() BETWEEN cc.start_time and cc.end_time,'已生效', if(CURRENT_DATE() &lt; cc.start_time,'未生效','已失效')) status
from car_plan_out cpo
left join car_supplier cs on cs.id=cpo.sup_id
left join car_contract cc on cc.id =cpo.contract_id
left join car_plan_apply cpa on cpo.apply_id=cpa.id
left join (
SELECT sum(money) money,csa.sup_id
from car_slt_apply csa
GROUP BY csa.sup_id
)slt on slt.sup_id=cpo.sup_id
left join (
SELECT count(1) planNum ,cpas.sup_id
from car_plan_apply_sup cpas
left join car_plan_apply cpa on cpa.id=cpas.apply_id
@ -49,7 +56,8 @@
</select>
<select id="getPayCarPlanList" resultType="com.bonus.gzcar.business.backstage.entity.CarBalancePlanVo">
select cpa.id,cpa.`code`,cpa.pro_id proId,pro.`name` proName ,cpa.dispatch_num dispatchNum,
cpa.need_num needNum ,cpa.type ,cs.`name` supName ,sum(cpo.money) money,cpa.remark
cpa.need_num needNum ,cpa.type ,cs.`name` supName ,sum(cpo.money) money,cpa.remark,
cpa.dispatch_day lastDay,cpa.user_name userName
FROM car_plan_apply cpa
left join car_plan_out cpo on cpa.id=cpo.apply_id
left join car_plan_apply_sup cpas on cpas.apply_id=cpa.id
@ -71,43 +79,47 @@
day_or_m isDayOrMonth,cpod.remark,cpd.need_day needDay,cct.is_out_set isOutSet,cct.is_driver_set isDriverSet,
cpa.code planCode,cpa.pro_id proId
from car_plan_out_details cpod
left join car_plan_details cpd on cpd.apply_id=cpod.apply_id and cpd.model_id
left join car_plan_details cpd on cpd.apply_id=cpod.apply_id and cpd.model_id=cpod.model_id
LEFT JOIN car_ma_type_info cmti on cmti.id=cpod.model_id
left join car_plan_apply cpa on cpa.id =cpod.apply_id
left join car_supplier_info csi on csi.id= cpod.car_id
left join car_plan_apply_sup cpas on cpd.apply_id=cpas.apply_id
LEFT JOIN car_contract_type cct on cct.model_id=cpd.model_id and cct.sup_id=cpas.sup_id and cpas.contract_id=cct.contract_id
where cpod.out_id in (
<foreach collection="planIds" item="item" separator=",">
#{item}
</foreach>
)
where cpod.apply_id in (
<foreach collection="planIds" item="item" separator=",">
#{item}
</foreach>
)
</select>
<!--查询供应商结算详情-->
<select id="getSltDetailsList" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceVo">
SELECT cpa.`code` ,cpo.sup_id supId ,cpo.apply_id planId ,sum(cpo.dispatch_num) carNum ,sum(cpo.money) money ,sum(IFNULL(csp.money,0)) payMoney ,
if(csp.id is null,'未付','已付') status,pro.name proName ,cs.name supName ,cpo.type,
sum(cpo.money)-sum(IFNULL(csp.money,0)) noPayMoney
from car_plan_out cpo
left join car_slt_plan csp on csp.plan_id=cpo.apply_id
left join car_plan_apply cpa on cpo.apply_id=cpa.id
LEFT JOIN car_supplier cs on cpo.sup_id=cs.id
left join bm_project pro on pro.bid_id=cpa.pro_id
if(csp.out_id is null,'未付','已付') status,pro.name proName ,cs.name supName ,cpo.type,
sum(cpo.money)-sum(IFNULL(csp.money,0)) noPayMoney
from car_plan_out cpo
left join(
SELECT sum(money) money,csd.out_id
from car_slt_details csd
GROUP BY csd.out_id
)csp ON csp.out_id=cpo.id
left join car_plan_apply cpa on cpo.apply_id=cpa.id
LEFT JOIN car_supplier cs on cpo.sup_id=cs.id
left join bm_project pro on pro.bid_id=cpa.pro_id
where cpo.sup_id=#{supId}
<if test="keyWord!=null and keyWord!=''">
and (
cpa.`code` like concat('%',#{keyWord},'%') or
pro.name like concat('%',#{keyWord},'%')
)
<if test="keyWord!=null and keyWord!=''">
and (
cpa.`code` like concat('%',#{keyWord},'%') or
pro.name like concat('%',#{keyWord},'%')
)
</if>
<if test="status!=null and status!=''">
<if test='status=="1"'>
and csp.out_id is not null
</if>
<if test="status!=null and status!=''">
<if test='status=="1"'>
and csp.id is not null
</if>
<if test='status=="0"'>
and csp.id is null
</if>
<if test='status=="0"'>
and csp.out_id is null
</if>
</if>
GROUP BY cpo.apply_id
</select>
<select id="getSltDetailsInfo" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceDetailsVo">

View File

@ -1,55 +1,85 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.gzcar.business.backstage.mapper.CarCarMapper">
<mapper namespace="com.bonus.gzcar.business.backstage.mapper.CarCarMapper">
<insert id="addCarData" useGeneratedKeys="true" keyProperty="id">
insert into car_supplier_info(
car_num, brand, type, ton, xy_num, bx_num, xsz_num, bx_date,
sup_id, creator, create_time, updator, update_time, is_active
)values (#{carNum},#{brand},#{type},#{ton},#{xyNum},#{bxNum},#{xszNum},#{bxDay},#{supId},
insert into car_supplier_info(
car_num, brand, type, ton, xy_num, bx_num, xsz_num, bx_date,
sup_id, creator, create_time, updator, update_time, is_active
)values (#{carNum},#{brand},#{type},#{ton},#{xyNum},#{bxNum},#{xszNum},#{bxDay},#{supId},
#{creator},now(),#{updater},now(),1)
</insert>
<update id="updateCarData">
update car_supplier_info set
car_num=#{carNum}, brand=#{brand}, type=#{type}, ton=#{ton}, bx_date=#{bxDay},
sup_id=#{supId}, updator=#{updater}, update_time=now(),xy_num=#{xyNum},bx_num=#{bxNum},xsz_num=#{xszNum}
WHERE id=#{id}
car_num=#{carNum}, brand=#{brand}, type=#{type}, ton=#{ton}, bx_date=#{bxDay},
sup_id=#{supId}, updator=#{updater}, update_time=now(),xy_num=#{xyNum},bx_num=#{bxNum},xsz_num=#{xszNum}
WHERE id=#{id}
</update>
<update id="deleteCarData">
update car_supplier_info set is_active=0 WHERE id=#{id}
</update>
<select id="getCarPageList" resultType="com.bonus.gzcar.business.backstage.entity.CarCarVo">
select csi.id,csi.car_num carNum,csi.brand,csi.type,csi.ton,csi.xy_num xyNum,
csi.bx_num bxNum,csi.xsz_num xszNum,csi.bx_date bxDay,sup_id supId,cs.name supName
from car_supplier_info csi
LEFT JOIN car_supplier cs on csi.sup_id=cs.id
where csi.is_active=1
<if test="carNum!=null and carNum!=''">
and csi.car_num like concat('%',#{carNum},'%')
</if>
<if test="brand!=null and brand!=''">
and csi.brand like concat('%',#{brand},'%')
</if>
<if test="type!=null and type!=''">
and csi.type like concat('%',#{type},'%')
</if>
<if test="supName!=null and supName!=''">
and cs.name like concat('%',#{supName},'%')
</if>
select csi.id,csi.car_num carNum,csi.brand,csi.type,csi.ton,IFNULL(file1.num,0) xyNum,
IFNULL(file2.num,0) bxNum,IFNULL(file3.num,0) xszNum,csi.bx_date bxDay,sup_id supId,cs.name supName
from car_supplier_info csi
LEFT JOIN car_supplier cs on csi.sup_id=cs.id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_supplier_info' AND type in(2)
GROUP BY own_id
)file1 on file1.id=csi.id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_supplier_info' AND type in(3,4,5)
GROUP BY own_id
)file2 on file2.id=csi.id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_supplier_info' AND type=6
GROUP BY own_id
)file3 on file3.id=csi.id
where csi.is_active=1
<if test="carNum!=null and carNum!=''">
and csi.car_num like concat('%',#{carNum},'%')
</if>
<if test="brand!=null and brand!=''">
and csi.brand like concat('%',#{brand},'%')
</if>
<if test="type!=null and type!=''">
and csi.type like concat('%',#{type},'%')
</if>
<if test="supName!=null and supName!=''">
and cs.name like concat('%',#{supName},'%')
</if>
</select>
<select id="getCarSupDetails" resultType="com.bonus.gzcar.business.backstage.entity.CarCarVo">
select csi.id,csi.car_num carNum,csi.brand,csi.type,csi.ton,csi.xy_num xyNum,
csi.bx_num bxNum,csi.xsz_num xszNum,csi.bx_date bxDay,sup_id supId,cs.name supName
select csi.id,csi.car_num carNum,csi.brand,csi.type,csi.ton,IFNULL(file1.num,0) xyNum,
IFNULL(file2.num,0) bxNum,IFNULL(file3.num,0) xszNum,csi.bx_date bxDay,sup_id supId,cs.name supName
from car_supplier_info csi
LEFT JOIN car_supplier cs on csi.sup_id=cs.id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_supplier_info' AND type in(2)
GROUP BY own_id
)file1 on file1.id=csi.id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_supplier_info' AND type in(3,4,5)
GROUP BY own_id
)file2 on file2.id=csi.id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_supplier_info' AND type=6
GROUP BY own_id
)file3 on file3.id=csi.id
where csi.is_active=1 and csi.id=#{id}
</select>
<!--查询供应商对应的车辆数据-->
<select id="getCarListBySup" resultType="com.bonus.gzcar.business.backstage.entity.CarCarVo">
select csi.id,csi.car_num carNum ,csi.brand,csi.type ,csi.ton ,csi.sup_id supId ,cs.`name` supName
from car_supplier_info csi
left join car_supplier cs on cs.id=csi.sup_id
left join car_supplier cs on cs.id=csi.sup_id
where csi.is_active=1
<if test="supId!=null and supId!=''">
and csi.sup_id=#{supId}

View File

@ -1,43 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.gzcar.business.backstage.mapper.CarStatisticsMapper">
<mapper namespace="com.bonus.gzcar.business.backstage.mapper.CarStatisticsMapper">
<select id="getSltPageListBySupId" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceVo">
SELECT cpa.`code` ,cpo.sup_id supId ,cpo.apply_id planId ,sum(cpo.dispatch_num) carNum ,sum(cpo.money) money ,sum(IFNULL(csp.money,0)) payMoney ,
if(csp.id is null,'未付','已付') status,pro.name proName ,cs.name supName ,cpo.type,
sum(cpo.money)-sum(IFNULL(csp.money,0)) noPayMoney,cpo.manager ,cpo.create_time jbTime ,csa.create_time fkTime
if(csp.id is null,'未付','已付') status,pro.name proName ,cs.name supName ,cpo.type,
sum(cpo.money)-sum(IFNULL(csp.money,0)) noPayMoney,cpo.manager ,cpo.create_time jbTime ,csa.create_time fkTime
from car_plan_out cpo
left join car_slt_plan csp on csp.plan_id=cpo.apply_id
left join car_slt_apply csa on csa.id=csp.slt_id
left join car_plan_apply cpa on cpo.apply_id=cpa.id
LEFT JOIN car_supplier cs on cpo.sup_id=cs.id
left join bm_project pro on pro.bid_id=cpa.pro_id
where 1=1
<if test="supName!=null and supName!=''">
and cs.name like concat('%',#{supName},'%')
left join car_slt_plan csp on csp.plan_id=cpo.apply_id
left join car_slt_apply csa on csa.id=csp.slt_id
left join car_plan_apply cpa on cpo.apply_id=cpa.id
LEFT JOIN car_supplier cs on cpo.sup_id=cs.id
left join bm_project pro on pro.bid_id=cpa.pro_id
where 1=1
<if test="supName!=null and supName!=''">
and cs.name like concat('%',#{supName},'%')
</if>
<if test="code!=null and code!=''">
and cpa.`code` like concat('%',#{code},'%')
</if>
<if test="proName!=null and proName!=''">
and pro.name like concat('%',#{proName},'%')
</if>
<if test="status!=null and status!=''">
<if test='status=="1"'>
and csp.id is not null
</if>
<if test="code!=null and code!=''">
and cpa.`code` like concat('%',#{code},'%')
</if>
<if test="proName!=null and proName!=''">
and pro.name like concat('%',#{proName},'%')
</if>
<if test="status!=null and status!=''">
<if test='status=="1"'>
and csp.id is not null
</if>
<if test='status=="0"'>
and csp.id is null
</if>
<if test='status=="0"'>
and csp.id is null
</if>
</if>
GROUP BY cpo.apply_id
</select>
<select id="getProNum" resultType="java.lang.Integer">
SELECT count(distinct cpa.pro_id) num
from car_plan_apply_sup cpas
left join car_plan_apply cpa on cpa.id=cpas.apply_id
left join car_plan_apply cpa on cpa.id=cpas.apply_id
</select>
<select id="getNeedPlan" resultType="java.lang.Integer">
SELECT count( cpas.apply_id) num
@ -74,53 +74,51 @@
GROUP BY pro.bmname
) info on pro.bmname=info.bmname
left join car_plan_apply cpa on pro.bid_id=cpa.pro_id
where cpa.id is not null
GROUP BY pro.bmname
<where>
<if test="year!=null and year!=''">
and DATE_FORMAT(cpa.create_time,'%Y')=YEAR(CURDATE())
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(cpa.create_time,'%Y-%m-%d')
between DATE_FORMAT(#{startTime},'%Y-%m-%d') and DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
</where>
where cpa.id is not null
<if test="year!=null and year!=''">
and DATE_FORMAT(cpa.create_time,'%Y')=YEAR(CURDATE())
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(cpa.create_time,'%Y-%m-%d')
between DATE_FORMAT(#{startTime},'%Y-%m-%d') and DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
GROUP BY pro.bmname
</select>
<select id="getSltPageListByBmName" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceVo">
SELECT pro.name proName,count(cpa.id) planNum ,sum(cpa.need_num) needNum ,sum(cpa.dispatch_num) carNum ,cpa.pro_id proId,
sum(cpa.need_num)-sum(cpa.dispatch_num) dpcNum ,IFNULL(sum(cpo.money),0) money ,IFNULL(sum(csp.money),0) payMoney ,
IFNULL(sum(cpo.money),0)-IFNULL(sum(csp.money),0) noPayMoney
sum(cpa.need_num)-sum(cpa.dispatch_num) dpcNum ,IFNULL(sum(cpo.money),0) money ,IFNULL(sum(csp.money),0) payMoney ,
IFNULL(sum(cpo.money),0)-IFNULL(sum(csp.money),0) noPayMoney
from car_plan_apply cpa
left join car_plan_out cpo on cpo.apply_id=cpa.id
LEFT JOIN car_slt_plan csp on csp.plan_id=cpa.id
left join bm_project pro on pro.bid_id=cpa.pro_id
left join car_plan_out cpo on cpo.apply_id=cpa.id
LEFT JOIN car_slt_plan csp on csp.plan_id=cpa.id
left join bm_project pro on pro.bid_id=cpa.pro_id
WHERE pro.bmname=#{bmname} and cpa.status_type=1
<if test="proName!=null and proName!=''">
and pro.name like concat('%',#{proName},'%')
</if>
<if test="proName!=null and proName!=''">
and pro.name like concat('%',#{proName},'%')
</if>
GROUP BY cpa.pro_id
</select>
<select id="getSltPageListByPro" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceVo">
SELECT cpa.`code` ,cpo.sup_id supId ,cpa.id planId ,IFNULL(sum(cpo.dispatch_num),0) carNum ,IFNULL(sum(cpo.money) ,0)money ,
sum(IFNULL(csp.money,0)) payMoney ,IF(cpa.apply_type=0,'需求计划审批','紧急及内部用车') typeName ,
if(csp.id is null,'未付','已付') status,pro.name proName ,IFNULL(cs.name,'-') supName ,cpa.type,
IFNULL( sum(cpo.money)-sum(IFNULL(csp.money,0)),0) noPayMoney,cpa.need_num needNum
sum(IFNULL(csp.money,0)) payMoney ,IF(cpa.apply_type=0,'需求计划审批','紧急及内部用车') typeName ,
if(csp.id is null,'未付','已付') status,pro.name proName ,IFNULL(cs.name,'-') supName ,cpa.type,
IFNULL( sum(cpo.money)-sum(IFNULL(csp.money,0)),0) noPayMoney,cpa.need_num needNum
from car_plan_apply cpa
left join car_plan_out cpo on cpo.apply_id=cpa.id
left join car_slt_plan csp on csp.plan_id=cpo.apply_id
LEFT JOIN car_supplier cs on cpo.sup_id=cs.id
left join bm_project pro on pro.bid_id=cpa.pro_id
where cpa.pro_id=#{proId} and cpa.status_type=1
<if test="code!=null and code!=''">
and cpa.`code` like concat('%',#{code},'%')
</if>
GROUP BY cpa.id
left join car_plan_out cpo on cpo.apply_id=cpa.id
left join car_slt_plan csp on csp.plan_id=cpo.apply_id
LEFT JOIN car_supplier cs on cpo.sup_id=cs.id
left join bm_project pro on pro.bid_id=cpa.pro_id
where cpa.pro_id=#{proId} and cpa.status_type=1
<if test="code!=null and code!=''">
and cpa.`code` like concat('%',#{code},'%')
</if>
GROUP BY cpa.id
</select>
<select id="getComNum" resultType="java.lang.Integer">
select count(distinct pro.bmname)
from car_plan_apply cpa
left join bm_project pro on pro.bid_id=cpa.pro_id
from car_plan_apply cpa
left join bm_project pro on pro.bid_id=cpa.pro_id
where cpa.status_type=1
</select>
<select id="getProNumById" resultType="java.lang.Integer">
@ -129,40 +127,40 @@
where cpa.status_type=1
</select>
<select id="getPayMoneyList" resultType="java.lang.String">
select count( cpa.id ) num
from car_plan_apply cpa
where cpa.status_type=1
<if test="year!=null and year!=''">
and DATE_FORMAT(cpa.create_time,'%Y')=YEAR(CURDATE())
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(cpa.create_time,'%Y-%m-%d')
between DATE_FORMAT(#{startTime},'%Y-%m-%d') and DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
union ALL
select IFNULL(SUM(money),0)
from car_plan_out cpo
left join car_plan_apply cpa on cpa.id=cpo.apply_id
where 1=1
<if test="year!=null and year!=''">
and DATE_FORMAT(cpa.create_time,'%Y')=YEAR(CURDATE())
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(cpa.create_time,'%Y-%m-%d')
between DATE_FORMAT(#{startTime},'%Y-%m-%d') and DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
union ALL
select IFNULL(SUM(money),0)
from car_slt_plan csp
left join car_plan_apply cpa on cpa.id=csp.plan_id
where 1=1
<if test="year!=null and year!=''">
and DATE_FORMAT(cpa.create_time,'%Y')=YEAR(CURDATE())
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(cpa.create_time,'%Y-%m-%d')
between DATE_FORMAT(#{startTime},'%Y-%m-%d') and DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
select count( cpa.id ) num
from car_plan_apply cpa
where cpa.status_type=1
<if test="year!=null and year!=''">
and DATE_FORMAT(cpa.create_time,'%Y')=YEAR(CURDATE())
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(cpa.create_time,'%Y-%m-%d')
between DATE_FORMAT(#{startTime},'%Y-%m-%d') and DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
union ALL
select IFNULL(SUM(money),0)
from car_plan_out cpo
left join car_plan_apply cpa on cpa.id=cpo.apply_id
where 1=1
<if test="year!=null and year!=''">
and DATE_FORMAT(cpa.create_time,'%Y')=YEAR(CURDATE())
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(cpa.create_time,'%Y-%m-%d')
between DATE_FORMAT(#{startTime},'%Y-%m-%d') and DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
union ALL
select IFNULL(SUM(money),0)
from car_slt_plan csp
left join car_plan_apply cpa on cpa.id=csp.plan_id
where 1=1
<if test="year!=null and year!=''">
and DATE_FORMAT(cpa.create_time,'%Y')=YEAR(CURDATE())
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(cpa.create_time,'%Y-%m-%d')
between DATE_FORMAT(#{startTime},'%Y-%m-%d') and DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
</select>
</mapper>