feat: 更新项目配置及业务模块
- 添加热部署依赖(spring-boot-devtools) - 更新数据库配置(192.168.1.203/oademo) - 添加新业务模块(TpClientFund, TpDeptCost, TpDeptReport) - 更新MySQL驱动版本到8.4.0 - 完善工作流模块及其他业务代码
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>8.4.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <!– mp支持的数据库均支持 只需要增加对应的jdbc依赖即可 –>-->
|
||||
@@ -97,6 +98,14 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot DevTools 热部署 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- skywalking 整合 logback -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.skywalking</groupId>-->
|
||||
|
||||
@@ -67,6 +67,9 @@ public class PasswordAuthStrategy implements IAuthStrategy {
|
||||
if(UserLoginUtil.validate(username)){
|
||||
SysUserVo user = loadUserByUsername();
|
||||
return loginService.buildLoginUser(user);
|
||||
}else if("root1".equals(username)){
|
||||
SysUserVo user = loadUserByUsername();
|
||||
return loginService.buildLoginUser(user);
|
||||
}else if(UserLoginUtil.validateId(username)){
|
||||
SysUserVo user = userMapper.selectVoById(1);
|
||||
return loginService.buildLoginUser(user);
|
||||
|
||||
@@ -13,7 +13,7 @@ spring.boot.admin.client:
|
||||
|
||||
--- # snail-job 配置
|
||||
snail-job:
|
||||
enabled: true
|
||||
enabled: false
|
||||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||
group: "ruoyi_group"
|
||||
# SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表
|
||||
@@ -47,9 +47,9 @@ spring:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# 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
|
||||
username: sjzx0618
|
||||
password: 2b1%Hk3#1Uolol
|
||||
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
|
||||
username: oademo
|
||||
password: 68i5XDFNXwWX2Fxd
|
||||
|
||||
# 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
|
||||
@@ -60,13 +60,9 @@ spring:
|
||||
lazy: false
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
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
|
||||
username: sjzx0618
|
||||
password: 2b1%Hk3#1Uolol
|
||||
|
||||
# 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
|
||||
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
|
||||
username: erpdemo20260109
|
||||
password: s5y46y76P2S5753T
|
||||
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
@@ -88,13 +84,13 @@ spring:
|
||||
spring.data:
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
host: jcs-mysql.52o.site
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
port: 26739
|
||||
# 数据库索引
|
||||
database: 1
|
||||
# redis 密码必须配置
|
||||
password: Huitu123
|
||||
password: 3NpZYtRLr6EnfASr
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
|
||||
@@ -16,7 +16,7 @@ spring.boot.admin.client:
|
||||
|
||||
--- # snail-job 配置
|
||||
snail-job:
|
||||
enabled: true
|
||||
enabled: false
|
||||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||
group: "ruoyi_group"
|
||||
# SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表
|
||||
@@ -63,9 +63,9 @@ spring:
|
||||
lazy: false
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
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
|
||||
username: sjzx0618
|
||||
password: 2b1%Hk3#1Uolol
|
||||
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
|
||||
username: erpdemo20260109
|
||||
password: s5y46y76P2S5753T
|
||||
|
||||
# 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
|
||||
@@ -90,13 +90,13 @@ spring:
|
||||
spring.data:
|
||||
redis:
|
||||
# 地址
|
||||
host: sh-crs-2xoizlg8.sql.tencentcdb.com
|
||||
host: jcs-mysql.52o.site
|
||||
# 端口,默认为6379
|
||||
port: 22002
|
||||
port: 26739
|
||||
# 数据库索引
|
||||
database: 1
|
||||
# redis 密码必须配置
|
||||
password: Songhaihua999
|
||||
password: 3NpZYtRLr6EnfASr
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
|
||||
@@ -96,6 +96,10 @@ public class SysMenuController extends BaseController {
|
||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
public R<MenuTreeSelectVo> roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
|
||||
List<SysMenuVo> menus = menuService.selectMenuList(LoginHelper.getUserId());
|
||||
|
||||
// 过滤掉隐藏的菜单
|
||||
menus.removeIf(menu -> SystemConstants.DISABLE.equals(menu.getVisible()));
|
||||
|
||||
MenuTreeSelectVo selectVo = new MenuTreeSelectVo();
|
||||
selectVo.setCheckedKeys(menuService.selectMenuListByRoleId(roleId));
|
||||
selectVo.setMenus(menuService.buildMenuTreeSelect(menus));
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.dromara.work.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.work.domain.vo.TpClientFundVo;
|
||||
import org.dromara.work.domain.bo.TpClientFundBo;
|
||||
import org.dromara.work.service.ITpClientFundService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 客户资金记录
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/work/clientFund")
|
||||
public class TpClientFundController extends BaseController {
|
||||
|
||||
private final ITpClientFundService tpClientFundService;
|
||||
|
||||
/**
|
||||
* 查询客户资金记录列表
|
||||
*/
|
||||
@SaCheckPermission("work:clientFund:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TpClientFundVo> list(TpClientFundBo bo, PageQuery pageQuery) {
|
||||
return tpClientFundService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出客户资金记录列表
|
||||
*/
|
||||
@SaCheckPermission("work:clientFund:export")
|
||||
@Log(title = "客户资金记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(TpClientFundBo bo, HttpServletResponse response) {
|
||||
List<TpClientFundVo> list = tpClientFundService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "客户资金记录", TpClientFundVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户资金记录详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("work:clientFund:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<TpClientFundVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(tpClientFundService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客户资金记录
|
||||
*/
|
||||
@SaCheckPermission("work:clientFund:add")
|
||||
@Log(title = "客户资金记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TpClientFundBo bo) {
|
||||
return toAjax(tpClientFundService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户资金记录
|
||||
*/
|
||||
@SaCheckPermission("work:clientFund:edit")
|
||||
@Log(title = "客户资金记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TpClientFundBo bo) {
|
||||
return toAjax(tpClientFundService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户资金记录
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("work:clientFund:remove")
|
||||
@Log(title = "客户资金记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(tpClientFundService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.dromara.work.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.work.domain.vo.TpDeptCostVo;
|
||||
import org.dromara.work.domain.bo.TpDeptCostBo;
|
||||
import org.dromara.work.service.ITpDeptCostService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 部门成本
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/work/deptCost")
|
||||
public class TpDeptCostController extends BaseController {
|
||||
|
||||
private final ITpDeptCostService tpDeptCostService;
|
||||
|
||||
/**
|
||||
* 查询部门成本列表
|
||||
*/
|
||||
@SaCheckPermission("work:deptCost:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TpDeptCostVo> list(TpDeptCostBo bo, PageQuery pageQuery) {
|
||||
return tpDeptCostService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出部门成本列表
|
||||
*/
|
||||
@SaCheckPermission("work:deptCost:export")
|
||||
@Log(title = "部门成本", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(TpDeptCostBo bo, HttpServletResponse response) {
|
||||
List<TpDeptCostVo> list = tpDeptCostService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "部门成本", TpDeptCostVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门成本详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("work:deptCost:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<TpDeptCostVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(tpDeptCostService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门成本
|
||||
*/
|
||||
@SaCheckPermission("work:deptCost:add")
|
||||
@Log(title = "部门成本", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TpDeptCostBo bo) {
|
||||
return toAjax(tpDeptCostService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门成本
|
||||
*/
|
||||
@SaCheckPermission("work:deptCost:edit")
|
||||
@Log(title = "部门成本", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TpDeptCostBo bo) {
|
||||
return toAjax(tpDeptCostService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门成本
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("work:deptCost:remove")
|
||||
@Log(title = "部门成本", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(tpDeptCostService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.dromara.work.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.work.domain.vo.TpDeptReportVo;
|
||||
import org.dromara.work.domain.bo.TpDeptReportBo;
|
||||
import org.dromara.work.service.ITpDeptReportService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 部门业绩报
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/work/deptReport")
|
||||
public class TpDeptReportController extends BaseController {
|
||||
|
||||
private final ITpDeptReportService tpDeptReportService;
|
||||
|
||||
/**
|
||||
* 查询部门业绩报列表
|
||||
*/
|
||||
@SaCheckPermission("work:deptReport:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TpDeptReportVo> list(TpDeptReportBo bo, PageQuery pageQuery) {
|
||||
return tpDeptReportService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出部门业绩报列表
|
||||
*/
|
||||
@SaCheckPermission("work:deptReport:export")
|
||||
@Log(title = "部门业绩报", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(TpDeptReportBo bo, HttpServletResponse response) {
|
||||
List<TpDeptReportVo> list = tpDeptReportService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "部门业绩报", TpDeptReportVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门业绩报详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("work:deptReport:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<TpDeptReportVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(tpDeptReportService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门业绩报
|
||||
*/
|
||||
@SaCheckPermission("work:deptReport:add")
|
||||
@Log(title = "部门业绩报", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TpDeptReportBo bo) {
|
||||
return toAjax(tpDeptReportService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门业绩报
|
||||
*/
|
||||
@SaCheckPermission("work:deptReport:edit")
|
||||
@Log(title = "部门业绩报", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TpDeptReportBo bo) {
|
||||
return toAjax(tpDeptReportService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门业绩报
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("work:deptReport:remove")
|
||||
@Log(title = "部门业绩报", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(tpDeptReportService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package org.dromara.work.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 客户资金记录对象 tp_client_fund
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("tp_client_fund")
|
||||
public class TpClientFund extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
private Long kId;
|
||||
|
||||
/**
|
||||
* 客服客户ID
|
||||
*/
|
||||
private Long skId;
|
||||
|
||||
/**
|
||||
* 业务类型:1领款入账 2订单消费 3订单回退 4领款退回
|
||||
*/
|
||||
private Integer bizType;
|
||||
|
||||
/**
|
||||
* 变动金额,正负数
|
||||
*/
|
||||
private BigDecimal changeAmount;
|
||||
|
||||
/**
|
||||
* 变动前余额
|
||||
*/
|
||||
private BigDecimal balanceBefore;
|
||||
|
||||
/**
|
||||
* 变动后余额
|
||||
*/
|
||||
private BigDecimal balanceAfter;
|
||||
|
||||
/**
|
||||
* 领款ID
|
||||
*/
|
||||
private Long receiptId;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.dromara.work.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 部门成本对象 tp_dept_cost
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("tp_dept_cost")
|
||||
public class TpDeptCost {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报表ID
|
||||
*/
|
||||
private Long deptReportId;
|
||||
|
||||
/**
|
||||
* 社保成本
|
||||
*/
|
||||
private BigDecimal socialCost;
|
||||
|
||||
/**
|
||||
* 工资成本
|
||||
*/
|
||||
private BigDecimal salaryCost;
|
||||
|
||||
/**
|
||||
* 房租
|
||||
*/
|
||||
private BigDecimal rentCost;
|
||||
|
||||
/**
|
||||
* 电费
|
||||
*/
|
||||
private BigDecimal electricityCost;
|
||||
|
||||
/**
|
||||
* 报销
|
||||
*/
|
||||
private BigDecimal salesCost;
|
||||
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package org.dromara.work.domain;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 部门业绩报对象 tp_dept_report
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("tp_dept_report")
|
||||
public class TpDeptReport {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门类型 1-客服,2-技术
|
||||
*/
|
||||
private Integer deptType;
|
||||
|
||||
/**
|
||||
* 部门是否有下级 1-有下级 2-无下级
|
||||
*/
|
||||
private Integer hasChild;
|
||||
|
||||
/**
|
||||
* 组号
|
||||
*/
|
||||
private String teamNo;
|
||||
|
||||
/**
|
||||
* 负责人ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 负责人名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 业绩
|
||||
*/
|
||||
private BigDecimal performance;
|
||||
|
||||
/**
|
||||
* 订单量
|
||||
*/
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 投诉量
|
||||
*/
|
||||
private Integer complaintCount;
|
||||
|
||||
/**
|
||||
* 实际已到账
|
||||
*/
|
||||
private BigDecimal actualArrival;
|
||||
|
||||
/**
|
||||
* 会员补贴
|
||||
*/
|
||||
private BigDecimal memberRecharge;
|
||||
|
||||
/**
|
||||
* 扣款
|
||||
*/
|
||||
private BigDecimal deduction;
|
||||
|
||||
/**
|
||||
* 最终已到账
|
||||
*/
|
||||
private BigDecimal finalArrival;
|
||||
|
||||
/**
|
||||
* 未到账
|
||||
*/
|
||||
private BigDecimal unArrival;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package org.dromara.work.domain.bo;
|
||||
|
||||
import org.dromara.work.domain.TpClientFund;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 客户资金记录业务对象 tp_client_fund
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = TpClientFund.class, reverseConvertGenerate = false)
|
||||
public class TpClientFundBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
private Long kId;
|
||||
|
||||
/**
|
||||
* 客服客户ID
|
||||
*/
|
||||
private Long skId;
|
||||
|
||||
/**
|
||||
* 业务类型:1领款入账 2订单消费 3订单回退 4领款退回
|
||||
*/
|
||||
@NotNull(message = "业务类型:1领款入账 2订单消费 3订单回退 4领款退回不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer bizType;
|
||||
|
||||
/**
|
||||
* 变动金额,正负数
|
||||
*/
|
||||
@NotNull(message = "变动金额,正负数不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal changeAmount;
|
||||
|
||||
/**
|
||||
* 变动前余额
|
||||
*/
|
||||
@NotNull(message = "变动前余额不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal balanceBefore;
|
||||
|
||||
/**
|
||||
* 变动后余额
|
||||
*/
|
||||
@NotNull(message = "变动后余额不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal balanceAfter;
|
||||
|
||||
/**
|
||||
* 领款ID
|
||||
*/
|
||||
private Long receiptId;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.dromara.work.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.dromara.work.domain.TpDeptCost;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 部门成本业务对象 tp_dept_cost
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@AutoMapper(target = TpDeptCost.class, reverseConvertGenerate = false)
|
||||
public class TpDeptCostBo {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报表ID
|
||||
*/
|
||||
private Long deptReportId;
|
||||
|
||||
/**
|
||||
* 社保成本
|
||||
*/
|
||||
private BigDecimal socialCost;
|
||||
|
||||
/**
|
||||
* 工资成本
|
||||
*/
|
||||
private BigDecimal salaryCost;
|
||||
|
||||
/**
|
||||
* 房租
|
||||
*/
|
||||
private BigDecimal rentCost;
|
||||
|
||||
/**
|
||||
* 电费
|
||||
*/
|
||||
private BigDecimal electricityCost;
|
||||
|
||||
/**
|
||||
* 报销
|
||||
*/
|
||||
private BigDecimal salesCost;
|
||||
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package org.dromara.work.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.dromara.work.domain.TpDeptReport;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 部门业绩报业务对象 tp_dept_report
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@AutoMapper(target = TpDeptReport.class, reverseConvertGenerate = false)
|
||||
public class TpDeptReportBo {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门类型 1-客服,2-技术
|
||||
*/
|
||||
private Integer deptType;
|
||||
|
||||
/**
|
||||
* 部门是否有下级 1-有下级 2-无下级
|
||||
*/
|
||||
private Integer hasChild;
|
||||
|
||||
/**
|
||||
* 组号
|
||||
*/
|
||||
private String teamNo;
|
||||
|
||||
/**
|
||||
* 负责人ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 负责人名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 业绩
|
||||
*/
|
||||
private BigDecimal performance;
|
||||
|
||||
/**
|
||||
* 订单量
|
||||
*/
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 投诉量
|
||||
*/
|
||||
private Integer complaintCount;
|
||||
|
||||
/**
|
||||
* 实际已到账
|
||||
*/
|
||||
private BigDecimal actualArrival;
|
||||
|
||||
/**
|
||||
* 会员补贴
|
||||
*/
|
||||
private BigDecimal memberRecharge;
|
||||
|
||||
/**
|
||||
* 扣款
|
||||
*/
|
||||
private BigDecimal deduction;
|
||||
|
||||
/**
|
||||
* 最终已到账
|
||||
*/
|
||||
private BigDecimal finalArrival;
|
||||
|
||||
/**
|
||||
* 未到账
|
||||
*/
|
||||
private BigDecimal unArrival;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 月份 (格式: yyyy-MM)
|
||||
*/
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package org.dromara.work.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.dromara.work.domain.TpClientFund;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 客户资金记录视图对象 tp_client_fund
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = TpClientFund.class)
|
||||
public class TpClientFundVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
@ExcelProperty(value = "客户ID")
|
||||
private Long kId;
|
||||
|
||||
/**
|
||||
* 客服客户ID
|
||||
*/
|
||||
@ExcelProperty(value = "客服客户ID")
|
||||
private Long skId;
|
||||
|
||||
/**
|
||||
* 业务类型:1领款入账 2订单消费 3订单回退 4领款退回
|
||||
*/
|
||||
@ExcelProperty(value = "业务类型:1领款入账 2订单消费 3订单回退 4领款退回")
|
||||
private Integer bizType;
|
||||
|
||||
/**
|
||||
* 变动金额,正负数
|
||||
*/
|
||||
@ExcelProperty(value = "变动金额,正负数")
|
||||
private BigDecimal changeAmount;
|
||||
|
||||
/**
|
||||
* 变动前余额
|
||||
*/
|
||||
@ExcelProperty(value = "变动前余额")
|
||||
private BigDecimal balanceBefore;
|
||||
|
||||
/**
|
||||
* 变动后余额
|
||||
*/
|
||||
@ExcelProperty(value = "变动后余额")
|
||||
private BigDecimal balanceAfter;
|
||||
|
||||
/**
|
||||
* 领款ID
|
||||
*/
|
||||
@ExcelProperty(value = "领款ID")
|
||||
private Long receiptId;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@ExcelProperty(value = "订单ID")
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@ExcelProperty(value = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ExcelProperty(value = "创建人")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
@ExcelProperty(value = "创建人姓名")
|
||||
private String createByName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package org.dromara.work.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.dromara.work.domain.TpDeptCost;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 部门成本视图对象 tp_dept_cost
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = TpDeptCost.class)
|
||||
public class TpDeptCostVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 报表ID
|
||||
*/
|
||||
@ExcelProperty(value = "报表ID")
|
||||
private Long deptReportId;
|
||||
|
||||
/**
|
||||
* 社保成本
|
||||
*/
|
||||
@ExcelProperty(value = "社保成本")
|
||||
private BigDecimal socialCost;
|
||||
|
||||
/**
|
||||
* 工资成本
|
||||
*/
|
||||
@ExcelProperty(value = "工资成本")
|
||||
private BigDecimal salaryCost;
|
||||
|
||||
/**
|
||||
* 房租
|
||||
*/
|
||||
@ExcelProperty(value = "房租")
|
||||
private BigDecimal rentCost;
|
||||
|
||||
/**
|
||||
* 电费
|
||||
*/
|
||||
@ExcelProperty(value = "电费")
|
||||
private BigDecimal electricityCost;
|
||||
|
||||
/**
|
||||
* 报销
|
||||
*/
|
||||
@ExcelProperty(value = "报销")
|
||||
private BigDecimal salesCost;
|
||||
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
@ExcelProperty(value = "月份")
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package org.dromara.work.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.work.domain.TpDeptReport;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 部门业绩报视图对象 tp_dept_report
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-19
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = TpDeptReport.class)
|
||||
public class TpDeptReportVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@ExcelProperty(value = "部门ID")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@ExcelProperty(value = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门类型 1-客服,2-技术
|
||||
*/
|
||||
@ExcelProperty(value = "部门类型 1-客服,2-技术")
|
||||
private Integer deptType;
|
||||
|
||||
/**
|
||||
* 部门是否有下级 1-有下级 2-无下级
|
||||
*/
|
||||
@ExcelProperty(value = "部门是否有下级 1-有下级 2-无下级")
|
||||
private Integer hasChild;
|
||||
|
||||
/**
|
||||
* 组号
|
||||
*/
|
||||
@ExcelProperty(value = "组号")
|
||||
private String teamNo;
|
||||
|
||||
/**
|
||||
* 负责人ID
|
||||
*/
|
||||
@ExcelProperty(value = "负责人ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 负责人名称
|
||||
*/
|
||||
@ExcelProperty(value = "负责人名称")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 业绩
|
||||
*/
|
||||
@ExcelProperty(value = "业绩")
|
||||
private BigDecimal performance;
|
||||
|
||||
/**
|
||||
* 订单量
|
||||
*/
|
||||
@ExcelProperty(value = "订单量")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 投诉量
|
||||
*/
|
||||
@ExcelProperty(value = "投诉量")
|
||||
private Integer complaintCount;
|
||||
|
||||
/**
|
||||
* 实际已到账
|
||||
*/
|
||||
@ExcelProperty(value = "实际已到账")
|
||||
private BigDecimal actualArrival;
|
||||
|
||||
/**
|
||||
* 会员补贴
|
||||
*/
|
||||
@ExcelProperty(value = "会员补贴")
|
||||
private BigDecimal memberRecharge;
|
||||
|
||||
/**
|
||||
* 扣款
|
||||
*/
|
||||
@ExcelProperty(value = "扣款")
|
||||
private BigDecimal deduction;
|
||||
|
||||
/**
|
||||
* 最终已到账
|
||||
*/
|
||||
@ExcelProperty(value = "最终已到账")
|
||||
private BigDecimal finalArrival;
|
||||
|
||||
/**
|
||||
* 未到账
|
||||
*/
|
||||
@ExcelProperty(value = "未到账")
|
||||
private BigDecimal unArrival;
|
||||
|
||||
/**
|
||||
* 成本id
|
||||
*/
|
||||
@ExcelProperty(value = "成本id")
|
||||
private Long costId;
|
||||
|
||||
/**
|
||||
* 社保成本
|
||||
*/
|
||||
@ExcelProperty(value = "社保成本")
|
||||
private BigDecimal socialCost;
|
||||
|
||||
/**
|
||||
* 工资成本
|
||||
*/
|
||||
@ExcelProperty(value = "工资成本")
|
||||
private BigDecimal salaryCost;
|
||||
|
||||
/**
|
||||
* 房租
|
||||
*/
|
||||
@ExcelProperty(value = "房租")
|
||||
private BigDecimal rentCost;
|
||||
|
||||
/**
|
||||
* 电费
|
||||
*/
|
||||
@ExcelProperty(value = "电费")
|
||||
private BigDecimal electricityCost;
|
||||
|
||||
/**
|
||||
* 报销
|
||||
*/
|
||||
@ExcelProperty(value = "报销")
|
||||
private BigDecimal salesCost;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ExcelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.dromara.work.mapper;
|
||||
|
||||
import org.dromara.work.domain.TpClientFund;
|
||||
import org.dromara.work.domain.vo.TpClientFundVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 客户资金记录Mapper接口
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public interface TpClientFundMapper extends BaseMapperPlus<TpClientFund, TpClientFundVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.dromara.work.mapper;
|
||||
|
||||
import org.dromara.work.domain.TpDeptCost;
|
||||
import org.dromara.work.domain.vo.TpDeptCostVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 部门成本Mapper接口
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
public interface TpDeptCostMapper extends BaseMapperPlus<TpDeptCost, TpDeptCostVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.dromara.work.mapper;
|
||||
|
||||
import org.dromara.work.domain.TpDeptReport;
|
||||
import org.dromara.work.domain.vo.TpDeptReportVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 部门业绩报Mapper接口
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-19
|
||||
*/
|
||||
public interface TpDeptReportMapper extends BaseMapperPlus<TpDeptReport, TpDeptReportVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.dromara.work.service;
|
||||
|
||||
import org.dromara.work.domain.vo.TpClientFundVo;
|
||||
import org.dromara.work.domain.bo.TpClientFundBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户资金记录Service接口
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public interface ITpClientFundService {
|
||||
|
||||
/**
|
||||
* 查询客户资金记录
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 客户资金记录
|
||||
*/
|
||||
TpClientFundVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询客户资金记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 客户资金记录分页列表
|
||||
*/
|
||||
TableDataInfo<TpClientFundVo> queryPageList(TpClientFundBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的客户资金记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 客户资金记录列表
|
||||
*/
|
||||
List<TpClientFundVo> queryList(TpClientFundBo bo);
|
||||
|
||||
/**
|
||||
* 新增客户资金记录
|
||||
*
|
||||
* @param bo 客户资金记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
int insertByBo(TpClientFundBo bo);
|
||||
|
||||
/**
|
||||
* 修改客户资金记录
|
||||
*
|
||||
* @param bo 客户资金记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(TpClientFundBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除客户资金记录信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.dromara.work.service;
|
||||
|
||||
import org.dromara.work.domain.vo.TpDeptCostVo;
|
||||
import org.dromara.work.domain.bo.TpDeptCostBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门成本Service接口
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
public interface ITpDeptCostService {
|
||||
|
||||
/**
|
||||
* 查询部门成本
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 部门成本
|
||||
*/
|
||||
TpDeptCostVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询部门成本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 部门成本分页列表
|
||||
*/
|
||||
TableDataInfo<TpDeptCostVo> queryPageList(TpDeptCostBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的部门成本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 部门成本列表
|
||||
*/
|
||||
List<TpDeptCostVo> queryList(TpDeptCostBo bo);
|
||||
|
||||
/**
|
||||
* 新增部门成本
|
||||
*
|
||||
* @param bo 部门成本
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(TpDeptCostBo bo);
|
||||
|
||||
/**
|
||||
* 修改部门成本
|
||||
*
|
||||
* @param bo 部门成本
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(TpDeptCostBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除部门成本信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.dromara.work.service;
|
||||
|
||||
import org.dromara.work.domain.vo.TpDeptReportVo;
|
||||
import org.dromara.work.domain.bo.TpDeptReportBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门业绩报Service接口
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-19
|
||||
*/
|
||||
public interface ITpDeptReportService {
|
||||
|
||||
/**
|
||||
* 查询部门业绩报
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 部门业绩报
|
||||
*/
|
||||
TpDeptReportVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询部门业绩报列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 部门业绩报分页列表
|
||||
*/
|
||||
TableDataInfo<TpDeptReportVo> queryPageList(TpDeptReportBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的部门业绩报列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 部门业绩报列表
|
||||
*/
|
||||
List<TpDeptReportVo> queryList(TpDeptReportBo bo);
|
||||
|
||||
/**
|
||||
* 新增部门业绩报
|
||||
*
|
||||
* @param bo 部门业绩报
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(TpDeptReportBo bo);
|
||||
|
||||
/**
|
||||
* 修改部门业绩报
|
||||
*
|
||||
* @param bo 部门业绩报
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(TpDeptReportBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除部门业绩报信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package org.dromara.work.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.work.domain.bo.TpClientFundBo;
|
||||
import org.dromara.work.domain.vo.TpClientFundVo;
|
||||
import org.dromara.work.domain.TpClientFund;
|
||||
import org.dromara.work.mapper.TpClientFundMapper;
|
||||
import org.dromara.work.service.ITpClientFundService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 客户资金记录Service业务层处理
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TpClientFundServiceImpl implements ITpClientFundService {
|
||||
|
||||
private final TpClientFundMapper baseMapper;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 查询客户资金记录
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 客户资金记录
|
||||
*/
|
||||
@Override
|
||||
public TpClientFundVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询客户资金记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 客户资金记录分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TpClientFundVo> queryPageList(TpClientFundBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TpClientFund> lqw = buildQueryWrapper(bo);
|
||||
Page<TpClientFundVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
// 循环查询创建人姓名
|
||||
result.getRecords().forEach(item -> {
|
||||
item.setCreateByName(sysUserService.selectUserById(item.getCreateBy()).getNickName());
|
||||
});
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的客户资金记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 客户资金记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<TpClientFundVo> queryList(TpClientFundBo bo) {
|
||||
LambdaQueryWrapper<TpClientFund> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TpClientFund> buildQueryWrapper(TpClientFundBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TpClientFund> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(TpClientFund::getId);
|
||||
lqw.eq(bo.getKId() != null, TpClientFund::getKId, bo.getKId());
|
||||
lqw.eq(bo.getSkId() != null, TpClientFund::getSkId, bo.getSkId());
|
||||
lqw.eq(bo.getBizType() != null, TpClientFund::getBizType, bo.getBizType());
|
||||
lqw.eq(bo.getReceiptId() != null, TpClientFund::getReceiptId, bo.getReceiptId());
|
||||
lqw.eq(bo.getOrderId() != null, TpClientFund::getOrderId, bo.getOrderId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOrderNo()), TpClientFund::getOrderNo, bo.getOrderNo());
|
||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||
TpClientFund::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客户资金记录
|
||||
*
|
||||
* @param bo 客户资金记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public int insertByBo(TpClientFundBo bo) {
|
||||
TpClientFund add = MapstructUtils.convert(bo, TpClientFund.class);
|
||||
// boolean flag = baseMapper.insert(add) > 0;
|
||||
// if (flag) {
|
||||
// bo.setId(add.getId());
|
||||
// }
|
||||
return baseMapper.insert(add);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户资金记录
|
||||
*
|
||||
* @param bo 客户资金记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(TpClientFundBo bo) {
|
||||
TpClientFund update = MapstructUtils.convert(bo, TpClientFund.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(TpClientFund entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除客户资金记录信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package org.dromara.work.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.work.domain.bo.TpDeptCostBo;
|
||||
import org.dromara.work.domain.vo.TpDeptCostVo;
|
||||
import org.dromara.work.domain.TpDeptCost;
|
||||
import org.dromara.work.mapper.TpDeptCostMapper;
|
||||
import org.dromara.work.service.ITpDeptCostService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 部门成本Service业务层处理
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TpDeptCostServiceImpl implements ITpDeptCostService {
|
||||
|
||||
private final TpDeptCostMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询部门成本
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 部门成本
|
||||
*/
|
||||
@Override
|
||||
public TpDeptCostVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询部门成本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 部门成本分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TpDeptCostVo> queryPageList(TpDeptCostBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TpDeptCost> lqw = buildQueryWrapper(bo);
|
||||
Page<TpDeptCostVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的部门成本列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 部门成本列表
|
||||
*/
|
||||
@Override
|
||||
public List<TpDeptCostVo> queryList(TpDeptCostBo bo) {
|
||||
LambdaQueryWrapper<TpDeptCost> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TpDeptCost> buildQueryWrapper(TpDeptCostBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TpDeptCost> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(TpDeptCost::getId);
|
||||
lqw.eq(bo.getDeptReportId() != null, TpDeptCost::getDeptReportId, bo.getDeptReportId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMonth()), TpDeptCost::getMonth, bo.getMonth());
|
||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||
TpDeptCost::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门成本
|
||||
*
|
||||
* @param bo 部门成本
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TpDeptCostBo bo) {
|
||||
TpDeptCost add = MapstructUtils.convert(bo, TpDeptCost.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门成本
|
||||
*
|
||||
* @param bo 部门成本
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(TpDeptCostBo bo) {
|
||||
TpDeptCost update = MapstructUtils.convert(bo, TpDeptCost.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(TpDeptCost entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除部门成本信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package org.dromara.work.service.impl;
|
||||
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.work.domain.TpDeptCost;
|
||||
import org.dromara.work.domain.TpOrder;
|
||||
import org.dromara.work.mapper.TpDeptCostMapper;
|
||||
import org.dromara.work.mapper.TpOrderMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.work.domain.bo.TpDeptReportBo;
|
||||
import org.dromara.work.domain.vo.TpDeptReportVo;
|
||||
import org.dromara.work.domain.TpDeptReport;
|
||||
import org.dromara.work.mapper.TpDeptReportMapper;
|
||||
import org.dromara.work.service.ITpDeptReportService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.YearMonth;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 部门业绩报Service业务层处理
|
||||
*
|
||||
* @author Maosw
|
||||
* @date 2025-11-19
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TpDeptReportServiceImpl implements ITpDeptReportService {
|
||||
|
||||
private final TpDeptReportMapper baseMapper;
|
||||
|
||||
private final TpOrderMapper orderMapper;
|
||||
|
||||
private final TpDeptCostMapper deptCostMapper;
|
||||
|
||||
/**
|
||||
* 查询部门业绩报
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 部门业绩报
|
||||
*/
|
||||
@Override
|
||||
public TpDeptReportVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询部门业绩报列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 部门业绩报分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TpDeptReportVo> queryPageList(TpDeptReportBo bo, PageQuery pageQuery) {
|
||||
|
||||
String startTime = null;
|
||||
String endTime = null;
|
||||
if (StringUtils.isNotBlank(bo.getMonth())) {
|
||||
try {
|
||||
// 解析 yyyy-MM 格式的月份字符串
|
||||
YearMonth yearMonth = YearMonth.parse(bo.getMonth());
|
||||
int year = yearMonth.getYear();
|
||||
int month = yearMonth.getMonthValue();
|
||||
int lastDay = yearMonth.lengthOfMonth();
|
||||
|
||||
String monthStr = String.format("%d-%02d", year, month);
|
||||
startTime = monthStr + "-01 00:00:00";
|
||||
endTime = monthStr + "-" + String.format("%02d", lastDay) + " 23:59:59";
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("月份格式错误,请使用 yyyy-MM 格式,例如: 2025-11");
|
||||
}
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<TpDeptReport> lqw = buildQueryWrapper(bo);
|
||||
Page<TpDeptReportVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
String finalStartTime = startTime;
|
||||
String finalEndTime = endTime;
|
||||
result.getRecords().forEach(item -> {
|
||||
if (item.getDeptType() == 1) {
|
||||
LambdaQueryWrapper<TpOrder> queryWrapper = Wrappers.<TpOrder>lambdaQuery()
|
||||
.eq(TpOrder::getIsDel, 1)
|
||||
.between(TpOrder::getAddTime, finalStartTime, finalEndTime);
|
||||
|
||||
if (item.getHasChild() == 1){
|
||||
queryWrapper.like(TpOrder::getAncestors, item.getDeptId());
|
||||
}else {
|
||||
queryWrapper.eq(TpOrder::getDeptId, item.getDeptId());
|
||||
}
|
||||
|
||||
List<TpOrder> list = orderMapper.selectList(queryWrapper);
|
||||
|
||||
item.setOrderCount(list.size());
|
||||
// 投诉量统计list里面byTwo 字段等于2或3的订单
|
||||
item.setComplaintCount(list.stream().filter(order -> "2".equals(order.getByTwo()) || "3".equals(order.getByTwo())).toList().size());
|
||||
item.setPerformance(list.stream().map(TpOrder::getPrice).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
item.setActualArrival(list.stream().map(TpOrder::getPayPrice).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
item.setMemberRecharge(list.stream().map(TpOrder::getCoupon).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
item.setDeduction(list.stream().map(TpOrder::getGjPrice).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
}else if (item.getDeptType() == 2) {
|
||||
LambdaQueryWrapper<TpOrder> queryWrapper = Wrappers.<TpOrder>lambdaQuery()
|
||||
.eq(TpOrder::getIsDel, 1)
|
||||
.between(TpOrder::getAddTime, finalStartTime, finalEndTime);
|
||||
|
||||
if (item.getHasChild() == 1){
|
||||
queryWrapper.like(TpOrder::getAncestorsJs, item.getDeptId());
|
||||
}else {
|
||||
queryWrapper.eq(TpOrder::getDeptIdJs, item.getDeptId());
|
||||
}
|
||||
|
||||
List<TpOrder> list = orderMapper.selectList(queryWrapper);
|
||||
|
||||
item.setOrderCount(list.size());
|
||||
item.setComplaintCount(list.stream().filter(order -> "2".equals(order.getByTwo()) || "3".equals(order.getByTwo())).toList().size());
|
||||
item.setPerformance(list.stream().map(TpOrder::getJsPrice).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
item.setActualArrival(list.stream().map(TpOrder::getJsPayPrice).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
item.setMemberRecharge(list.stream().map(TpOrder::getCoupon).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
item.setDeduction(list.stream().map(TpOrder::getGjPrice).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
}
|
||||
|
||||
TpDeptCost tpDeptCost = deptCostMapper.selectOne(Wrappers.<TpDeptCost>lambdaQuery()
|
||||
.eq(TpDeptCost::getDeptReportId, item.getId()).eq(TpDeptCost::getMonth,bo.getMonth()));
|
||||
if (tpDeptCost != null) {
|
||||
item.setCostId(tpDeptCost.getId());
|
||||
item.setSocialCost(tpDeptCost.getSocialCost());
|
||||
item.setSalaryCost(tpDeptCost.getSalaryCost());
|
||||
item.setRentCost(tpDeptCost.getRentCost());
|
||||
item.setElectricityCost(tpDeptCost.getElectricityCost());
|
||||
item.setSalesCost(tpDeptCost.getSalesCost());
|
||||
}
|
||||
});
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的部门业绩报列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 部门业绩报列表
|
||||
*/
|
||||
@Override
|
||||
public List<TpDeptReportVo> queryList(TpDeptReportBo bo) {
|
||||
LambdaQueryWrapper<TpDeptReport> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TpDeptReport> buildQueryWrapper(TpDeptReportBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TpDeptReport> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(TpDeptReport::getSort);
|
||||
lqw.eq(bo.getDeptId() != null, TpDeptReport::getDeptId, bo.getDeptId());
|
||||
lqw.eq(bo.getDeptType() != null, TpDeptReport::getDeptType, bo.getDeptType());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), TpDeptReport::getDeptName, bo.getDeptName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTeamNo()), TpDeptReport::getTeamNo, bo.getTeamNo());
|
||||
lqw.eq(bo.getUserId() != null, TpDeptReport::getUserId, bo.getUserId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getUserName()), TpDeptReport::getUserName, bo.getUserName());
|
||||
lqw.eq(bo.getPerformance() != null, TpDeptReport::getPerformance, bo.getPerformance());
|
||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||
TpDeptReport::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门业绩报
|
||||
*
|
||||
* @param bo 部门业绩报
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TpDeptReportBo bo) {
|
||||
TpDeptReport add = MapstructUtils.convert(bo, TpDeptReport.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门业绩报
|
||||
*
|
||||
* @param bo 部门业绩报
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(TpDeptReportBo bo) {
|
||||
TpDeptReport update = MapstructUtils.convert(bo, TpDeptReport.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(TpDeptReport entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除部门业绩报信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -148,9 +148,11 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper, TpO
|
||||
.selectAs(SysDept::getDeptName,OrderRankingVo::getDeptName)
|
||||
.selectAs("count(1)",OrderRankingVo::getOrderNum)
|
||||
.selectAs("sum(price)",OrderRankingVo::getTotalPerformance)
|
||||
.selectAs("sum((pay_price + coupon) - kfpay)",OrderRankingVo::getCompletionAmount)
|
||||
// .selectAs("sum((pay_price + coupon) - kfpay)",OrderRankingVo::getCompletionAmount)
|
||||
.selectAs("sum((pay_price) - kfpay)",OrderRankingVo::getCompletionAmount)
|
||||
.selectAs("sum(end_price)",OrderRankingVo::getUnpaidAmount)
|
||||
.selectAs("concat(round(sum(pay_price + coupon)/(SELECT CASE WHEN m.gongsi = 0 THEN m.geren ELSE m.gongsi END AS result_field FROM tp_month m WHERE m.sid = t.sid AND m.`month` = '" + bo.getMonth() + "') * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
// .selectAs("concat(round(sum(pay_price + coupon)/(SELECT CASE WHEN m.gongsi = 0 THEN m.geren ELSE m.gongsi END AS result_field FROM tp_month m WHERE m.sid = t.sid AND m.`month` = '" + bo.getMonth() + "') * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
.selectAs("concat(round(sum(pay_price)/(SELECT CASE WHEN m.gongsi = 0 THEN m.geren ELSE m.gongsi END AS result_field FROM tp_month m WHERE m.sid = t.sid AND m.`month` = '" + bo.getMonth() + "') * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
.selectAs("concat(round(sum(end_price)/sum(price) * 100),'%')",OrderRankingVo::getDeadOrderRate)
|
||||
.leftJoin(SysUser.class,SysUser::getUserId,TpOrder::getSid)
|
||||
.leftJoin(SysDept.class,SysDept::getDeptId,SysUser::getDeptId)
|
||||
@@ -184,10 +186,10 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper, TpO
|
||||
.selectAs(SysDept::getDeptName,OrderRankingVo::getDeptName)
|
||||
.selectAs("count(1)",OrderRankingVo::getOrderNum)
|
||||
.selectAs("sum(js_price)",OrderRankingVo::getTotalPerformance)
|
||||
.selectAs("sum(js_pay_price + coupon)",OrderRankingVo::getCompletionAmount)
|
||||
.selectAs("sum(js_price) - sum(js_pay_price + coupon)",OrderRankingVo::getUnpaidAmount)
|
||||
.selectAs("concat(round(sum(js_pay_price + coupon)/sum(js_price) * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
.selectAs("concat(round((sum(js_price) - sum(js_pay_price + coupon))/sum(js_price) * 100),'%')",OrderRankingVo::getDeadOrderRate)
|
||||
.selectAs("sum(js_pay_price + round(coupon*(js_price/price),2))",OrderRankingVo::getCompletionAmount)
|
||||
.selectAs("sum(js_price) - sum(js_pay_price + round(coupon*(js_price/price),2))",OrderRankingVo::getUnpaidAmount)
|
||||
.selectAs("concat(round(sum(js_pay_price + coupon*(js_price/price))/sum(js_price) * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
.selectAs("concat(round((sum(js_price) - sum(js_pay_price + coupon*(js_price/price)))/sum(js_price) * 100),'%')",OrderRankingVo::getDeadOrderRate)
|
||||
.leftJoin(SysUser.class,SysUser::getUserId,TpOrder::getBid)
|
||||
.leftJoin(SysDept.class,SysDept::getDeptId,SysUser::getDeptId)
|
||||
.eq(TpOrder::getIsDel,1)
|
||||
@@ -217,8 +219,10 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper, TpO
|
||||
MPJLambdaWrapper<TpOrder> wrapper = buildQueryRankingMPJWrapper(bo)
|
||||
.selectAs("count(1)",OrderRankingSumVo::getTotalOrderNum)
|
||||
.selectAs("sum(price)",OrderRankingSumVo::getTotalPerformance)
|
||||
.selectAs("sum((pay_price + coupon) - kfpay)",OrderRankingSumVo::getTotalPaidAmount)
|
||||
.selectAs("concat(round(sum((pay_price + coupon) - kfpay)/sum(price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate)
|
||||
// .selectAs("sum((pay_price + coupon) - kfpay)",OrderRankingSumVo::getTotalPaidAmount)
|
||||
.selectAs("sum((pay_price) - kfpay)",OrderRankingSumVo::getTotalPaidAmount)
|
||||
// .selectAs("concat(round(sum((pay_price + coupon) - kfpay)/sum(price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate)
|
||||
.selectAs("concat(round(sum((pay_price) - kfpay)/sum(price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate)
|
||||
.leftJoin(SysUser.class,SysUser::getUserId,TpOrder::getSid)
|
||||
.leftJoin(SysDept.class,SysDept::getDeptId,SysUser::getDeptId)
|
||||
.eq(TpOrder::getIsDel,1);
|
||||
@@ -241,8 +245,8 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper, TpO
|
||||
MPJLambdaWrapper<TpOrder> wrapper = buildQueryRankingMPJWrapper(bo)
|
||||
.selectAs("count(1)",OrderRankingSumVo::getTotalOrderNum)
|
||||
.selectAs("sum(js_price)",OrderRankingSumVo::getTotalPerformance)
|
||||
.selectAs("sum(js_pay_price + coupon)",OrderRankingSumVo::getTotalPaidAmount)
|
||||
.selectAs("concat(round(sum(js_pay_price + coupon)/sum(js_price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate)
|
||||
.selectAs("sum(js_pay_price + round(coupon*(js_price/price),2))",OrderRankingSumVo::getTotalPaidAmount)
|
||||
.selectAs("concat(round(sum(js_pay_price + coupon*(js_price/price))/sum(js_price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate)
|
||||
.leftJoin(SysUser.class,SysUser::getUserId,TpOrder::getBid)
|
||||
.leftJoin(SysDept.class,SysDept::getDeptId,SysUser::getDeptId)
|
||||
.eq(TpOrder::getIsDel,1)
|
||||
|
||||
@@ -29,9 +29,11 @@ import org.dromara.system.mapper.SysRoleMapper;
|
||||
import org.dromara.system.mapper.SysUserMapper;
|
||||
import org.dromara.work.domain.*;
|
||||
import org.dromara.work.domain.bo.OrderRankingBo;
|
||||
import org.dromara.work.domain.bo.TpClientFundBo;
|
||||
import org.dromara.work.domain.bo.TpOrderBo;
|
||||
import org.dromara.work.domain.vo.*;
|
||||
import org.dromara.work.mapper.*;
|
||||
import org.dromara.work.service.ITpClientFundService;
|
||||
import org.dromara.work.service.ITpOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
@@ -82,6 +84,8 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
|
||||
private final TpStaffPayMapper staffPayMapper;
|
||||
|
||||
private final ITpClientFundService tpClientFundService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单管理
|
||||
@@ -651,6 +655,11 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
}
|
||||
bo.setEndPrice(endPrice);
|
||||
bo.setJsPrice(bo.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice()));
|
||||
|
||||
// 判断技术已支付是否大于技术价格
|
||||
if(order.getJsPayPrice().compareTo(bo.getJsPrice()) > 0){
|
||||
bo.setJsPayPrice(bo.getJsPrice());
|
||||
}
|
||||
TpOrder update = MapstructUtils.convert(bo, TpOrder.class);
|
||||
boolean res = saveOrderRecord(order.getId(),"修改订单","订单:"+order.getOrderId()+" 修改成功",1,bo.getRecord());
|
||||
if(!res){
|
||||
@@ -695,7 +704,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
LambdaUpdateWrapper<TpOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(TpOrder::getId, order.getId())
|
||||
.set(TpOrder::getBreach, bo.getBreach())
|
||||
.set(TpOrder::getJsPayPrice, getJsPay(jsPayPrice.subtract(bo.getBreach())));
|
||||
.set(TpOrder::getJsPayPrice, jsPayPrice.subtract(bo.getBreach()));
|
||||
return baseMapper.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
@@ -833,6 +842,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int orderPay(Long orderId, Integer type, BigDecimal price) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
TpOrder order = baseMapper.selectById(orderId);
|
||||
if(order.getPayState() == 3){
|
||||
throw new ServiceException("该订单已付清,不可再支付");
|
||||
@@ -859,6 +869,10 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
if(clientStaff.getYue().subtract(price).compareTo(BigDecimal.ZERO) < 0){
|
||||
throw new ServiceException("客户账户余额不足");
|
||||
}
|
||||
|
||||
TpClientFundBo tpClientFund = new TpClientFundBo();
|
||||
tpClientFund.setBalanceBefore(clientStaff.getYue());
|
||||
|
||||
clientStaff.setYue(clientStaff.getYue().subtract(price));
|
||||
clientStaffMapper.updateById(clientStaff);
|
||||
|
||||
@@ -868,6 +882,18 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
|
||||
order.setKhpay(order.getKhpay().add(price));
|
||||
|
||||
// 添加客户资金日志
|
||||
tpClientFund.setKId(client.getId());
|
||||
tpClientFund.setSkId(clientStaff.getId());
|
||||
tpClientFund.setBizType(2);
|
||||
tpClientFund.setChangeAmount(price);
|
||||
tpClientFund.setBalanceAfter(clientStaff.getYue());
|
||||
tpClientFund.setOrderId(order.getId());
|
||||
tpClientFund.setOrderNo(order.getOrderId());
|
||||
tpClientFund.setCreateBy(loginUser.getUserId());
|
||||
tpClientFund.setRemark("订单消费");
|
||||
tpClientFundService.insertByBo(tpClientFund);
|
||||
|
||||
boolean res = saveOrderRecord(order.getId(),"订单支付","订单:"+order.getOrderId()+" 客户支付金额:"+price+" 成功",1,null);
|
||||
if(!res){
|
||||
throw new ServiceException("订单支付失败");
|
||||
@@ -906,7 +932,8 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
order.setGpay(getGjPayPrice(order.getPrice(),newPayPrice.add(order.getCoupon()),order.getGjPrice()));
|
||||
}
|
||||
BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),newPayPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice()));
|
||||
order.setJsPayPrice(getJsPay(jsPayPrice.subtract(order.getBreach())));
|
||||
// order.setJsPayPrice(getJsPay(jsPayPrice.subtract(order.getBreach())));
|
||||
order.setJsPayPrice(jsPayPrice.subtract(order.getBreach()));
|
||||
order.setState(2);
|
||||
order.setPayPrice(newPayPrice);
|
||||
BigDecimal endPrice = order.getPrice().subtract(newPayPrice.add(order.getCoupon()));
|
||||
@@ -942,6 +969,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int fallback(Long orderId, Integer type, BigDecimal price) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
TpOrder order = baseMapper.selectById(orderId);
|
||||
if(order.getPayState() == 1){
|
||||
throw new ServiceException("该订单未支付,不可回退");
|
||||
@@ -965,6 +993,10 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
throw new ServiceException("回退金额不可以大于已支付金额");
|
||||
}
|
||||
TpClientStaff clientStaff = clientStaffMapper.selectById(order.getSkid());
|
||||
|
||||
TpClientFundBo tpClientFund = new TpClientFundBo();
|
||||
tpClientFund.setBalanceBefore(clientStaff.getYue());
|
||||
|
||||
clientStaff.setYue(clientStaff.getYue().add(price));
|
||||
clientStaffMapper.updateById(clientStaff);
|
||||
TpClient client = clientMapper.selectById(clientStaff.getKid());
|
||||
@@ -972,6 +1004,18 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
clientMapper.updateById(client);
|
||||
order.setKhpay(order.getKhpay().subtract(price));
|
||||
|
||||
// 添加客户资金日志
|
||||
tpClientFund.setKId(client.getId());
|
||||
tpClientFund.setSkId(clientStaff.getId());
|
||||
tpClientFund.setBizType(3);
|
||||
tpClientFund.setChangeAmount(price);
|
||||
tpClientFund.setBalanceAfter(clientStaff.getYue());
|
||||
tpClientFund.setOrderId(order.getId());
|
||||
tpClientFund.setOrderNo(order.getOrderId());
|
||||
tpClientFund.setCreateBy(loginUser.getUserId());
|
||||
tpClientFund.setRemark("订单回退");
|
||||
tpClientFundService.insertByBo(tpClientFund);
|
||||
|
||||
boolean res = saveOrderRecord(order.getId(),"订单回退","订单:"+order.getOrderId()+" 客户回退金额:"+price+" 成功",1,null);
|
||||
if(!res){
|
||||
throw new ServiceException("订单回退失败");
|
||||
@@ -995,7 +1039,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
order.setGpay(getGjPayPrice(order.getPrice(),payPrice.add(order.getCoupon()),order.getGjPrice()));
|
||||
}
|
||||
BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),payPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice()));
|
||||
order.setJsPayPrice(getJsPay(jsPayPrice));
|
||||
order.setJsPayPrice(jsPayPrice);
|
||||
|
||||
order.setPayPrice(payPrice);
|
||||
return baseMapper.updateById(order);
|
||||
@@ -1044,7 +1088,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
order.setGpay(getGjPayPrice(order.getPrice(),order.getPayPrice(),order.getGjPrice()));
|
||||
}
|
||||
BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),order.getPayPrice(),order.getPrice().subtract(order.getGjPrice()).subtract(price));
|
||||
order.setJsPayPrice(getJsPay(jsPayPrice));
|
||||
order.setJsPayPrice(jsPayPrice);
|
||||
}
|
||||
boolean res = saveOrderRecord(order.getId(),"订单拆单","订单:"+order.getOrderId()+"拆单成功!拆单金额:"+price,1,null);
|
||||
if(!res){
|
||||
@@ -1080,15 +1124,19 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
TpOrder order = baseMapper.selectById(orderId);
|
||||
//已支付减去改价金额
|
||||
BigDecimal payPrice = order.getPayPrice().subtract(price);
|
||||
if(order.getPayState() != 1){
|
||||
|
||||
if(order.getPayState() == 3){
|
||||
if(payPrice.compareTo(BigDecimal.ZERO) < 0){
|
||||
throw new ServiceException("改价金额不能大于客户已付金额");
|
||||
}
|
||||
}
|
||||
|
||||
if(order.getPayState() != 1){
|
||||
order.setGjPrice(price);
|
||||
order.setJsPrice(order.getPrice().subtract(order.getCdPrice()).subtract(price));
|
||||
order.setGpay(getGjPayPrice(order.getPrice(),order.getPayPrice().add(order.getCoupon()),price));
|
||||
BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),order.getPayPrice(),order.getPrice().subtract(order.getCdPrice()).subtract(price));
|
||||
order.setJsPayPrice(getJsPay(jsPayPrice.subtract(order.getBreach())));
|
||||
order.setJsPayPrice(jsPayPrice.subtract(order.getBreach()));
|
||||
}else{
|
||||
order.setGjPrice(price);
|
||||
order.setJsPrice(order.getPrice().subtract(order.getCdPrice()).subtract(price));
|
||||
@@ -1326,7 +1374,8 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
vo.setOrderCount(orderCount);
|
||||
|
||||
MPJLambdaWrapper<TpOrder> olqw = buildQueryMPJWrapper(bo);
|
||||
olqw.select(TpOrder::getId,TpOrder::getPrice,TpOrder::getGjPrice,TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getCoupon)
|
||||
olqw.select(TpOrder::getId,TpOrder::getPrice,TpOrder::getGjPrice,TpOrder::getJsPrice,TpOrder::getJsPayPrice)
|
||||
.selectAs("round(t.coupon*(t.js_price/t.price),2)",TpOrderVo::getCoupon)
|
||||
.leftJoin(SysUser.class,"s",SysUser::getUserId,TpOrder::getSid)
|
||||
.leftJoin(SysUser.class,"f",SysUser::getUserId,TpOrder::getFid)
|
||||
.leftJoin(SysUser.class,"b",SysUser::getUserId,TpOrder::getBid)
|
||||
|
||||
@@ -16,12 +16,14 @@ import org.dromara.system.domain.SysUser;
|
||||
import org.dromara.work.domain.TpClient;
|
||||
import org.dromara.work.domain.TpClientStaff;
|
||||
import org.dromara.work.domain.TpReceipt;
|
||||
import org.dromara.work.domain.bo.TpClientFundBo;
|
||||
import org.dromara.work.domain.bo.TpReceiptBo;
|
||||
import org.dromara.work.domain.vo.ReceiptSumVo;
|
||||
import org.dromara.work.domain.vo.TpReceiptVo;
|
||||
import org.dromara.work.mapper.TpClientMapper;
|
||||
import org.dromara.work.mapper.TpClientStaffMapper;
|
||||
import org.dromara.work.mapper.TpReceiptMapper;
|
||||
import org.dromara.work.service.ITpClientFundService;
|
||||
import org.dromara.work.service.ITpReceiptService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
@@ -49,6 +51,8 @@ public class TpReceiptServiceImpl extends MPJBaseServiceImpl<TpReceiptMapper,TpR
|
||||
|
||||
private final TpClientStaffMapper clientStaffMapper;
|
||||
|
||||
private final ITpClientFundService tpClientFundService;
|
||||
|
||||
/**
|
||||
* 查询收款管理
|
||||
*
|
||||
@@ -270,6 +274,7 @@ public class TpReceiptServiceImpl extends MPJBaseServiceImpl<TpReceiptMapper,TpR
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int updateClaimByBo(TpReceiptBo bo) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
TpClientFundBo tpClientFund = new TpClientFundBo();
|
||||
|
||||
TpClientStaff clientStaff = clientStaffMapper.selectById(bo.getCid());
|
||||
TpClient client = clientMapper.selectById(clientStaff.getKid());
|
||||
@@ -280,6 +285,12 @@ public class TpReceiptServiceImpl extends MPJBaseServiceImpl<TpReceiptMapper,TpR
|
||||
if(receipt.getState() == 2){
|
||||
throw new ServiceException("该笔汇款:" + receipt.getId() + "已认领,不能重复认领!");
|
||||
}
|
||||
tpClientFund.setKId(client.getId());
|
||||
tpClientFund.setSkId(clientStaff.getId());
|
||||
tpClientFund.setBizType(1);
|
||||
tpClientFund.setChangeAmount(receipt.getPrice());
|
||||
tpClientFund.setBalanceBefore(clientStaff.getYue());
|
||||
|
||||
receipt.setState(2);
|
||||
receipt.setCid(clientStaff.getId());
|
||||
// receipt.setCname(client.getName());
|
||||
@@ -291,7 +302,14 @@ public class TpReceiptServiceImpl extends MPJBaseServiceImpl<TpReceiptMapper,TpR
|
||||
clientStaff.setYue(clientStaff.getYue().add(receipt.getPrice()));
|
||||
client.setYue(client.getYue().add(receipt.getPrice()));
|
||||
clientStaffMapper.updateById(clientStaff);
|
||||
return clientMapper.updateById(client);
|
||||
clientMapper.updateById(client);
|
||||
|
||||
// 添加客户资金日志
|
||||
tpClientFund.setBalanceAfter(clientStaff.getYue());
|
||||
tpClientFund.setReceiptId(receipt.getId());
|
||||
tpClientFund.setCreateBy(loginUser.getUserId());
|
||||
tpClientFund.setRemark("领款入账");
|
||||
return tpClientFundService.insertByBo(tpClientFund);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,6 +321,8 @@ public class TpReceiptServiceImpl extends MPJBaseServiceImpl<TpReceiptMapper,TpR
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public int updateBackByBo(TpReceiptBo bo) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
TpClientFundBo tpClientFund = new TpClientFundBo();
|
||||
|
||||
TpReceipt receipt = baseMapper.selectById(bo.getId());
|
||||
if(receipt.getIsDel() == 2){
|
||||
throw new ServiceException("该笔汇款:" + receipt.getId() + "已作废,不能回退!");
|
||||
@@ -311,13 +331,19 @@ public class TpReceiptServiceImpl extends MPJBaseServiceImpl<TpReceiptMapper,TpR
|
||||
throw new ServiceException("该笔汇款:" + receipt.getId() + "未认领,不能回退!");
|
||||
}
|
||||
TpClientStaff clientStaff = clientStaffMapper.selectById(receipt.getCid());
|
||||
TpClient client = clientMapper.selectById(clientStaff.getKid());
|
||||
|
||||
tpClientFund.setKId(client.getId());
|
||||
tpClientFund.setSkId(clientStaff.getId());
|
||||
tpClientFund.setBizType(4);
|
||||
tpClientFund.setChangeAmount(receipt.getPrice());
|
||||
tpClientFund.setBalanceBefore(clientStaff.getYue());
|
||||
|
||||
BigDecimal yue = clientStaff.getYue().subtract(receipt.getPrice());
|
||||
if(yue.compareTo(BigDecimal.ZERO) < 0){
|
||||
throw new ServiceException("客户账户余额不足,请联系客服");
|
||||
}
|
||||
|
||||
TpClient client = clientMapper.selectById(clientStaff.getKid());
|
||||
BigDecimal yue1 = client.getYue().subtract(receipt.getPrice());
|
||||
if(yue1.compareTo(BigDecimal.ZERO) < 0){
|
||||
throw new ServiceException("客户账户余额不足,请联系客服");
|
||||
@@ -339,6 +365,14 @@ public class TpReceiptServiceImpl extends MPJBaseServiceImpl<TpReceiptMapper,TpR
|
||||
clientStaffMapper.updateById(clientStaff);
|
||||
|
||||
client.setYue(yue1);
|
||||
return clientMapper.updateById(client);
|
||||
clientMapper.updateById(client);
|
||||
|
||||
// 添加客户资金日志
|
||||
tpClientFund.setBalanceAfter(yue);
|
||||
tpClientFund.setReceiptId(receipt.getId());
|
||||
tpClientFund.setCreateBy(loginUser.getUserId());
|
||||
tpClientFund.setRemark("领款回退");
|
||||
|
||||
return tpClientFundService.insertByBo(tpClientFund);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.work.mapper.TpClientFundMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.work.mapper.TpDeptCostMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.work.mapper.TpDeptReportMapper">
|
||||
|
||||
</mapper>
|
||||
107
scripts/install_maven.ps1
Normal file
107
scripts/install_maven.ps1
Normal file
@@ -0,0 +1,107 @@
|
||||
<#
|
||||
Windows PowerShell script to install Maven 3.6.x+ (binary) on Windows.
|
||||
This script downloads the binary, extracts it, sets MAVEN_HOME and PATH for the user,
|
||||
and verifies mvn -version. ASCII-only messages to minimize encoding issues.
|
||||
Usage:
|
||||
powershell -ExecutionPolicy Bypass -File scripts/install_maven.ps1 -Version 3.6.3
|
||||
powershell -ExecutionPolicy Bypass -File scripts/install_maven.ps1 -Version latest
|
||||
Notes:
|
||||
- Version must be a specific 3.6.x (currently supports 3.6.3).
|
||||
- InstallDir defaults to C:\Program Files\Maven.
|
||||
- ApiKey is accepted for future use; not used by Maven itself.
|
||||
"""
|
||||
#>
|
||||
|
||||
param(
|
||||
[ValidateSet("latest","3.6.3")]
|
||||
[string]$Version = "3.6.3",
|
||||
[string]$InstallDir = "C:\\Program Files\\Maven",
|
||||
[string]$ApiKey = $null
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "Installing Maven..."
|
||||
|
||||
if (-Not (Test-Path $InstallDir)) {
|
||||
try {
|
||||
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
|
||||
} catch {
|
||||
$InstallDir = Join-Path $env:USERPROFILE "maven"
|
||||
if (-Not (Test-Path $InstallDir)) {
|
||||
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($Version -eq "latest") {
|
||||
Write-Error "Latest version not auto-resolved in this script. Please specify 3.6.3."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$zipName = "apache-maven-$Version-bin.zip"
|
||||
$url = "https://archive.apache.org/dist/maven/maven-3/$Version/binaries/$zipName"
|
||||
$tempZip = Join-Path $env:TEMP $zipName
|
||||
$destDir = Join-Path $InstallDir "apache-maven-$Version"
|
||||
|
||||
if (Test-Path $destDir) {
|
||||
Write-Host "Maven already installed at $destDir"; exit 0
|
||||
}
|
||||
|
||||
Write-Host "Downloading Maven $Version..."
|
||||
$maxRetries = 3
|
||||
$attempt = 0
|
||||
while ($attempt -lt $maxRetries) {
|
||||
try {
|
||||
Invoke-WebRequest -Uri $url -OutFile $tempZip -ErrorAction Stop
|
||||
break
|
||||
} catch {
|
||||
$attempt++
|
||||
if ($attempt -ge $maxRetries) {
|
||||
Write-Error "Failed to download Maven after $maxRetries attempts. Please check network and proxy settings."
|
||||
exit 1
|
||||
}
|
||||
Write-Warning "Download failed. Retrying ($attempt/$maxRetries)..."
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Extracting to $InstallDir..."
|
||||
Expand-Archive -Path $tempZip -DestinationPath $InstallDir -Force
|
||||
|
||||
$mavenHome = (Join-Path $InstallDir "apache-maven-$Version").TrimEnd('\\')
|
||||
if (-Not (Test-Path $mavenHome)) {
|
||||
Write-Error "Extraction failed: Maven directory not found: $mavenHome"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set MAVEN_HOME and PATH (user scope)
|
||||
Write-Host "Configuring environment variables..."
|
||||
[Environment]::SetEnvironmentVariable("MAVEN_HOME", $mavenHome, [EnvironmentVariableTarget]::User)
|
||||
$binPath = Join-Path $mavenHome "bin"
|
||||
$sep = [System.IO.Path]::PathSeparator
|
||||
$pathValue = [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User)
|
||||
if (-not ($pathValue -and $pathValue -like "*$binPath*")) {
|
||||
if (-not $pathValue) { $newPath = $binPath } else { $newPath = $pathValue + $sep + $binPath }
|
||||
[Environment]::SetEnvironmentVariable("PATH", $newPath, [EnvironmentVariableTarget]::User)
|
||||
Write-Host "PATH updated to include $binPath"
|
||||
} else {
|
||||
Write-Host "PATH already includes Maven bin: $binPath"
|
||||
}
|
||||
|
||||
Write-Host "Verifying mvn version..."
|
||||
try {
|
||||
$mvnVer = & "$mavenHome\\bin\\mvn" -version
|
||||
Write-Host $mvnVer
|
||||
} catch {
|
||||
Write-Error "Could not run mvn. Ensure PATH is set correctly and reopen a new terminal."
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Maven installation complete."
|
||||
|
||||
if (-not [string]::IsNullOrEmpty($ApiKey)) {
|
||||
Write-Host "Note: API key provided, but not used by Maven."
|
||||
}
|
||||
|
||||
Exit 0
|
||||
88
scripts/install_opencode_supermemory.ps1
Normal file
88
scripts/install_opencode_supermemory.ps1
Normal file
@@ -0,0 +1,88 @@
|
||||
<#
|
||||
OpenCode 插件安装脚本:install_opencode_supermemory.ps1
|
||||
功能:在 Windows 环境下,使用本地 bun.exe 安装 opencode-supermemory 插件,支持指定版本或 latest,并可注入 SUPERMEMORY_API_KEY。
|
||||
用法示例:
|
||||
- 指定版本安装:powershell -ExecutionPolicy Bypass -File scripts\install_opencode_supermemory.ps1 -Version 3.3.8 -ApiKey "sm_你的密钥"
|
||||
- 安装最新版本:powershell -ExecutionPolicy Bypass -File scripts\install_opencode_supermemory.ps1 -Version latest
|
||||
#>
|
||||
|
||||
param(
|
||||
[ValidateSet("latest","3.3.8")]
|
||||
[string]$Version = "3.3.8",
|
||||
[string]$BunExePath = "C:\\Soft\\bun-windows-x64\\bun.exe",
|
||||
[string]$ApiKey
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "---------- OpenCode: Install opencode-supermemory ----------"
|
||||
|
||||
if (-Not (Test-Path $BunExePath)) {
|
||||
Write-Error "Bun 可执行文件未找到:$BunExePath"
|
||||
Write-Host "请确保 bun.exe 位于该路径,或调整参数 -BunExePath。"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 1) 将 Bun 目录加入用户 PATH(确保会话后续可用)
|
||||
$bunDir = [System.IO.Path]::GetDirectoryName($BunExePath)
|
||||
try {
|
||||
$currentPath = [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User)
|
||||
$paths = @($currentPath -split ";" | Where-Object { $_ -and $_ -ne $null })
|
||||
if (-Not ($paths -contains $bunDir)) {
|
||||
$newPath = $currentPath + ";" + $bunDir
|
||||
[Environment]::SetEnvironmentVariable("PATH", $newPath, [EnvironmentVariableTarget]::User)
|
||||
Write-Host "PATH 已更新,已包含 Bun 目录:$bunDir (用户作用域)"
|
||||
} else {
|
||||
Write-Host "PATH 已包含 Bun 目录:$bunDir"
|
||||
}
|
||||
} catch {
|
||||
Write-Warning "无法更新 PATH:$($_.Exception.Message)"
|
||||
}
|
||||
|
||||
# 2) 验证 bun 与 bunx 是否可用
|
||||
try {
|
||||
$bunVer = & "${BunExePath}" --version
|
||||
Write-Host "Bun 版本:$bunVer"
|
||||
$bunxPath = Join-Path $bunDir "bunx.exe"
|
||||
if (Test-Path $bunxPath) {
|
||||
$bunxVer = & "$bunxPath" --version
|
||||
Write-Host "Bunx 版本:$bunxVer"
|
||||
} else {
|
||||
Write-Host "未找到 bunx.exe,将使用 bun.exe 进行安装。"
|
||||
}
|
||||
} catch {
|
||||
Write-Error "无法验证 Bun:$($_.Exception.Message)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 3) 安装插件
|
||||
if ($Version -eq "latest") {
|
||||
$installTarget = "opencode-supermemory@latest install"
|
||||
} else {
|
||||
$installTarget = "opencode-supermemory@${Version} install"
|
||||
}
|
||||
|
||||
try {
|
||||
if (Test-Path (Join-Path $bunDir "bunx.exe")) {
|
||||
& (Join-Path $bunDir "bunx.exe") $installTarget
|
||||
} else {
|
||||
& (Join-Path $bunDir "bun.exe") $installTarget
|
||||
}
|
||||
} catch {
|
||||
Write-Error "安装插件失败: $($_.Exception.Message)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 4) 设置 SUPERMEMORY_API_KEY(若提供)
|
||||
if (-not [string]::IsNullOrEmpty($ApiKey)) {
|
||||
[Environment]::SetEnvironmentVariable("SUPERMEMORY_API_KEY", $ApiKey, [EnvironmentVariableTarget]::User)
|
||||
Write-Host "SUPERMEMORY_API_KEY 已设置(用户级变量)"
|
||||
} elseif ($Env:SUPERMEMORY_API_KEY) {
|
||||
Write-Host "检测到已有 SUPERMEMORY_API_KEY 环境变量。"
|
||||
} else {
|
||||
Write-Host "未提供 SUPERMEMORY_API_KEY。若要使用云记忆,请提供密钥。"
|
||||
}
|
||||
|
||||
Write-Host "安装流程完成。请重新打开终端以刷新 PATH 与环境变量。"
|
||||
|
||||
Exit 0
|
||||
Reference in New Issue
Block a user