Compare commits

..

No commits in common. "ae788be25b880bd97aff70cc77c0838e768af8c8" and "998c81680feddc302d3372337f837e2656d1956e" have entirely different histories.

20 changed files with 50 additions and 323 deletions

12
.gitignore vendored
View File

@ -1,12 +0,0 @@
## ide
**/.idea
*.iml
rebel.xml
## backend
**/target
**/logs
*/logs
## front
**/*.lock

View File

@ -147,8 +147,7 @@ spring:
#redis 配置 #redis 配置
redis: redis:
database: 0 database: 0
# host: 123.57.206.181 host: 123.57.206.181
host: localhost
port: 6379 port: 6379
password: '' password: ''
#mybatis plus 设置 #mybatis plus 设置

View File

@ -1,5 +1,5 @@
server: server:
port: 9001 port: 8080
tomcat: tomcat:
max-swallow-size: -1 max-swallow-size: -1
error: error:
@ -110,7 +110,7 @@ spring:
# 初始化大小,最小,最大 # 初始化大小,最小,最大
initial-size: 5 initial-size: 5
min-idle: 5 min-idle: 5
maxActive: 20 maxActive: 1000
# 配置获取连接等待超时的时间 # 配置获取连接等待超时的时间
maxWait: 60000 maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
@ -130,14 +130,10 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource: datasource:
master: master:
# url: jdbc:mysql://114.215.188.164:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# username: root username: root
# password: 123456 password: root
# driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:oracle:thin:@123.57.206.181:1521/ORCLPDB1
username: SDKTMS
password: SDKTMS
driver-class-name: oracle.jdbc.OracleDriver
# 多数据源配置 # 多数据源配置
#multi-datasource1: #multi-datasource1:
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
@ -147,7 +143,7 @@ spring:
#redis 配置 #redis 配置
redis: redis:
database: 0 database: 0
host: 123.57.206.181 host: 127.0.0.1
port: 6379 port: 6379
password: '' password: ''
#mybatis plus 设置 #mybatis plus 设置
@ -176,32 +172,33 @@ jeecg:
signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
# 签名拦截接口 # 签名拦截接口
signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys
#local、minio、alioss #local\minio\alioss
uploadType: local uploadType: alioss
# 前端访问地址 # 前端访问地址
domainUrl: domainUrl:
pc: http://localhost:3100 pc: http://localhost:3100
app: http://localhost:8051 app: http://localhost:8051
path: path:
#文件上传根目录 设置 #文件上传根目录 设置
upload: /opt/upFiles upload: /opt/jeecg-boot/upload
#webapp文件路径 #webapp文件路径
webapp: /opt/webapp webapp: /opt/jeecg-boot/webapp
shiro: shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/** excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
#阿里云oss存储和大鱼短信秘钥配置 #阿里云oss存储和大鱼短信秘钥配置
oss: oss:
accessKey: ?? accessKey: ??
secretKey: ?? secretKey: ??
endpoint: oss-cn-beijing.aliyuncs.com endpoint: oss-cn-beijing.aliyuncs.com
bucketName: jeecgdev bucketName: jeecgdev
# ElasticSearch 6设置 staticDomain: https://static.jeecg.com
# ElasticSearch 设置
elasticsearch: elasticsearch:
cluster-name: jeecg-ES cluster-name: jeecg-ES
cluster-nodes: 127.0.0.1:9200 cluster-nodes: 127.0.0.1:9200
check-enabled: false check-enabled: true
# 在线预览文件服务器地址配置 # 在线预览文件服务器地址配置
file-view-domain: 127.0.0.1:8012 file-view-domain: http://fileview.jeecg.com
# minio文件上传 # minio文件上传
minio: minio:
minio_url: http://minio.jeecg.com minio_url: http://minio.jeecg.com
@ -210,7 +207,7 @@ jeecg:
bucketName: otatest bucketName: otatest
#大屏报表参数设置 #大屏报表参数设置
jmreport: jmreport:
mode: dev mode: prod
#数据字典是否进行saas数据隔离自己看自己的字典 #数据字典是否进行saas数据隔离自己看自己的字典
saas: false saas: false
#是否需要校验token #是否需要校验token
@ -248,7 +245,7 @@ knife4j:
#开启生产环境屏蔽 #开启生产环境屏蔽
production: false production: false
basic: basic:
enable: false enable: true
username: jeecg username: jeecg
password: jeecg1314 password: jeecg1314
#第三方登录 #第三方登录

View File

@ -4,8 +4,10 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ -84,7 +86,7 @@ public class TmsIogisticsPrice implements Serializable {
/**车长*/ /**车长*/
@Excel(name = "车长", width = 15) @Excel(name = "车长", width = 15)
@ApiModelProperty(value = "车长") @ApiModelProperty(value = "车长")
private java.lang.Double carLong; private java.lang.Integer carLong;
/**装卸吨位*/ /**装卸吨位*/
@Excel(name = "装卸吨位", width = 15) @Excel(name = "装卸吨位", width = 15)
@ApiModelProperty(value = "装卸吨位") @ApiModelProperty(value = "装卸吨位")
@ -123,7 +125,4 @@ public class TmsIogisticsPrice implements Serializable {
@Excel(name = "时效", width = 15) @Excel(name = "时效", width = 15)
@ApiModelProperty(value = "时效") @ApiModelProperty(value = "时效")
private java.lang.String validity; private java.lang.String validity;
/**托数*/
@TableField(exist = false)
private java.lang.Integer maxPallets;
} }

