|
|
@ -3,11 +3,14 @@ package com.yxt.anrui.base.biz.busvehicleapplydetail; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.api.basevehicle.BusVehicleOrderCountQuery; |
|
|
|
import com.yxt.anrui.base.api.busvehicleapply.BusVehicleApply; |
|
|
|
import com.yxt.anrui.base.api.busvehicleapplydetail.*; |
|
|
|
import com.yxt.anrui.base.api.busvehicleorder.OrderListVo; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -37,10 +40,12 @@ public class BusVehicleApplyDetailService extends MybatisBaseService<BusVehicleA |
|
|
|
PagerVo<BusVehicleApplyDetail> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public List<BusVehicleApplyDetail> listAll(BusVehicleApplyDetailQuery query) { |
|
|
|
QueryWrapper<BusVehicleApplyDetail> qw = createQueryWrapper(query); |
|
|
|
return baseMapper.selectList(qw); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<BusVehicleApplyDetail> createQueryWrapper(BusVehicleApplyDetailQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
@ -95,13 +100,13 @@ public class BusVehicleApplyDetailService extends MybatisBaseService<BusVehicleA |
|
|
|
return baseMapper.selectListVo(); |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(BusVehicleApplyDetailDto dto){ |
|
|
|
public void saveOrUpdateDto(BusVehicleApplyDetailDto dto) { |
|
|
|
BusVehicleApplyDetail entity = new BusVehicleApplyDetail(); |
|
|
|
dto.fillEntity(entity); |
|
|
|
this.saveOrUpdate(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public BusVehicleApplyDetailVo fetchByIdVo(String id){ |
|
|
|
public BusVehicleApplyDetailVo fetchByIdVo(String id) { |
|
|
|
BusVehicleApplyDetail entity = this.fetchById(id); |
|
|
|
BusVehicleApplyDetailVo vo = new BusVehicleApplyDetailVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
@ -116,12 +121,14 @@ public class BusVehicleApplyDetailService extends MybatisBaseService<BusVehicleA |
|
|
|
List<BusVehicleApplyDetailVo> busVehicleApplyDetailVos = baseMapper.fetchByApplySid(sid); |
|
|
|
return busVehicleApplyDetailVos; |
|
|
|
} |
|
|
|
|
|
|
|
public BusVehicleApplyDetailVo selModel(String sid) { |
|
|
|
return baseMapper.selModel(sid); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 销售订单-采购订单分页列表 |
|
|
|
* |
|
|
|
* @param pagerQuery 查询条件 |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -131,10 +138,10 @@ public class BusVehicleApplyDetailService extends MybatisBaseService<BusVehicleA |
|
|
|
IPage<BusVehicleApply> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
IPage<BusVehicleApplyListVo> pagging = baseMapper.applyPage(page, qw); |
|
|
|
List<BusVehicleApplyListVo> list = pagging.getRecords(); |
|
|
|
for (int i = 0; i <list.size() ; i++) { |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
int platformNo = list.get(i).getPlatformNo(); |
|
|
|
int lockingNum = list.get(i).getLockingNum(); |
|
|
|
int useNum = platformNo-lockingNum; |
|
|
|
int useNum = platformNo - lockingNum; |
|
|
|
list.get(i).setUseNum(useNum); |
|
|
|
} |
|
|
|
PagerVo<BusVehicleApplyListVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
@ -143,6 +150,7 @@ public class BusVehicleApplyDetailService extends MybatisBaseService<BusVehicleA |
|
|
|
|
|
|
|
/** |
|
|
|
* 销售订单-采购订单分页列表构造条件 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -159,4 +167,37 @@ public class BusVehicleApplyDetailService extends MybatisBaseService<BusVehicleA |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据车型sid及配置sid查询采购订单的数量 |
|
|
|
* |
|
|
|
* @param query 查询条件 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<Integer> selectOrderCount(BusVehicleOrderCountQuery query) { |
|
|
|
ResultBean<Integer> rb = ResultBean.fireFail(); |
|
|
|
QueryWrapper<BusVehicleApply> qw = new QueryWrapper<>(); |
|
|
|
if (query != null) { |
|
|
|
//车型sid
|
|
|
|
qw.eq("bd.vehicleSid", query.getModelSid()); |
|
|
|
//配置sid
|
|
|
|
qw.eq("bd.configSid", query.getConfigSid()); |
|
|
|
} |
|
|
|
List<OrderListVo> orderListVoList = baseMapper.selectOrderCount(qw); |
|
|
|
int count = 0; |
|
|
|
int plat = 0; |
|
|
|
int locking = 0; |
|
|
|
for (int i = 0; i < orderListVoList.size(); i++) { |
|
|
|
String platformNo = orderListVoList.get(i).getPlatformNo(); |
|
|
|
String lockingNum = orderListVoList.get(i).getLockingNum(); |
|
|
|
if (StringUtils.isNotBlank(platformNo)) { |
|
|
|
plat = Integer.parseInt(platformNo); |
|
|
|
if (StringUtils.isNotBlank(lockingNum)) { |
|
|
|
locking = Integer.parseInt(lockingNum); |
|
|
|
} |
|
|
|
} |
|
|
|
count = count+(plat-locking); |
|
|
|
} |
|
|
|
return rb.success().setData(count); |
|
|
|
} |
|
|
|
} |