车辆公里数

This commit is contained in:
syruan 2025-03-17 13:39:10 +08:00
parent 4c4c288d7e
commit c50fcb88ae
6 changed files with 76 additions and 61 deletions

View File

@ -34,11 +34,11 @@ public class CarContractOutVo {
/**
* 开始公里数
*/
private int glsStart;
private String glsStart;
/**
* 结束公里数
*/
private int glsEnd;
private String glsEnd;
/**
* 价格
*/

View File

@ -37,11 +37,11 @@ public class CarContractSupCarVo {
* 开始公里数
*/
private int glsKs;
private String glsKs;
/**
* 公里数结束
*/
private int glsJs;
private String glsJs;

View File

@ -50,13 +50,19 @@ public class CarNeedPlanDetailVo {
/**
* 需用量
*/
@Excel(name = "单位", width = 10.0, orderNum = "5")
@Excel(name = "需用量", width = 10.0, orderNum = "5")
private int needNum;
/**
* 需用天数
*/
@Excel(name = "需用天数", width = 10.0, orderNum = "6")
private String needDay;
/**
* 归还日期
*/
private String backDate;
/**
* 备注
*/

View File

@ -546,63 +546,65 @@ public class CarContractServiceImpl implements CarContractService{
}
private String verifyData2(List<CarContractSupCarVo> list) {
try{
for (CarContractSupCarVo car:list){
List<CarContractOutVo> outList=car.getOutList();
if(ListHelpUtil.isNotEmpty(outList)){
int num=outList.size();
for (int i = 0; i < outList.size(); i++) {
CarContractOutVo vo=outList.get(i);
int start1=vo.getGlsStart();
int end=vo.getGlsEnd();
if(end<start1){
return "吊车出入场公里数"+vo.getGlsStart()+"~"+vo.getGlsEnd()+"结束值不能小于开始值";
}
if(i<num-1){
CarContractOutVo vo2=outList.get(i+1);
int start=vo2.getGlsStart();
if(end+1!=start){
return "吊车出入场公里数"+vo.getGlsStart()+"~"+vo.getGlsEnd()+"" +vo2.getGlsStart()+"~"+vo2.getGlsStart()+"不连贯";
}
}
}
}
}
return null;
}catch (Exception e){
log.error(e.toString(),e);
}
return "验证异常";
return null;
// try{
// for (CarContractSupCarVo car:list){
// List<CarContractOutVo> outList=car.getOutList();
// if(ListHelpUtil.isNotEmpty(outList)){
// int num=outList.size();
// for (int i = 0; i < outList.size(); i++) {
// CarContractOutVo vo=outList.get(i);
// int start1=vo.getGlsStart();
// int end=vo.getGlsEnd();
// if(end<start1){
// return "吊车出入场公里数"+vo.getGlsStart()+"~"+vo.getGlsEnd()+"结束值不能小于开始值";
// }
// if(i<num-1){
// CarContractOutVo vo2=outList.get(i+1);
// int start=vo2.getGlsStart();
// if(end+1!=start){
// return "吊车出入场公里数"+vo.getGlsStart()+"~"+vo.getGlsEnd()+"" +vo2.getGlsStart()+"~"+vo2.getGlsStart()+"不连贯";
// }
//
// }
// }
//
// }
// }
// return null;
// }catch (Exception e){
// log.error(e.toString(),e);
// }
// return "验证异常";
}
/**
* 验证 车辆公里数是否合法
* @return
*/
public String verifyData(List<CarContractSupCarVo> list){
try{
int num=list.size();
for (int i = 0; i < list.size(); i++) {
CarContractSupCarVo vo=list.get(i);
int start1=vo.getGlsKs();
int end=vo.getGlsJs();
if(end<start1){
return "车辆公里数:"+start1+"~"+end+"结束值不能小于开始值";
}
if(i<num-1){
CarContractSupCarVo vo2=list.get(i+1);
int start=vo2.getGlsKs();
if(end+1!=start){
return "车辆公里数:"+ vo.getGlsKs()+"~"+vo.getGlsJs()+"" +vo2.getGlsKs()+"~"+vo2.getGlsJs()+"不连贯";
}
}
}
return null;
}catch (Exception e){
log.error(e.toString(),e);
}
return "验证异常";
return null;
// try{
// int num=list.size();
// for (int i = 0; i < list.size(); i++) {
// CarContractSupCarVo vo=list.get(i);
// int start1=vo.getGlsKs();
// int end=vo.getGlsJs();
// if(end<start1){
// return "车辆公里数:"+start1+"~"+end+"结束值不能小于开始值";
// }
// if(i<num-1){
// CarContractSupCarVo vo2=list.get(i+1);
// int start=vo2.getGlsKs();
// if(end+1!=start){
// return "车辆公里数:"+ vo.getGlsKs()+"~"+vo.getGlsJs()+"" +vo2.getGlsKs()+"~"+vo2.getGlsJs()+"不连贯";
// }
// }
// }
// return null;
// }catch (Exception e){
// log.error(e.toString(),e);
// }
// return "验证异常";
}

View File

@ -1,6 +1,7 @@
package com.bonus.gzcar.business.backstage.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.bonus.gzcar.business.backstage.entity.*;
import com.bonus.gzcar.business.backstage.mapper.CarNeedPlanMapper;
import com.bonus.gzcar.business.system.entity.AuditRecordVo;
@ -84,12 +85,18 @@ public class CarNeedPlanServiceImpl implements CarNeedPlanService{
CarNeedPlanVo vo = JSON.parseObject(params, CarNeedPlanVo.class);
vo.setCreator(userId);
vo.setUpdater(userId);
vo.setUserName(UserUtil.getLoginUser().getUsername());
vo.setUserName(Objects.requireNonNull(UserUtil.getLoginUser()).getUsername());
String msg = validatorsUtils.valid(vo);
if(StringHelper.isNotEmpty(msg)){
return ServerResponse.createErroe(msg);
}
List<CarNeedPlanDetailVo> detailList=vo.getDetailList();
List<CarNeedPlanDetailVo> detailList=vo.getDetailList();
String requestParameterDetails = request.getParameter("details");
if (StringHelper.isNotEmpty(requestParameterDetails)) {
JSONArray detailListArray = JSON.parseArray(requestParameterDetails);
detailList = detailListArray.toJavaList(CarNeedPlanDetailVo.class);
}
if(ListHelpUtil.isEmpty(detailList)){
return ServerResponse.createErroe("请选择车辆规格信息");
}

View File

@ -14,10 +14,10 @@
</insert>
<insert id="addNeedPlanDetails">
insert into car_plan_details(
apply_id, model_id, need_num, need_day, remark,plan_type
apply_id, model_id, need_num, need_day, remark,plan_type, back_date
)values
<foreach collection="list" item="item" separator=",">
(#{param.id},#{item.modelId},#{item.needNum},#{item.needDay},#{item.remark},#{param.type})
(#{param.id},#{item.modelId},#{item.needNum},#{item.needDay},#{item.remark},#{param.type},#{item.backDate})
</foreach>
</insert>
@ -98,7 +98,7 @@
where cpa.id=#{id}
</select>
<select id="getNeedDetailInfo" 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,
select cpd.id, cpd.apply_id planId ,cpd.model_id modelId,cpd.need_day needDay,cpd.need_num needNum,cpd.back_date backDate,
remark,plan_type planType,cmti.type,cmti.name,cmti.model ,cmti.unit
from car_plan_details cpd
LEFT JOIN car_ma_type_info cmti on cpd.model_id=cmti.id