View File

@ -14,12 +14,4 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface TmsIogisticsPriceMapper extends BaseMapper<TmsIogisticsPrice> { public interface TmsIogisticsPriceMapper extends BaseMapper<TmsIogisticsPrice> {
/**
* 查询物流价格信息
* @param pickUpHub 起始城市
* @param deliveryAddress 目标城市
* @return
*/
List<TmsIogisticsPrice> getIogisticsPrice(@Param("pickUpHub") String pickUpHub,
@Param("deliveryAddress") String deliveryAddress);
} }

View File

@ -2,11 +2,4 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.tms.basicdata.iogisticsprice.mapper.TmsIogisticsPriceMapper"> <mapper namespace="org.jeecg.modules.tms.basicdata.iogisticsprice.mapper.TmsIogisticsPriceMapper">
<select id="getIogisticsPrice" resultType="org.jeecg.modules.tms.basicdata.iogisticsprice.entity.TmsIogisticsPrice">
select a.*, b.max_pallets from tms_iogistics_price a left join tms_vehicle_pallet b
on a.car_type = b.car_type
and a.car_long = b.car_long
where a.start_city = #{pickUpHub}
and a.target_city = #{deliveryAddress}
</select>
</mapper> </mapper>

View File

@ -83,8 +83,6 @@ public class LogisticsRouteController extends JeecgController<LogisticsRoute, IL
//@RequiresPermissions("org.jeecg.modules.tms:tms_logistics_route:add") //@RequiresPermissions("org.jeecg.modules.tms:tms_logistics_route:add")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody LogisticsRoute logisticsRoute) { public Result<String> add(@RequestBody LogisticsRoute logisticsRoute) {
logisticsRoute.setRoute(logisticsRoute.getStartCity() + "--->" +
logisticsRoute.getTargetCity());
logisticsRouteService.save(logisticsRoute); logisticsRouteService.save(logisticsRoute);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@ -100,8 +98,6 @@ public class LogisticsRouteController extends JeecgController<LogisticsRoute, IL
//@RequiresPermissions("org.jeecg.modules.tms:tms_logistics_route:edit") //@RequiresPermissions("org.jeecg.modules.tms:tms_logistics_route:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody LogisticsRoute logisticsRoute) { public Result<String> edit(@RequestBody LogisticsRoute logisticsRoute) {
logisticsRoute.setRoute(logisticsRoute.getStartCity() + "--->" +
logisticsRoute.getTargetCity());
logisticsRouteService.updateById(logisticsRoute); logisticsRouteService.updateById(logisticsRoute);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }
@ -178,28 +174,4 @@ public class LogisticsRouteController extends JeecgController<LogisticsRoute, IL
return super.importExcel(request, response, LogisticsRoute.class); return super.importExcel(request, response, LogisticsRoute.class);
} }
/**
* 查询城市
* @return
*/
@GetMapping(value = "/getCity")
public Result<?> getCity() {
List<LogisticsRoute> list = logisticsRouteService.list();
List<String> strings = list.stream().map(s -> s.getStartCity() + "&-" + s.getTargetCity())
.distinct().collect(Collectors.toList());
return Result.OK(strings);
}
/**
* 查询区域城市
* @return
*/
@GetMapping(value = "/getAreaCity")
public Result<?> getAreaCity() {
List<LogisticsRoute> list = logisticsRouteService.list();
List<String> strings = list.stream().map(s -> s.getStartArea() + "&-" + s.getStartCity() + "&-" +
s.getTargetArea() + "&-" + s.getTargetCity() + "&-" + s.getRoute() + "&-" + s.getKilometers())
.distinct().collect(Collectors.toList());
return Result.OK(strings);
}
} }

