完成了第一版
This commit is contained in:
parent
1a14df8296
commit
943454c734
|
@ -118,15 +118,11 @@ public class ProjectSettlementController {
|
|||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目结算记录管理", content = "web端管理员添加项目结算记录")
|
||||
public BaseResponse<Boolean> addProjectSettlement(@Valid @RequestBody ProjectSettlementAddRequest projectSettlementAddRequest) {
|
||||
// 添加当前用户的项目结算记录
|
||||
ProjectSettlement projectSettlement = commonService.copyProperties(projectSettlementAddRequest, ProjectSettlement.class);
|
||||
projectSettlementService.save(projectSettlement);
|
||||
|
||||
// 查询对应的推广码申请记录
|
||||
Long applyId = projectSettlement.getPromoCodeApplyId();
|
||||
PromoCodeApply promoCodeApply = promoCodeApplyService.getById(applyId);
|
||||
// 获取推广码申请记录的参数
|
||||
String projectName = promoCodeApply.getProjectName();
|
||||
Long userId = promoCodeApply.getUserId();
|
||||
Long userId = projectSettlement.getUserId();
|
||||
UserMainInfo userMainInfo = userMainInfoService.getById(userId);
|
||||
BigDecimal currentBalance = userMainInfo.getCurrentBalance();
|
||||
// 获取项目结算记录的参数
|
||||
|
@ -135,7 +131,6 @@ public class ProjectSettlementController {
|
|||
// 获取项目明细的结算价格
|
||||
Long projectDetailId = projectSettlement.getProjectDetailId();
|
||||
ProjectDetail projectDetail = projectDetailService.getById(projectDetailId);
|
||||
BigDecimal projectSettlementPrice = projectDetail.getProjectSettlementPrice();
|
||||
BigDecimal projectMinSettlementPrice = projectDetail.getProjectMinSettlementPrice();
|
||||
// 批量添加上级用户的项目结算记录
|
||||
List<SubUserProjectCommission> subUserProjectCommissionList = commonService.findByFieldEqTargetField(SubUserProjectCommission::getProjectDetailId, projectDetailId, subUserProjectCommissionService);
|
||||
|
@ -146,7 +141,9 @@ public class ProjectSettlementController {
|
|||
Long subUid = subUserProjectCommission.getSubUserId();
|
||||
BigDecimal myUnitPrice = subUserProjectCommission.getMyUnitPrice();
|
||||
BigDecimal currentCommissionRate = subUserProjectCommission.getCurrentCommissionRate();
|
||||
subUserProjectCommissionMap.put(uid + "-" + subUid, myUnitPrice.multiply(currentCommissionRate));
|
||||
BigDecimal agentUnitPrice = myUnitPrice.multiply(BigDecimal.ONE.subtract(currentCommissionRate));
|
||||
if (agentUnitPrice.compareTo(projectMinSettlementPrice) <= 0) agentUnitPrice = projectMinSettlementPrice;
|
||||
subUserProjectCommissionMap.put(uid + "-" + subUid, myUnitPrice.subtract(agentUnitPrice));
|
||||
}
|
||||
List<ProjectSettlement> projectSettlementList = new ArrayList<>();
|
||||
// 获取当前用户到根用户的路径
|
||||
|
@ -155,17 +152,19 @@ public class ProjectSettlementController {
|
|||
Long uid = pathToRoot.get(i);
|
||||
Long subUid = pathToRoot.get(i + 1);
|
||||
BigDecimal commissionRatePrice = subUserProjectCommissionMap.get(uid + "-" + subUid);
|
||||
if (commissionRatePrice.compareTo(BigDecimal.ZERO) == 0) continue;
|
||||
ProjectSettlement projectSettle = commonService.copyProperties(projectSettlementAddRequest, ProjectSettlement.class);
|
||||
projectSettle.setSettlementRevenue(commissionRatePrice);
|
||||
projectSettle.setRevenueSource(true);
|
||||
projectSettle.setSuperId(projectSettlementId);
|
||||
projectSettle.setUserId(uid);
|
||||
projectSettlementList.add(projectSettle);
|
||||
}
|
||||
projectSettlementService.saveBatch(projectSettlementList);
|
||||
|
||||
// 添加资金变动记录
|
||||
// 添加当前用户的资金变动记录
|
||||
FundsChange fundsChange = FundsChange.builder()
|
||||
.projectName(projectName)
|
||||
.projectName(projectSettlement.getProjectDetailName())
|
||||
.changeAmount(settlementRevenue)
|
||||
.currentAmount(currentBalance.add(settlementRevenue))
|
||||
.userId(userId)
|
||||
|
@ -173,9 +172,20 @@ public class ProjectSettlementController {
|
|||
.build();
|
||||
fundsChangeService.save(fundsChange);
|
||||
|
||||
// 批量添加下级用户的项目结算记录
|
||||
// 批量添加上级用户的项目结算记录
|
||||
List<FundsChange> fundsChangeList = new ArrayList<>();
|
||||
for (ProjectSettlement projectSettle : projectSettlementList) {
|
||||
FundsChange funds = FundsChange.builder()
|
||||
.projectName(projectSettle.getProjectDetailName())
|
||||
.changeAmount(projectSettle.getSettlementRevenue())
|
||||
.userId(projectSettle.getUserId())
|
||||
.projectSettlementId(projectSettle.getId())
|
||||
.build();
|
||||
fundsChangeList.add(funds);
|
||||
}
|
||||
fundsChangeService.saveBatch(fundsChangeList);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
// /**
|
||||
|
@ -249,7 +259,6 @@ public class ProjectSettlementController {
|
|||
public BaseResponse<ProjectSettlementVO> queryProjectSettlementById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
ProjectSettlement projectSettlement = projectSettlementService.getById(id);
|
||||
ThrowUtils.throwIf(projectSettlement == null, ErrorCode.OPERATION_ERROR, "当前项目结算记录不存在");
|
||||
ProjectSettlementVO projectSettlementVO = commonService.copyProperties(projectSettlement, ProjectSettlementVO.class);
|
||||
return ResultUtils.success(projectSettlementVO);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ import java.time.LocalDateTime;
|
|||
"settlementTime",
|
||||
"promoCodeApplyId",
|
||||
"projectId",
|
||||
"projectDetailId"
|
||||
"projectDetailId",
|
||||
"userId"
|
||||
})
|
||||
public class ProjectSettlementAddRequest implements Serializable {
|
||||
|
||||
|
@ -78,6 +79,13 @@ public class ProjectSettlementAddRequest implements Serializable {
|
|||
@Schema(description = "项目明细", example = "1")
|
||||
private Long projectDetailId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Min(value = 1L, message = "用户id ID不能小于1")
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -79,6 +79,11 @@ public class ProjectSettlement implements Serializable {
|
|||
*/
|
||||
private Long superId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
|
|
87
src/main/resources/application-test-caozhe.yml
Normal file
87
src/main/resources/application-test-caozhe.yml
Normal file
|
@ -0,0 +1,87 @@
|
|||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://1.94.237.210:3306/qingcheng-test-caozhe?serverTimezone=Asia/Shanghai
|
||||
username: qingcheng
|
||||
password: Qc@123456
|
||||
hikari:
|
||||
maximum-pool-size: 20
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
host: 154.8.193.216
|
||||
database: 7
|
||||
password: Cksys6509
|
||||
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
|
||||
|
||||
springdoc:
|
||||
default-flat-param-object: true
|
||||
|
||||
#线程池配置
|
||||
threadpool:
|
||||
corePoolSize: 10
|
||||
maxPoolSize: 50
|
||||
queueCapacity: 1024
|
||||
keepAliveTime: 60
|
||||
|
||||
|
||||
server:
|
||||
port: 3456
|
||||
|
||||
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: false
|
||||
# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: isDelete #全局逻辑删除的实体字段名
|
||||
logic-delete-value: 1 #逻辑已删除值(默认为1)
|
||||
logic-not-delete-value: 0 #逻辑未删除值(默认为0)
|
||||
type-handlers-package: com.cultural.heritage.handler
|
||||
|
||||
|
||||
|
||||
wx:
|
||||
mini:
|
||||
appId: wx3f968a09e31d6bed
|
||||
appSecret: 0b23498d19665dc323efdd3ed5367041
|
||||
|
||||
pay:
|
||||
#应用id(小程序id)
|
||||
appId: wx61b63e27bddf4ea2
|
||||
#商户号
|
||||
merchantId: 1700326544
|
||||
# #商户API私钥
|
||||
# privateKeyPath: apiclient_key.pem
|
||||
#商户证书序列号
|
||||
merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
||||
# #商户APIv3密钥
|
||||
# apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||
#通知地址
|
||||
notifyUrl: https://winning-mouse-internally.ngrok-free.app
|
||||
#微信服务器地址
|
||||
domain: https://api.mch.weixin.qq.com
|
||||
#商户APIv2密钥
|
||||
apiV2Key: cvsOH6TgbbdNUUqFJyLmWGaIEKoSqANg
|
||||
#商户API证书
|
||||
certificatePath: static/apiclient_cert.p12
|
||||
|
||||
|
||||
|
||||
|
||||
knife4j:
|
||||
enable: true
|
|
@ -1,4 +1,4 @@
|
|||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: test-caozhe
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user