|
@@ -31,10 +31,17 @@ import com.alibaba.excel.write.style.row.AbstractRowHeightStyleStrategy;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import jakarta.annotation.Resource;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
|
|
|
|
+import vip.xiaonuo.biz.modular.bizappointmentrecord.entity.BizAppointmentRecord;
|
|
|
|
+import vip.xiaonuo.biz.modular.bizappointmentrecord.service.BizAppointmentRecordService;
|
|
|
|
+import vip.xiaonuo.biz.modular.bizorder.entity.BizOrder;
|
|
|
|
+import vip.xiaonuo.biz.modular.bizorder.service.BizOrderService;
|
|
import vip.xiaonuo.biz.modular.record.param.*;
|
|
import vip.xiaonuo.biz.modular.record.param.*;
|
|
import vip.xiaonuo.biz.modular.record.result.BizRecordExportResult;
|
|
import vip.xiaonuo.biz.modular.record.result.BizRecordExportResult;
|
|
import vip.xiaonuo.biz.modular.record.result.CarResult;
|
|
import vip.xiaonuo.biz.modular.record.result.CarResult;
|
|
@@ -66,51 +73,65 @@ import java.util.stream.Collectors;
|
|
@Service
|
|
@Service
|
|
public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord> implements BizRecordService {
|
|
public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord> implements BizRecordService {
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private BizAppointmentRecordService bizAppointmentRecordService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private BizOrderService bizOrderService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Page<BizRecord> page(BizRecordPageParam bizRecordPageParam) {
|
|
public Page<BizRecord> page(BizRecordPageParam bizRecordPageParam) {
|
|
|
|
+ QueryWrapper<BizRecord> queryWrapper = getQueryWrapper(bizRecordPageParam);
|
|
|
|
+ return this.getBaseMapper().getPage(CommonPageRequest.defaultPage(), queryWrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public QueryWrapper<BizRecord> getQueryWrapper(BizRecordPageParam bizRecordPageParam){
|
|
QueryWrapper<BizRecord> queryWrapper = new QueryWrapper<BizRecord>().checkSqlInjection();
|
|
QueryWrapper<BizRecord> queryWrapper = new QueryWrapper<BizRecord>().checkSqlInjection();
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getLicensePlate())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getLicensePlate())) {
|
|
- queryWrapper.lambda().like(BizRecord::getLicensePlate, bizRecordPageParam.getLicensePlate());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(bizRecordPageParam.getCarNumber())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getCarNumber, bizRecordPageParam.getCarNumber());
|
|
|
|
|
|
+ queryWrapper.like("br.LICENSE_PLATE", bizRecordPageParam.getLicensePlate());
|
|
}
|
|
}
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getStartGrossTime()) && ObjectUtil.isNotEmpty(bizRecordPageParam.getEndGrossTime())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getStartGrossTime()) && ObjectUtil.isNotEmpty(bizRecordPageParam.getEndGrossTime())) {
|
|
- queryWrapper.lambda().between(BizRecord::getGrossTime, bizRecordPageParam.getStartGrossTime(), bizRecordPageParam.getEndGrossTime());
|
|
|
|
|
|
+ queryWrapper.between("br.GROSS_TIME", bizRecordPageParam.getStartGrossTime()+ " 00:00:00", bizRecordPageParam.getEndGrossTime()+" 23:59:59");
|
|
}
|
|
}
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getStartTareTime()) && ObjectUtil.isNotEmpty(bizRecordPageParam.getEndTareTime())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getStartTareTime()) && ObjectUtil.isNotEmpty(bizRecordPageParam.getEndTareTime())) {
|
|
- queryWrapper.lambda().between(BizRecord::getTareTime, bizRecordPageParam.getStartTareTime(), bizRecordPageParam.getEndTareTime());
|
|
|
|
|
|
+ queryWrapper.between("br.TARE_TIME", bizRecordPageParam.getStartTareTime()+" 00:00:00", bizRecordPageParam.getEndTareTime()+" 23:59:59");
|
|
}
|
|
}
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getDriverName())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getDriverName())) {
|
|
- queryWrapper.lambda().like(BizRecord::getDriverName, bizRecordPageParam.getDriverName());
|
|
|
|
|
|
+ queryWrapper.like("br.DRIVER_NAME", bizRecordPageParam.getDriverName());
|
|
}
|
|
}
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getDriverMobile())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getDriverMobile())) {
|
|
- queryWrapper.lambda().like(BizRecord::getDriverMobile, bizRecordPageParam.getDriverMobile());
|
|
|
|
|
|
+ queryWrapper.like("br.DRIVER_MOBILE", bizRecordPageParam.getDriverMobile());
|
|
}
|
|
}
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getGoodsName())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getGoodsName())) {
|
|
- queryWrapper.lambda().like(BizRecord::getGoodsName, bizRecordPageParam.getGoodsName());
|
|
|
|
|
|
+ queryWrapper.like("br.GOODS_NAME", bizRecordPageParam.getGoodsName());
|
|
}
|
|
}
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getGoodsModel())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getGoodsModel())) {
|
|
- queryWrapper.lambda().like(BizRecord::getGoodsModel, bizRecordPageParam.getGoodsModel());
|
|
|
|
|
|
+ queryWrapper.like("br.GOODS_MODEL", bizRecordPageParam.getGoodsModel());
|
|
}
|
|
}
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getReceiptCompany())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getReceiptCompany())) {
|
|
- queryWrapper.lambda().like(BizRecord::getReceiptCompany, bizRecordPageParam.getReceiptCompany());
|
|
|
|
|
|
+ queryWrapper.like("br.RECEIPT_COMPANY", bizRecordPageParam.getReceiptCompany());
|
|
}
|
|
}
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getShippingCompany())) {
|
|
if (ObjectUtil.isNotEmpty(bizRecordPageParam.getShippingCompany())) {
|
|
- queryWrapper.lambda().like(BizRecord::getShippingCompany, bizRecordPageParam.getShippingCompany());
|
|
|
|
|
|
+ queryWrapper.like("br.SHIPPING_COMPANY", bizRecordPageParam.getShippingCompany());
|
|
}
|
|
}
|
|
- if (ObjectUtil.isNotEmpty(bizRecordPageParam.getTransportRoute())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getTransportRoute, bizRecordPageParam.getTransportRoute());
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizRecordPageParam.getTransportCompany())){
|
|
|
|
+ queryWrapper.like("br.TRANSPORT_COMPANY",bizRecordPageParam.getTransportCompany());
|
|
}
|
|
}
|
|
- if (ObjectUtil.isAllNotEmpty(bizRecordPageParam.getSortField(), bizRecordPageParam.getSortOrder())) {
|
|
|
|
- CommonSortOrderEnum.validate(bizRecordPageParam.getSortOrder());
|
|
|
|
- queryWrapper.orderBy(true, bizRecordPageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()),
|
|
|
|
- StrUtil.toUnderlineCase(bizRecordPageParam.getSortField()));
|
|
|
|
- } else {
|
|
|
|
- queryWrapper.lambda().orderByAsc(BizRecord::getId);
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizRecordPageParam.getIsFlag())){
|
|
|
|
+ queryWrapper.eq("br.weighing_type","1");
|
|
}
|
|
}
|
|
- queryWrapper.lambda().eq(BizRecord::getDeleteFlag, CommonDeleteFlagEnum.NOT_DELETE);
|
|
|
|
- return this.page(CommonPageRequest.defaultPage(), queryWrapper);
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizRecordPageParam.getOrderName())){
|
|
|
|
+ queryWrapper.like("bo.order_name",bizRecordPageParam.getOrderName());
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizRecordPageParam.getOrderNumber())){
|
|
|
|
+ queryWrapper.like("bo.order_number",bizRecordPageParam.getOrderNumber());
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizRecordPageParam.getCustomerName())){
|
|
|
|
+ queryWrapper.like("bc.customer_name",bizRecordPageParam.getCustomerName());
|
|
|
|
+ }
|
|
|
|
+ queryWrapper.eq("br.DELETE_FLAG","NOT_DELETE");
|
|
|
|
+ queryWrapper.orderByDesc("br.create_time");
|
|
|
|
+ return queryWrapper;
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -120,6 +141,45 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
this.save(bizRecord);
|
|
this.save(bizRecord);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void push(BizRecordEditParam bizRecordEditParam) {
|
|
|
|
+ if(StringUtils.equals(bizRecordEditParam.getWeighingType(),"1")){
|
|
|
|
+ BizAppointmentRecord appointmentRecord = bizAppointmentRecordService.getById(bizRecordEditParam.getAppointmentId());
|
|
|
|
+ //一次过磅
|
|
|
|
+ BizRecord bizRecord = BeanUtil.toBean(bizRecordEditParam, BizRecord.class);
|
|
|
|
+ bizRecord.setRelationId(bizRecord.getId());
|
|
|
|
+ bizRecord.setId(null);
|
|
|
|
+ bizRecord.setAppointmentUser(appointmentRecord.getCreateUser());
|
|
|
|
+ this.save(bizRecord);
|
|
|
|
+
|
|
|
|
+ //修改预约状态
|
|
|
|
+ if(ObjectUtil.isNotNull(appointmentRecord)){
|
|
|
|
+ appointmentRecord.setStatus("6");
|
|
|
|
+ bizAppointmentRecordService.updateById(appointmentRecord);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ //二次过磅
|
|
|
|
+ BizRecord bizRecord = this.queryEntity(bizRecordEditParam.getId());
|
|
|
|
+ bizRecordEditParam.setId(null);
|
|
|
|
+ BeanUtil.copyProperties(bizRecordEditParam, bizRecord);
|
|
|
|
+ this.updateById(bizRecord);
|
|
|
|
+
|
|
|
|
+ //修改预约状态
|
|
|
|
+ BizAppointmentRecord appointmentRecord = bizAppointmentRecordService.getById(bizRecord.getAppointmentId());
|
|
|
|
+ if(ObjectUtil.isNotNull(appointmentRecord)){
|
|
|
|
+ appointmentRecord.setStatus("8");
|
|
|
|
+ bizAppointmentRecordService.updateById(appointmentRecord);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //修改订单重量
|
|
|
|
+ BizOrder bizOrder = bizOrderService.getById(bizRecord.getOrderId());
|
|
|
|
+ if(ObjectUtil.isNotNull(bizOrder)){
|
|
|
|
+ bizOrder.setNetWeight(bizOrder.getNetWeight().add(bizRecord.getNetWeight()));
|
|
|
|
+ bizOrderService.updateById(bizOrder);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
public void edit(BizRecordEditParam bizRecordEditParam) {
|
|
public void edit(BizRecordEditParam bizRecordEditParam) {
|
|
@@ -151,44 +211,13 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void export(BizRecordExportParam exportParam, HttpServletResponse response) throws IOException {
|
|
|
|
|
|
+ public void export(BizRecordPageParam exportParam, HttpServletResponse response) throws IOException {
|
|
File tempFile = null;
|
|
File tempFile = null;
|
|
try {
|
|
try {
|
|
- QueryWrapper<BizRecord> queryWrapper = new QueryWrapper<BizRecord>().checkSqlInjection();
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getLicensePlate())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getLicensePlate, exportParam.getLicensePlate());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getStartGrossTime()) && ObjectUtil.isNotEmpty(exportParam.getEndGrossTime())) {
|
|
|
|
- queryWrapper.lambda().between(BizRecord::getGrossTime, exportParam.getStartGrossTime(), exportParam.getEndGrossTime());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getStartTareTime()) && ObjectUtil.isNotEmpty(exportParam.getEndTareTime())) {
|
|
|
|
- queryWrapper.lambda().between(BizRecord::getTareTime, exportParam.getStartTareTime(), exportParam.getEndTareTime());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getDriverName())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getDriverName, exportParam.getDriverName());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getDriverMobile())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getDriverMobile, exportParam.getDriverMobile());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getGoodsName())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getGoodsName, exportParam.getGoodsName());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getGoodsModel())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getGoodsModel, exportParam.getGoodsModel());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getReceiptCompany())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getReceiptCompany, exportParam.getReceiptCompany());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getShippingCompany())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getShippingCompany, exportParam.getShippingCompany());
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotEmpty(exportParam.getTransportCompany())) {
|
|
|
|
- queryWrapper.lambda().like(BizRecord::getTransportCompany, exportParam.getTransportCompany());
|
|
|
|
- }
|
|
|
|
- queryWrapper.lambda().orderByDesc(BizRecord::getGrossTime);
|
|
|
|
|
|
+ QueryWrapper<BizRecord> queryWrapper = getQueryWrapper(exportParam);
|
|
String fileName = "过磅记录导出.xlsx";
|
|
String fileName = "过磅记录导出.xlsx";
|
|
- List<BizRecord> recordList = this.baseMapper.selectList(queryWrapper);
|
|
|
|
- //List<BizRecord> list = this.getBaseMapper().selectList(queryWrapper);
|
|
|
|
|
|
+ //List<BizRecord> recordList = this.baseMapper.selectList(queryWrapper);
|
|
|
|
+ List<BizRecord> recordList = this.getBaseMapper().getPage(queryWrapper);
|
|
if (ObjectUtil.isEmpty(recordList)) {
|
|
if (ObjectUtil.isEmpty(recordList)) {
|
|
throw new CommonException("无数据可导出");
|
|
throw new CommonException("无数据可导出");
|
|
}
|
|
}
|
|
@@ -467,4 +496,19 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
CommonResponseUtil.renderError(response, e.getMessage());
|
|
CommonResponseUtil.renderError(response, e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void confirmRecord(BizRecordIdParam bizRecordIdParam) {
|
|
|
|
+ //设置确认人
|
|
|
|
+ BizRecord bizRecord = this.queryEntity(bizRecordIdParam.getId());
|
|
|
|
+ bizRecord.setConfirmUser(StpLoginUserUtil.getLoginUser().getName());
|
|
|
|
+ this.updateById(bizRecord);
|
|
|
|
+
|
|
|
|
+ //预约记录修改成完成装货
|
|
|
|
+ BizAppointmentRecord appointmentRecord = bizAppointmentRecordService.getById(bizRecord.getAppointmentId());
|
|
|
|
+ if(ObjectUtil.isNotNull(appointmentRecord)){
|
|
|
|
+ appointmentRecord.setStatus("7");
|
|
|
|
+ bizAppointmentRecordService.updateById(appointmentRecord);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|