View File

@ -12,7 +12,6 @@ import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.tms.basicdata.logisticsroute.entity.LogisticsRoute;
import org.jeecg.modules.tms.basicdata.vehicleoperator.entity.TmsVehicleOperator; import org.jeecg.modules.tms.basicdata.vehicleoperator.entity.TmsVehicleOperator;
import org.jeecg.modules.tms.basicdata.vehicleoperator.service.ITmsVehicleOperatorService; import org.jeecg.modules.tms.basicdata.vehicleoperator.service.ITmsVehicleOperatorService;
@ -175,15 +174,4 @@ public class TmsVehicleOperatorController extends JeecgController<TmsVehicleOper
return super.importExcel(request, response, TmsVehicleOperator.class); return super.importExcel(request, response, TmsVehicleOperator.class);
} }
/**
* 查询供应商编码名称
* @return
*/
@GetMapping(value = "/getSupplierCodeName")
public Result<?> getSupplierCodeName() {
List<TmsVehicleOperator> list = tmsVehicleOperatorService.list();
List<String> strings = list.stream().map(s -> s.getSupplierCode() + "&-" + s.getSupplierName())
.distinct().collect(Collectors.toList());
return Result.OK(strings);
}
} }

View File

@ -12,7 +12,6 @@ import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.tms.basicdata.logisticsroute.entity.LogisticsRoute;
import org.jeecg.modules.tms.basicdata.vehiclepallet.entity.VehiclePallet; import org.jeecg.modules.tms.basicdata.vehiclepallet.entity.VehiclePallet;
import org.jeecg.modules.tms.basicdata.vehiclepallet.service.IVehiclePalletService; import org.jeecg.modules.tms.basicdata.vehiclepallet.service.IVehiclePalletService;
@ -175,25 +174,9 @@ public class VehiclePalletController extends JeecgController<VehiclePallet, IVeh
return super.importExcel(request, response, VehiclePallet.class); return super.importExcel(request, response, VehiclePallet.class);
} }
/**
* 查询车型
* @return
*/
@GetMapping("getCarType") @GetMapping("getCarType")
public Result<?> getCarType() { public Result<?> getCarType() {
List<String> cars = vehiclePalletService.getCarType(); List<String> cars = vehiclePalletService.getCarType();
return Result.ok(cars); return Result.ok(cars);
} }
/**
* 拆线呢车型车长
* @return
*/
@GetMapping(value = "/getCarTypeLong")
public Result<?> getCarTypeLong() {
List<VehiclePallet> list = vehiclePalletService.list();
List<String> strings = list.stream().map(s -> s.getCarType() + "&-" + s.getCarLong())
.distinct().collect(Collectors.toList());
return Result.OK(strings);
}
} }

View File

