feat(work): 实现订单指派时自动改价功能
在订单指派给设计师时,自动计算改价金额。使用jsPrice或price作为基准价,按10%比例计算改价,结果四舍五入到最接近的10的倍数。同时更新多个配置文件以适配新环境。
This commit is contained in:
BIN
ruoyi-admin/.DS_Store
vendored
Normal file
BIN
ruoyi-admin/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -127,6 +127,10 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<version>${spring-boot.version}</version>
|
<version>${spring-boot.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<fork>true</fork>
|
||||||
|
<addResources>true</addResources>
|
||||||
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
|||||||
@@ -8,25 +8,25 @@ spring.boot.admin.client:
|
|||||||
metadata:
|
metadata:
|
||||||
username: ${spring.boot.admin.client.username}
|
username: ${spring.boot.admin.client.username}
|
||||||
userpassword: ${spring.boot.admin.client.password}
|
userpassword: ${spring.boot.admin.client.password}
|
||||||
username: @monitor.username@
|
username: admin
|
||||||
password: @monitor.password@
|
password: admin
|
||||||
|
|
||||||
--- # snail-job 配置
|
#--- # snail-job 配置
|
||||||
snail-job:
|
#snail-job:
|
||||||
enabled: false
|
# enabled: false
|
||||||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
# # 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||||
group: "ruoyi_group"
|
# group: "ruoyi_group"
|
||||||
# SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表
|
# # SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表
|
||||||
token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT"
|
# token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT"
|
||||||
server:
|
# server:
|
||||||
host: 127.0.0.1
|
# host: 127.0.0.1
|
||||||
port: 17888
|
# port: 17888
|
||||||
# 详见 script/sql/snail_job.sql `sj_namespace` 表
|
# # 详见 script/sql/snail_job.sql `sj_namespace` 表
|
||||||
namespace: ${spring.profiles.active}
|
# namespace: ${spring.profiles.active}
|
||||||
# 随主应用端口飘逸
|
# # 随主应用端口飘逸
|
||||||
port: 2${server.port}
|
# port: 2${server.port}
|
||||||
# 客户端ip指定
|
# # 客户端ip指定
|
||||||
host: 127.0.0.1
|
# host: 127.0.0.1
|
||||||
|
|
||||||
--- # 数据源配置
|
--- # 数据源配置
|
||||||
spring:
|
spring:
|
||||||
@@ -47,22 +47,18 @@ spring:
|
|||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://192.168.1.203:3306/oademo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
|
url: jdbc:mysql://220.205.16.51:23306/oademo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: oademo
|
username: oademo
|
||||||
password: 68i5XDFNXwWX2Fxd
|
password: djj7z3dY6YkSEzeS
|
||||||
|
|
||||||
# url: jdbc:mysql://localhost:13306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
|
||||||
# username: root
|
|
||||||
# password: root
|
|
||||||
|
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
lazy: false
|
lazy: false
|
||||||
type: ${spring.datasource.type}
|
type: ${spring.datasource.type}
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://jcs-mysql.52o.site:13306/erpdemo20260109?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://220.205.16.51:23306/oademo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: erpdemo20260109
|
username: oademo
|
||||||
password: s5y46y76P2S5753T
|
password: djj7z3dY6YkSEzeS
|
||||||
|
|
||||||
hikari:
|
hikari:
|
||||||
# 最大连接池数量
|
# 最大连接池数量
|
||||||
@@ -107,7 +103,7 @@ redisson:
|
|||||||
# 单节点配置
|
# 单节点配置
|
||||||
singleServerConfig:
|
singleServerConfig:
|
||||||
# 客户端名称
|
# 客户端名称
|
||||||
clientName: ${ruoyi.name}
|
clientName: XGT-ADMIN
|
||||||
# 最小空闲连接数
|
# 最小空闲连接数
|
||||||
connectionMinimumIdleSize: 8
|
connectionMinimumIdleSize: 8
|
||||||
# 连接池大小
|
# 连接池大小
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ spring.boot.admin.client:
|
|||||||
metadata:
|
metadata:
|
||||||
username: ${spring.boot.admin.client.username}
|
username: ${spring.boot.admin.client.username}
|
||||||
userpassword: ${spring.boot.admin.client.password}
|
userpassword: ${spring.boot.admin.client.password}
|
||||||
username: @monitor.username@
|
username: admin
|
||||||
password: @monitor.password@
|
password: admin
|
||||||
|
|
||||||
--- # snail-job 配置
|
--- # snail-job 配置
|
||||||
snail-job:
|
snail-job:
|
||||||
@@ -50,9 +50,9 @@ spring:
|
|||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://220.205.16.51:23306/oademo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: sjzx0618
|
username: oademo
|
||||||
password: 2b1%Hk3#1Uolol
|
password: djj7z3dY6YkSEzeS
|
||||||
|
|
||||||
# url: jdbc:mysql://localhost:13306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
# url: jdbc:mysql://localhost:13306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
# username: root
|
# username: root
|
||||||
@@ -63,9 +63,9 @@ spring:
|
|||||||
lazy: false
|
lazy: false
|
||||||
type: ${spring.datasource.type}
|
type: ${spring.datasource.type}
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://jcs-mysql.52o.site:13306/erpdemo20260109?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://220.205.16.51:23306/oademo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: erpdemo20260109
|
username: oademo
|
||||||
password: s5y46y76P2S5753T
|
password: djj7z3dY6YkSEzeS
|
||||||
|
|
||||||
# url: jdbc:mysql://localhost:3306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
# url: jdbc:mysql://localhost:3306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
# username: root
|
# username: root
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ ruoyi:
|
|||||||
# 名称
|
# 名称
|
||||||
name: XGT-ADMIN
|
name: XGT-ADMIN
|
||||||
# 版本
|
# 版本
|
||||||
version: ${revision}
|
version: 5.2.3
|
||||||
# 版权年份
|
# 版权年份
|
||||||
copyrightYear: 2024
|
copyrightYear: 2024
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ server:
|
|||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
org.dromara: @logging.level@
|
org.dromara: info
|
||||||
org.springframework: warn
|
org.springframework: warn
|
||||||
org.mybatis.spring.mapper: error
|
org.mybatis.spring.mapper: error
|
||||||
org.apache.fury: warn
|
org.apache.fury: warn
|
||||||
@@ -71,7 +71,7 @@ spring:
|
|||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
basename: i18n/messages
|
basename: i18n/messages
|
||||||
profiles:
|
profiles:
|
||||||
active: @profiles.active@
|
active: dev
|
||||||
# 文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
@@ -200,11 +200,11 @@ springdoc:
|
|||||||
# persistAuthorization: true
|
# persistAuthorization: true
|
||||||
info:
|
info:
|
||||||
# 标题
|
# 标题
|
||||||
title: '标题:${ruoyi.name}效果图业务系统_接口文档'
|
title: '标题:若依效果图业务系统_接口文档'
|
||||||
# 描述
|
# 描述
|
||||||
description: '描述:效果图业务系统接口文档'
|
description: '描述:效果图业务系统接口文档'
|
||||||
# 版本
|
# 版本
|
||||||
version: '版本号: ${ruoyi.version}'
|
version: '版本号: 5.2.3'
|
||||||
# 作者信息
|
# 作者信息
|
||||||
contact:
|
contact:
|
||||||
name: Maosw
|
name: Maosw
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Application Version: ${revision}
|
Application Version: 5.2.3
|
||||||
Spring Boot Version: ${spring-boot.version}
|
Spring Boot Version: ${spring-boot.version}
|
||||||
__________ _____.___.__ ____ ____ __________.__
|
__________ _____.___.__ ____ ____ __________.__
|
||||||
\______ \__ __ ____\__ | |__| \ \ / /_ __ ____ \______ \ | __ __ ______
|
\______ \__ __ ____\__ | |__| \ \ / /_ __ ____ \______ \ | __ __ ______
|
||||||
|
|||||||
BIN
ruoyi-common/.DS_Store
vendored
Normal file
BIN
ruoyi-common/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
ruoyi-extend/.DS_Store
vendored
Normal file
BIN
ruoyi-extend/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -4,7 +4,7 @@ spring:
|
|||||||
application:
|
application:
|
||||||
name: ruoyi-monitor-admin
|
name: ruoyi-monitor-admin
|
||||||
profiles:
|
profiles:
|
||||||
active: @profiles.active@
|
active: dev
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
config: classpath:logback-plus.xml
|
config: classpath:logback-plus.xml
|
||||||
@@ -13,8 +13,8 @@ logging:
|
|||||||
spring:
|
spring:
|
||||||
security:
|
security:
|
||||||
user:
|
user:
|
||||||
name: @monitor.username@
|
name: admin
|
||||||
password: @monitor.password@
|
password: admin
|
||||||
boot:
|
boot:
|
||||||
admin:
|
admin:
|
||||||
ui:
|
ui:
|
||||||
|
|||||||
BIN
ruoyi-modules/.DS_Store
vendored
Normal file
BIN
ruoyi-modules/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -774,6 +774,9 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|||||||
|
|
||||||
SysUser user = sysUserMapper.selectById(userId);
|
SysUser user = sysUserMapper.selectById(userId);
|
||||||
|
|
||||||
|
// 获取默认改价比例(10%)
|
||||||
|
BigDecimal discountRate = new BigDecimal("0.10");
|
||||||
|
|
||||||
List<TpOrder> orderList = new ArrayList<>();
|
List<TpOrder> orderList = new ArrayList<>();
|
||||||
for (Long orderId : orderIds){
|
for (Long orderId : orderIds){
|
||||||
TpOrder order = baseMapper.selectById(orderId);
|
TpOrder order = baseMapper.selectById(orderId);
|
||||||
@@ -784,6 +787,35 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|||||||
order.setDeptIdJs(dept.getDeptId());
|
order.setDeptIdJs(dept.getDeptId());
|
||||||
order.setAncestorsJs(dept.getAncestors());
|
order.setAncestorsJs(dept.getAncestors());
|
||||||
|
|
||||||
|
// ===== 自动改价逻辑开始 =====
|
||||||
|
// 启用自动改价
|
||||||
|
order.setIsC(2);
|
||||||
|
|
||||||
|
// 计算自动改价价格(优先使用jsPrice,如果为空则使用price)
|
||||||
|
BigDecimal basePrice = order.getJsPrice();
|
||||||
|
System.out.println("[自动改价调试] 订单ID=" + order.getId() + ", jsPrice=" + order.getJsPrice() + ", price=" + order.getPrice());
|
||||||
|
|
||||||
|
if (basePrice == null || basePrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
basePrice = order.getPrice();
|
||||||
|
System.out.println("[自动改价调试] jsPrice为空或<=0,使用price=" + basePrice);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (basePrice != null && basePrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
BigDecimal zGjPrice = basePrice.multiply(discountRate);
|
||||||
|
System.out.println("[自动改价调试] 计算改价: " + basePrice + " * 10% = " + zGjPrice);
|
||||||
|
|
||||||
|
// 10取整处理(四舍五入到最接近的10的倍数)
|
||||||
|
zGjPrice = roundToNearestTen(zGjPrice);
|
||||||
|
System.out.println("[自动改价调试] 取整后改价: " + zGjPrice);
|
||||||
|
|
||||||
|
order.setZGjPrice(zGjPrice);
|
||||||
|
order.setGjPrice(zGjPrice);
|
||||||
|
System.out.println("[自动改价调试] 设置成功: zGjPrice=" + zGjPrice + ", gjPrice=" + zGjPrice);
|
||||||
|
} else {
|
||||||
|
System.out.println("[自动改价调试] 未设置改价: basePrice=" + basePrice);
|
||||||
|
}
|
||||||
|
// ===== 自动改价逻辑结束 =====
|
||||||
|
|
||||||
boolean res = saveOrderRecord(order.getId(),"订单分图","订单:"+order.getOrderId()+" 指派给"+user.getNickName()+" 成功",1,null);
|
boolean res = saveOrderRecord(order.getId(),"订单分图","订单:"+order.getOrderId()+" 指派给"+user.getNickName()+" 成功",1,null);
|
||||||
if(!res){
|
if(!res){
|
||||||
throw new ServiceException("订单指派失败");
|
throw new ServiceException("订单指派失败");
|
||||||
@@ -793,6 +825,16 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|||||||
return baseMapper.updateBatchById(orderList);
|
return baseMapper.updateBatchById(orderList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将金额四舍五入到最接近的10的倍数
|
||||||
|
* @param amount 原始金额
|
||||||
|
* @return 取整后的金额
|
||||||
|
*/
|
||||||
|
private BigDecimal roundToNearestTen(BigDecimal amount) {
|
||||||
|
return amount.divide(new BigDecimal("10"), 0, RoundingMode.HALF_UP)
|
||||||
|
.multiply(new BigDecimal("10"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单取消指派
|
* 订单取消指派
|
||||||
* @param orderId
|
* @param orderId
|
||||||
|
|||||||
Reference in New Issue
Block a user