@ -55,7 +55,7 @@ public class VehiclePallet implements Serializable {
/**车长*/ /**车长*/
@Excel(name = "车长", width = 15) @Excel(name = "车长", width = 15)
@ApiModelProperty(value = "车长") @ApiModelProperty(value = "车长")
private java.lang.Double carLong; private java.lang.Integer carLong;
/**托数*/ /**托数*/
@Excel(name = "托数", width = 15) @Excel(name = "托数", width = 15)
@ApiModelProperty(value = "托数") @ApiModelProperty(value = "托数")

View File

@ -12,7 +12,6 @@ import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.tms.basicdata.logisticsroute.entity.LogisticsRoute;
import org.jeecg.modules.tms.basicdata.vehicleproduct.entity.TmsVehicleProduct; import org.jeecg.modules.tms.basicdata.vehicleproduct.entity.TmsVehicleProduct;
import org.jeecg.modules.tms.basicdata.vehicleproduct.service.ITmsVehicleProductService; import org.jeecg.modules.tms.basicdata.vehicleproduct.service.ITmsVehicleProductService;
@ -175,11 +174,4 @@ public class TmsVehicleProductController extends JeecgController<TmsVehicleProdu
return super.importExcel(request, response, TmsVehicleProduct.class); return super.importExcel(request, response, TmsVehicleProduct.class);
} }
@GetMapping(value = "/getPnSpecList")
public Result<?> getPnSpecList() {
List<TmsVehicleProduct> list = tmsVehicleProductService.list();
List<String> strings = list.stream().map(s -> s.getPn() + "&-" + s.getSpec())
.distinct().collect(Collectors.toList());
return Result.OK(strings);
}
} }

View File

@ -1,7 +1,6 @@
package org.jeecg.modules.tms.carinout.vehicleinout.controller; package org.jeecg.modules.tms.carinout.vehicleinout.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -177,11 +176,6 @@ public class VehicleInOutController extends JeecgController<VehicleInOut, IVehic
@PostMapping(value = "/handleConfirm") @PostMapping(value = "/handleConfirm")
public Result<String> handleConfirm(@RequestBody VehicleInOut vehicleInOut) { public Result<String> handleConfirm(@RequestBody VehicleInOut vehicleInOut) {
if ("3".equals(vehicleInOut.getCurrentStatus())) {
vehicleInOut.setAtaTime(new Date());
} else if ("4".equals(vehicleInOut.getCurrentStatus())) {
vehicleInOut.setAtdTime(new Date());
}
vehicleInOutService.updateById(vehicleInOut); vehicleInOutService.updateById(vehicleInOut);
return Result.OK("操作成功!"); return Result.OK("操作成功!");
} }

View File

@ -88,7 +88,7 @@ public class VehicleInOut implements Serializable {
@Excel(name = "司机电话", width = 15) @Excel(name = "司机电话", width = 15)
@ApiModelProperty(value = "司机电话") @ApiModelProperty(value = "司机电话")
private java.lang.String driverTel; private java.lang.String driverTel;
/**当前状态 创建-0,对接人确认-1,预约入厂-2,审核入库-3,审核出厂-4*/ /**当前状态*/
@Excel(name = "当前状态", width = 15, dicCode = "currentStatus") @Excel(name = "当前状态", width = 15, dicCode = "currentStatus")
@Dict(dicCode = "currentStatus") @Dict(dicCode = "currentStatus")
@ApiModelProperty(value = "当前状态") @ApiModelProperty(value = "当前状态")

View File

@ -201,24 +201,9 @@ public class DeliveryDemandController extends JeecgController<DeliveryDemand, ID
return deliveryDemandService.handleMerge(ids); return deliveryDemandService.handleMerge(ids);
} }
/**
* 根据料号规格发货数量计算托盘数
* @param deliveryDemand
* @return
*/
@PostMapping("/getPalletsNum") @PostMapping("/getPalletsNum")
public Result<?> getPalletsNum(@RequestBody DeliveryDemand deliveryDemand) { public Result<?> getPalletsNum(@RequestBody DeliveryDemand deliveryDemand) {
return deliveryDemandService.getPalletsNum(deliveryDemand); return deliveryDemandService.getPalletsNum(deliveryDemand);
} }
/**
* 通过用车需求编号查询用车需求物料明细
* @param vdNo
* @return
*/
@GetMapping(value = "/getByVdNo")
public Result<?> getByVdNo(@RequestParam(name="vdNo",required=true) String vdNo) {
List<DeliveryDemand> vdNos = deliveryDemandService.query().eq("vd_no", vdNo).list();
return Result.OK(vdNos);
}
} }

View File

@ -1,19 +0,0 @@
package org.jeecg.modules.tms.outbound.vehicledemand.entity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Map;
/**
* @Description
* @Author admin
* @Date 2025/4/23 9:12
*/
@Data
public class Solution {
/**方案*/
Map<String, Integer> vehicleCounts;
/**成本*/
BigDecimal totalCost;
}

View File

@ -3,13 +3,9 @@ package org.jeecg.modules.tms.outbound.vehicledemand.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.tms.basicdata.iogisticsprice.entity.TmsIogisticsPrice;
import org.jeecg.modules.tms.basicdata.iogisticsprice.mapper.TmsIogisticsPriceMapper;
import org.jeecg.modules.tms.basicdata.vehiclepallet.entity.VehiclePallet; import org.jeecg.modules.tms.basicdata.vehiclepallet.entity.VehiclePallet;
import org.jeecg.modules.tms.basicdata.vehiclepallet.mapper.VehiclePalletMapper; import org.jeecg.modules.tms.basicdata.vehiclepallet.mapper.VehiclePalletMapper;
import org.jeecg.modules.tms.outbound.vehicledemand.entity.Solution;
import org.jeecg.modules.tms.outbound.vehicledemand.entity.VehicleDemand; import org.jeecg.modules.tms.outbound.vehicledemand.entity.VehicleDemand;
import org.jeecg.modules.tms.outbound.vehicledemand.mapper.VehicleDemandMapper; import org.jeecg.modules.tms.outbound.vehicledemand.mapper.VehicleDemandMapper;
import org.jeecg.modules.tms.outbound.vehicledemand.service.IVehicleDemandService; import org.jeecg.modules.tms.outbound.vehicledemand.service.IVehicleDemandService;
@ -19,8 +15,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.math.BigDecimal; import java.util.ArrayList;
import java.util.*; import java.util.List;
/** /**
* @Description: 用车需求 * @Description: 用车需求
@ -28,149 +24,14 @@ import java.util.*;
* @Date: 2025-04-11 * @Date: 2025-04-11
* @Version: V1.0 * @Version: V1.0
*/ */
@Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, VehicleDemand> implements IVehicleDemandService { public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, VehicleDemand> implements IVehicleDemandService {
private final VehiclePalletMapper vehiclePalletMapper; private final VehiclePalletMapper vehiclePalletMapper;
private final IVehicleDemandCountService vehicleDemandCountService; private final IVehicleDemandCountService vehicleDemandCountService;
private final TmsIogisticsPriceMapper iogisticsPriceMapper;
@Override @Override
public Result<?> carCount(VehicleDemand vehicleDemand) {
// 1.判断是否进行过用车计算
LambdaQueryWrapper<VehicleDemandCount> countLambdaQueryWrapper = new LambdaQueryWrapper<>();
countLambdaQueryWrapper.eq(VehicleDemandCount::getVdNo, vehicleDemand.getVdNo());
List<VehicleDemandCount> list = vehicleDemandCountService.list(countLambdaQueryWrapper);
// 1.1.进行过
if (list != null && list.size() > 0) {
return Result.error("已经进行过用车计算了!");
}
// 2.查询物流价格信息(从起始城市到目标城市各种车型的价格)
List<TmsIogisticsPrice> iogisticsPriceList = iogisticsPriceMapper.getIogisticsPrice(
vehicleDemand.getPickUpHub(),
vehicleDemand.getDeliveryAddress());
if (iogisticsPriceList == null || iogisticsPriceList.size() <= 0) {
return Result.error("没有符合的物流价格基础信息,请维护!");
}
// 3.查找费用最低的方案
// Map<String, Integer> vehicleCounts;
// String: 由车型与车长组成以逗号分隔
// Integer: 该种车型与车长选择的数量
Solution solution = findCheapestSolution(iogisticsPriceList, vehicleDemand.getTotalPallets());
// 打印方便查看开发时可以打开
/*for (Map.Entry<String, Integer> entry : solution.getVehicleCounts().entrySet()) {
System.out.println(entry.getKey() + " 车: " + entry.getValue() + "");
}*/
// 4.转化集合
List<VehicleDemandCount> vehicleDemandCounts = convertToVehicleDemandCountList(solution.getVehicleCounts(), vehicleDemand);
// 5.新增
vehicleDemandCountService.saveBatch(vehicleDemandCounts);
log.info("用车需求计算,用车需求编号:{},方案:{},费用:{}",vehicleDemand.getVdNo(),
solution.getVehicleCounts(),solution.getTotalCost());
return Result.OK("用车计算成功!");
}
/**
* 查找费用最低的方案
*/
private Solution findCheapestSolution(List<TmsIogisticsPrice> iogisticsPriceList, Integer totalPallets) {
// dp[i] 表示运送 i 托盘时的最小成本
BigDecimal[] dp = new BigDecimal[totalPallets + 1];
Arrays.fill(dp, BigDecimal.valueOf(Integer.MAX_VALUE));
dp[0] = BigDecimal.ZERO;
// 记录每种状态下的车辆选择
Map<Integer, Map<String, Integer>> choices = new HashMap<>();
for (int i = 0; i <= totalPallets; i++) {
choices.put(i, new HashMap<>());
}
// 动态规划填表
for (int i = 0; i <= totalPallets; i++) {
if (dp[i].compareTo(BigDecimal.valueOf(Integer.MAX_VALUE)) == 0) continue; // 如果当前状态不可达跳过
for (TmsIogisticsPrice iogisticsPrice : iogisticsPriceList) {
int next = i + iogisticsPrice.getMaxPallets();
if (next > totalPallets) next = totalPallets; // 不超过总托盘数
BigDecimal newCost = dp[i].add(iogisticsPrice.getTandardPrice());
if (newCost.compareTo(dp[next]) < 0 ) { // 如果新成本更低则更新
dp[next] = newCost;
// 更新车辆选择
Map<String, Integer> newChoices = new HashMap<>(choices.get(i));
newChoices.put(iogisticsPrice.getCarType() + "," +iogisticsPrice.getCarLong(), newChoices.getOrDefault(iogisticsPrice.getCarType() + "," +iogisticsPrice.getCarLong(), 0) + 1);
choices.put(next, newChoices);
}
}
}
// choices.get(totalPallets):选择的方案, dp[totalPallets]费用
Solution solution = new Solution();
solution.setVehicleCounts(choices.get(totalPallets));
solution.setTotalCost(dp[totalPallets]);
return solution;
}
/**
* 转化集合
* @param vehicleCounts
* @return
*/
private List<VehicleDemandCount> convertToVehicleDemandCountList(Map<String, Integer> vehicleCounts,
VehicleDemand vehicleDemand) {
List<VehicleDemandCount> resultList = new ArrayList<>();
// 遍历 solution.getVehicleCounts()
for (Map.Entry<String, Integer> entry : vehicleCounts.entrySet()) {
String key = entry.getKey(); // 键格式为 "车类型,车长度"
int count = entry.getValue(); // 车辆数量
// 解析车类型和车长度
String[] parts = key.split(",");
/*if (parts.length != 2) {
throw new IllegalArgumentException("键格式错误: " + key);
}*/
String carType = parts[0]; // 车类型
double carLong = Double.parseDouble(parts[1]); // 车长度
// 根据车辆数量生成多条记录
for (int i = 0; i < count; i++) {
VehicleDemandCount vehicleDemandCount = new VehicleDemandCount();
vehicleDemandCount.setCarType(carType)
.setCarLong(carLong)
.setVdNo(vehicleDemand.getVdNo())
.setShipType(vehicleDemand.getShipType())
.setDeliveryAddress(vehicleDemand.getDeliveryAddress())
.setPickUpHub(vehicleDemand.getPickUpHub());
resultList.add(vehicleDemandCount);
}
}
return resultList;
}
/**
* 拼凑一个用车需求计算的集合
* @param vehicleDemand
* @param vehiclePallet
* @param vehicleDemandCounts
*/
/*private void insertVehicleDemandCount(VehicleDemand vehicleDemand, VehiclePallet vehiclePallet, List<VehicleDemandCount> vehicleDemandCounts) {
VehicleDemandCount vehicleDemandCount = new VehicleDemandCount();
vehicleDemandCount.setVdNo(vehicleDemand.getVdNo())
.setShipType(vehicleDemand.getShipType())
.setDeliveryArea(vehicleDemand.getDeliveryArea())
.setDeliveryAddress(vehicleDemand.getDeliveryAddress())
.setPickUpHub(vehicleDemand.getPickUpHub())
.setCarType(vehiclePallet.getCarType())
.setCarLong(vehiclePallet.getCarLong());
vehicleDemandCounts.add(vehicleDemandCount);
}*/
/* 原来的用车计算方法
public Result<?> carCount(VehicleDemand vehicleDemand) { public Result<?> carCount(VehicleDemand vehicleDemand) {
// 1.判断是否进行过用车计算 // 1.判断是否进行过用车计算
LambdaQueryWrapper<VehicleDemandCount> countLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<VehicleDemandCount> countLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -209,5 +70,23 @@ public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, V
vehicleDemandCountService.saveBatch(vehicleDemandCounts); vehicleDemandCountService.saveBatch(vehicleDemandCounts);
System.out.println(ids); System.out.println(ids);
return Result.OK("用车计算成功!"); return Result.OK("用车计算成功!");
}*/ }
/**
* 拼凑一个用车需求计算的集合
* @param vehicleDemand
* @param vehiclePallet
* @param vehicleDemandCounts
*/
private void insertVehicleDemandCount(VehicleDemand vehicleDemand, VehiclePallet vehiclePallet, List<VehicleDemandCount> vehicleDemandCounts) {
VehicleDemandCount vehicleDemandCount = new VehicleDemandCount();
vehicleDemandCount.setVdNo(vehicleDemand.getVdNo())
.setShipType(vehicleDemand.getShipType())
.setDeliveryArea(vehicleDemand.getDeliveryArea())
.setDeliveryAddress(vehicleDemand.getDeliveryAddress())
.setPickUpHub(vehicleDemand.getPickUpHub())
.setCarType(vehiclePallet.getCarType())
.setCarLong(vehiclePallet.getCarLong());
vehicleDemandCounts.add(vehicleDemandCount);
}
} }

View File

@ -9,8 +9,6 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
@ -176,17 +174,4 @@ public class VehicleDemandCountController extends JeecgController<VehicleDemandC
return super.importExcel(request, response, VehicleDemandCount.class); return super.importExcel(request, response, VehicleDemandCount.class);
} }
/**
* 通过用车需求编号查询用车需求计算
* @param vdNo
* @return
*/
@GetMapping(value = "/getByVdNo")
public Result<?> getByVdNo(@RequestParam(name="vdNo",required=true) String vdNo) {
List<VehicleDemandCount> vdNos = vehicleDemandCountService.query().eq("vd_no", vdNo).list();
IPage<VehicleDemandCount> page = new Page<>(1, vdNos.size());
page.setRecords(vdNos);
page.setTotal(vdNos.size());
return Result.OK(page);
}
} }

View File

@ -71,7 +71,7 @@ public class VehicleDemandCount implements Serializable {
/**车长*/ /**车长*/
@Excel(name = "车长", width = 15) @Excel(name = "车长", width = 15)
@ApiModelProperty(value = "车长") @ApiModelProperty(value = "车长")
private java.lang.Double carLong; private java.lang.Integer carLong;
/**送货区域*/ /**送货区域*/
@Excel(name = "送货区域", width = 15) @Excel(name = "送货区域", width = 15)
@ApiModelProperty(value = "送货区域") @ApiModelProperty(value = "送货区域")

View File

@ -33,7 +33,7 @@
<ojdbc6.version>11.2.0.3</ojdbc6.version> <ojdbc6.version>11.2.0.3</ojdbc6.version>
<ojdbc8.version>19.3.0.0</ojdbc8.version> <ojdbc8.version>19.3.0.0</ojdbc8.version>
<sqljdbc4.version>4.0</sqljdbc4.version> <sqljdbc4.version>4.0</sqljdbc4.version>
<mysql-connector-java.version>8.0.28</mysql-connector-java.version> <mysql-connector-java.version>8.0.27</mysql-connector-java.version>
<hutool.version>5.8.25</hutool.version> <hutool.version>5.8.25</hutool.version>
<!-- 持久层 --> <!-- 持久层 -->