Compare commits
16 Commits
5b4d2afc5a
...
graduation
| Author | SHA1 | Date | |
|---|---|---|---|
| ab6a124497 | |||
| 3fa9f1282e | |||
| b007d0545d | |||
| 7634bc7385 | |||
| 64c1f2bf9a | |||
| f189f53b2c | |||
| 6544da8394 | |||
| f7150d5dfc | |||
| be18538e64 | |||
| d25fa959b6 | |||
| 6b2bce2b61 | |||
| f38160c3f6 | |||
| 6e31701403 | |||
| 1ad79f600d | |||
| c87006e721 | |||
| 6985cf39aa |
@ -4,6 +4,7 @@ import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
@ -57,9 +58,14 @@ public class PermissionCheck {
|
||||
ThrowUtils.throwIf(interfaceRoleEnum == null, ErrorCode.NO_AUTH_ERROR);
|
||||
// 获取用户权限
|
||||
String token = request.getHeader("Authorization");
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(token), ErrorCode.NO_AUTH_ERROR, "JWT为空");
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(token), ErrorCode.NO_AUTH_ERROR, "token为空");
|
||||
// 解析token
|
||||
DecodedJWT decodedJWT = jwtUtils.verify(token);
|
||||
DecodedJWT decodedJWT;
|
||||
try {
|
||||
decodedJWT = jwtUtils.verify(token);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(ErrorCode.NO_AUTH_ERROR, "token已过期");
|
||||
}
|
||||
String userAccount = decodedJWT.getClaim("userAccount").asString();
|
||||
String userPassword = decodedJWT.getClaim("userPassword").asString();
|
||||
String userRole = decodedJWT.getClaim("userRole").asString();
|
||||
|
||||
@ -1,44 +1,44 @@
|
||||
package com.greenorange.promotion.config;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
||||
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "wx.mini")
|
||||
public class WxOpenConfig {
|
||||
|
||||
private String appId;
|
||||
|
||||
private String appSecret;
|
||||
|
||||
private WxMaService wxMaService;
|
||||
|
||||
/**
|
||||
* 单例模式
|
||||
*/
|
||||
public WxMaService getWxMaService() {
|
||||
if (wxMaService != null) {
|
||||
return wxMaService;
|
||||
}
|
||||
synchronized (this) {
|
||||
if (wxMaService != null) {
|
||||
return wxMaService;
|
||||
}
|
||||
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
||||
config.setAppid(appId);
|
||||
config.setSecret(appSecret);
|
||||
WxMaService service = new WxMaServiceImpl();
|
||||
service.setWxMaConfig(config);
|
||||
wxMaService = service;
|
||||
return wxMaService;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//package com.greenorange.promotion.config;
|
||||
//
|
||||
//import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
//import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
||||
//import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
||||
//import lombok.Data;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//@Data
|
||||
//@Slf4j
|
||||
//@Configuration
|
||||
//@ConfigurationProperties(prefix = "wx.mini")
|
||||
//public class WxOpenConfig {
|
||||
//
|
||||
// private String appId;
|
||||
//
|
||||
// private String appSecret;
|
||||
//
|
||||
// private WxMaService wxMaService;
|
||||
//
|
||||
// /**
|
||||
// * 单例模式
|
||||
// */
|
||||
// public WxMaService getWxMaService() {
|
||||
// if (wxMaService != null) {
|
||||
// return wxMaService;
|
||||
// }
|
||||
// synchronized (this) {
|
||||
// if (wxMaService != null) {
|
||||
// return wxMaService;
|
||||
// }
|
||||
// WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
||||
// config.setAppid(appId);
|
||||
// config.setSecret(appSecret);
|
||||
// WxMaService service = new WxMaServiceImpl();
|
||||
// service.setWxMaConfig(config);
|
||||
// wxMaService = service;
|
||||
// return wxMaService;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@ -1,78 +1,78 @@
|
||||
package com.greenorange.promotion.config;
|
||||
|
||||
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||
import com.wechat.pay.java.core.util.IOUtil;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
import com.wechat.pay.java.service.refund.RefundService;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@Component("WxPayConfig")
|
||||
@ConfigurationProperties(prefix = "wx.pay")
|
||||
public class WxPayConfig {
|
||||
|
||||
private String appId;
|
||||
|
||||
private String apiV3Key;
|
||||
|
||||
private String notifyUrl;
|
||||
|
||||
private String merchantId;
|
||||
|
||||
private String privateKeyPath;
|
||||
|
||||
private String merchantSerialNumber;
|
||||
|
||||
// RSA配置
|
||||
private RSAAutoCertificateConfig RSAConfig;
|
||||
|
||||
// JSAPI支付
|
||||
private JsapiServiceExtension jsapiServiceExtension;
|
||||
|
||||
// 退款
|
||||
private RefundService refundService;
|
||||
|
||||
/**
|
||||
* 初始化配置
|
||||
*/
|
||||
@Bean
|
||||
public boolean initWxPayConfig() throws IOException {
|
||||
this.RSAConfig = buildRSAAutoCertificateConfig();
|
||||
this.jsapiServiceExtension = buildJsapiServiceExtension(RSAConfig);
|
||||
this.refundService = buildRefundService(RSAConfig);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 构建并使用自动更新平台证书的RSA配置,一个商户号只能初始化一个配置,否则会因为重复的下载任务报错
|
||||
private RSAAutoCertificateConfig buildRSAAutoCertificateConfig() throws IOException {
|
||||
// 将 resource 目录下的文件转为 InputStream,然后利用 IOUtil.toString(inputStream) 转化为密钥
|
||||
String privateKey = IOUtil.toString(new ClassPathResource(privateKeyPath).getInputStream());
|
||||
return new RSAAutoCertificateConfig.Builder()
|
||||
.merchantId(merchantId)
|
||||
.privateKey(privateKey)
|
||||
.merchantSerialNumber(merchantSerialNumber)
|
||||
.apiV3Key(apiV3Key)
|
||||
.build();
|
||||
}
|
||||
|
||||
// 构建JSAPI支付
|
||||
private JsapiServiceExtension buildJsapiServiceExtension(RSAAutoCertificateConfig config) {
|
||||
return new JsapiServiceExtension.Builder().config(config).build();
|
||||
}
|
||||
|
||||
// 构建退款
|
||||
private RefundService buildRefundService(RSAAutoCertificateConfig config) {
|
||||
return new RefundService.Builder().config(config).build();
|
||||
}
|
||||
|
||||
}
|
||||
//package com.greenorange.promotion.config;
|
||||
//
|
||||
//import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||
//import com.wechat.pay.java.core.util.IOUtil;
|
||||
//import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
//import com.wechat.pay.java.service.refund.RefundService;
|
||||
//import lombok.Data;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.core.io.ClassPathResource;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//
|
||||
//@Data
|
||||
//@Slf4j
|
||||
//@Configuration
|
||||
//@Component("WxPayConfig")
|
||||
//@ConfigurationProperties(prefix = "wx.pay")
|
||||
//public class WxPayConfig {
|
||||
//
|
||||
// private String appId;
|
||||
//
|
||||
// private String apiV3Key;
|
||||
//
|
||||
// private String notifyUrl;
|
||||
//
|
||||
// private String merchantId;
|
||||
//
|
||||
// private String privateKeyPath;
|
||||
//
|
||||
// private String merchantSerialNumber;
|
||||
//
|
||||
// // RSA配置
|
||||
// private RSAAutoCertificateConfig RSAConfig;
|
||||
//
|
||||
// // JSAPI支付
|
||||
// private JsapiServiceExtension jsapiServiceExtension;
|
||||
//
|
||||
// // 退款
|
||||
// private RefundService refundService;
|
||||
//
|
||||
// /**
|
||||
// * 初始化配置
|
||||
// */
|
||||
// @Bean
|
||||
// public boolean initWxPayConfig() throws IOException {
|
||||
// this.RSAConfig = buildRSAAutoCertificateConfig();
|
||||
// this.jsapiServiceExtension = buildJsapiServiceExtension(RSAConfig);
|
||||
// this.refundService = buildRefundService(RSAConfig);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // 构建并使用自动更新平台证书的RSA配置,一个商户号只能初始化一个配置,否则会因为重复的下载任务报错
|
||||
// private RSAAutoCertificateConfig buildRSAAutoCertificateConfig() throws IOException {
|
||||
// // 将 resource 目录下的文件转为 InputStream,然后利用 IOUtil.toString(inputStream) 转化为密钥
|
||||
// String privateKey = IOUtil.toString(new ClassPathResource(privateKeyPath).getInputStream());
|
||||
// return new RSAAutoCertificateConfig.Builder()
|
||||
// .merchantId(merchantId)
|
||||
// .privateKey(privateKey)
|
||||
// .merchantSerialNumber(merchantSerialNumber)
|
||||
// .apiV3Key(apiV3Key)
|
||||
// .build();
|
||||
// }
|
||||
//
|
||||
// // 构建JSAPI支付
|
||||
// private JsapiServiceExtension buildJsapiServiceExtension(RSAAutoCertificateConfig config) {
|
||||
// return new JsapiServiceExtension.Builder().config(config).build();
|
||||
// }
|
||||
//
|
||||
// // 构建退款
|
||||
// private RefundService buildRefundService(RSAAutoCertificateConfig config) {
|
||||
// return new RefundService.Builder().config(config).build();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@ -19,7 +19,7 @@ public interface SystemConstant {
|
||||
/**
|
||||
* 默认头像view值
|
||||
*/
|
||||
String DEFAULT_AVATAR_VIEW = "default-QU7P9SD5";
|
||||
String DEFAULT_AVATAR_VIEW = "default-WKQ0M3LI";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -58,4 +58,13 @@ public interface UserConstant {
|
||||
*/
|
||||
String STAFF_ROLE = "staff";
|
||||
|
||||
/**
|
||||
* 员工申请须知
|
||||
*/
|
||||
String APPLY_NOTICE_KEY = "applyNotice";
|
||||
|
||||
/**
|
||||
* 课程购买须知
|
||||
*/
|
||||
String COURSE_DESC_KEY = "courseDesc";
|
||||
}
|
||||
|
||||
@ -0,0 +1,149 @@
|
||||
package com.greenorange.promotion.controller.course;
|
||||
|
||||
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 轮播图 控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("banner")
|
||||
@Slf4j
|
||||
@Tag(name = "轮播图模块")
|
||||
@Transactional
|
||||
public class BannerController {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
|
||||
private static final String BANNER_KEY = "banners:list";
|
||||
|
||||
private static final String TOMBSTONE = "\u0000__DEL__\u0000"; // 删除占位符,极低冲突
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员添加轮播图
|
||||
* @param commonStringRequest 图片view值
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加轮播图", description = "参数:图片view值,权限:管理员,方法名:addBanner")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> addBanner(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String view = commonStringRequest.getTemplateString();
|
||||
redisTemplate.opsForList().rightPush(BANNER_KEY, view);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除轮播图(根据索引)
|
||||
* @param index 索引
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("del")
|
||||
@Operation(summary = "删除轮播图(根据索引)", description = "参数:图片view值,权限:管理员,方法名:delBanner")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> delBanner(@RequestParam long index) {
|
||||
long len = getLenOrThrow();
|
||||
long idx = normalizeIndex(index, len);
|
||||
try {
|
||||
// 先把该位置设置为占位符
|
||||
redisTemplate.opsForList().set(BANNER_KEY, idx, TOMBSTONE);
|
||||
// 再删除第一个占位符
|
||||
Long removed = redisTemplate.opsForList().remove(BANNER_KEY, 1, TOMBSTONE);
|
||||
boolean ok = removed != null && removed > 0;
|
||||
log.info("按索引删除轮播图:index={}, removed={}", idx, ok);
|
||||
return ResultUtils.success(ok);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "索引越界或参数错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改轮播图(根据索引)
|
||||
* @param index 索引
|
||||
* @param newView 新的图片view值
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("modify")
|
||||
@Operation(summary = "修改轮播图(根据索引)", description = "参数:图片view值,权限:管理员,方法名:delBanner")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> modifyBanner(@RequestParam long index, @RequestParam String newView) {
|
||||
long len = getLenOrThrow();
|
||||
long idx = normalizeIndex(index, len); // 支持 -1
|
||||
try {
|
||||
redisTemplate.opsForList().set(BANNER_KEY, idx, newView);
|
||||
log.info("更新轮播图:index={} -> {}", idx, newView);
|
||||
return ResultUtils.success(true);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "索引越界或参数错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端获取所有轮播图(按添加顺序)
|
||||
*/
|
||||
@GetMapping("web/list")
|
||||
@Operation(summary = "web端获取所有轮播图(按添加顺序)", description = "按添加顺序返回")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<List<String>> webListBanners() {
|
||||
List<String> banners = redisTemplate.opsForList().range(BANNER_KEY, 0, -1);
|
||||
return ResultUtils.success(banners);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端获取所有轮播图(按添加顺序)
|
||||
*/
|
||||
@GetMapping("mini/list")
|
||||
@Operation(summary = "小程序端获取所有轮播图(按添加顺序)", description = "按添加顺序返回")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<List<String>> miniListBanners() {
|
||||
List<String> banners = redisTemplate.opsForList().range(BANNER_KEY, 0, -1);
|
||||
return ResultUtils.success(banners);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ===== 工具方法 ===== */
|
||||
|
||||
/** 获取列表长度,不存在或为空时抛错 */
|
||||
private long getLenOrThrow() {
|
||||
Long len = redisTemplate.opsForList().size(BANNER_KEY);
|
||||
if (len == null || len == 0) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "轮播图列表为空");
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/** 归一化索引(支持负索引),并做范围校验 */
|
||||
private long normalizeIndex(long index, long len) {
|
||||
long idx = index < 0 ? len + index : index; // -1 -> len-1
|
||||
if (idx < 0 || idx >= len) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "索引越界:" + index);
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
}
|
||||
@ -66,13 +66,13 @@ public class CourseController {
|
||||
@PostMapping("query/hot")
|
||||
@Operation(summary = "小程序端用户查看热门课程列表", description = "参数:无,权限:管理员,方法名:miniQueryHotCourseList")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户查看热门课程列表")
|
||||
// @SysLog(title = "课程管理", content = "小程序端用户查看热门课程列表")
|
||||
public BaseResponse<List<CourseCardVO>> miniQueryHotCourseList() {
|
||||
List<Course> courseList = commonService.findByFieldEqTargetField(Course::getIsShelves, true, courseService);
|
||||
// 降序排序并取前四个元素
|
||||
courseList = courseList.stream()
|
||||
.sorted((course1, course2) -> Integer.compare(course2.getOrderCount(), course1.getOrderCount())) // 降序排序
|
||||
.limit(4) // 取前四个元素
|
||||
.limit(6) // 取前六个元素
|
||||
.collect(Collectors.toList());
|
||||
List<CourseCardVO> courseCardVOS = commonService.convertList(courseList, CourseCardVO.class);
|
||||
return ResultUtils.success(courseCardVOS);
|
||||
@ -87,7 +87,7 @@ public class CourseController {
|
||||
@PostMapping("query/type")
|
||||
@Operation(summary = "小程序端用户根据类别查看课程列表", description = "参数:课程添加请求体,权限:管理员,方法名:miniQueryCourseByType")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户根据类别查看课程列表")
|
||||
// @SysLog(title = "课程管理", content = "小程序端用户根据类别查看课程列表")
|
||||
public BaseResponse<List<CourseCardVO>> miniQueryCourseByType(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String courseType = commonStringRequest.getTemplateString();
|
||||
Map<SFunction<Course, ?>, Object> fieldConditions = Map.of(Course::getType, courseType, Course::getIsShelves, true);
|
||||
@ -105,11 +105,11 @@ public class CourseController {
|
||||
@PostMapping("query/keyword")
|
||||
@Operation(summary = "小程序端用户根据类别查看课程列表", description = "参数:搜索关键词,权限:管理员,方法名:miniQueryCourseByKeyword")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户根据名称搜索课程")
|
||||
// @SysLog(title = "课程管理", content = "小程序端用户根据名称搜索课程")
|
||||
public BaseResponse<List<CourseCardVO>> miniQueryCourseByKeyword(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String keyword = commonStringRequest.getTemplateString();
|
||||
LambdaQueryWrapper<Course> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Course::getIsShelves, true);
|
||||
lambdaQueryWrapper.eq(Course::getIsShelves, 1);
|
||||
lambdaQueryWrapper.like(Course::getName, keyword);
|
||||
List<Course> courseList = courseService.list(lambdaQueryWrapper);
|
||||
List<CourseCardVO> courseCardVOS = commonService.convertList(courseList, CourseCardVO.class);
|
||||
@ -124,7 +124,7 @@ public class CourseController {
|
||||
*/
|
||||
@PostMapping("query/id")
|
||||
@Operation(summary = "小程序端用户根据id查询课程详情", description = "参数:课程id,权限:管理员,方法名:miniQueryCourseById")
|
||||
@SysLog(title = "课程管理", content = "小程序端用户根据id查询课程详情")
|
||||
// @SysLog(title = "课程管理", content = "小程序端用户根据id查询课程详情")
|
||||
public BaseResponse<CourseDetailVO> miniQueryCourseById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
Course course = courseService.getById(id);
|
||||
@ -142,7 +142,7 @@ public class CourseController {
|
||||
@PostMapping("detail/id")
|
||||
@Operation(summary = "小程序端用户根据id查看课程基本信息", description = "参数:课程id,权限:管理员,方法名:miniQueryCourseBaseInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户根据id查看课程基本信息")
|
||||
// @SysLog(title = "课程管理", content = "小程序端用户根据id查看课程基本信息")
|
||||
public BaseResponse<CourseCardVO> miniQueryCourseBaseInfo(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
Course course = courseService.getById(id);
|
||||
@ -166,7 +166,7 @@ public class CourseController {
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加课程", description = "参数:课程添加请求体,权限:管理员,方法名:addCourse")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员添加课程")
|
||||
// @SysLog(title = "课程管理", content = "web端管理员添加课程")
|
||||
public BaseResponse<Long> addCourse(@Valid @RequestBody CourseAddRequest courseAddRequest) {
|
||||
Course course = commonService.copyProperties(courseAddRequest, Course.class);
|
||||
courseService.save(course);
|
||||
@ -181,7 +181,7 @@ public class CourseController {
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员根据id修改课程信息", description = "参数:课程更新请求体,权限:管理员,方法名:updateCourse")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员根据id修改课程信息")
|
||||
// @SysLog(title = "课程管理", content = "web端管理员根据id修改课程信息")
|
||||
public BaseResponse<Boolean> updateCourse(@Valid @RequestBody CourseUpdateRequest courseUpdateRequest) {
|
||||
Course course = commonService.copyProperties(courseUpdateRequest, Course.class);
|
||||
courseService.updateById(course);
|
||||
@ -196,7 +196,7 @@ public class CourseController {
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除课程", description = "参数:课程删除请求体,权限:管理员,方法名:delCourse")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员根据id删除课程")
|
||||
// @SysLog(title = "课程管理", content = "web端管理员根据id删除课程")
|
||||
public BaseResponse<Boolean> delCourse(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
courseService.removeById(id);
|
||||
@ -211,7 +211,7 @@ public class CourseController {
|
||||
@PostMapping("delBatch")
|
||||
@Operation(summary = "web端管理员批量删除课程", description = "参数:课程批量删除请求体,权限:管理员,方法名:delBatchCourse")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员批量删除课程")
|
||||
// @SysLog(title = "课程管理", content = "web端管理员批量删除课程")
|
||||
public BaseResponse<Boolean> delBatchCourse(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
List<Long> ids = commonBatchRequest.getIds();
|
||||
courseService.removeByIds(ids);
|
||||
@ -226,7 +226,7 @@ public class CourseController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询课程", description = "参数:课程查询请求体,权限:管理员,方法名:queryCourseById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员根据id查询课程")
|
||||
// @SysLog(title = "课程管理", content = "web端管理员根据id查询课程")
|
||||
public BaseResponse<CourseVO> queryCourseById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
Course course = courseService.getById(id);
|
||||
@ -243,7 +243,7 @@ public class CourseController {
|
||||
@PostMapping("isShelves")
|
||||
@Operation(summary = "web端管理员上(下)架课程", description = "参数:课程查询请求体,权限:管理员,方法名:updateCourseShelvesStatus")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员上(下)架课程")
|
||||
// @SysLog(title = "课程管理", content = "web端管理员上(下)架课程")
|
||||
public BaseResponse<Boolean> updateCourseShelvesStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
Course course = courseService.getById(id);
|
||||
@ -261,7 +261,7 @@ public class CourseController {
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询课程", description = "参数:课程查询请求体,权限:管理员,方法名:listCourseByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "Web端管理员分页查询课程")
|
||||
// @SysLog(title = "课程管理", content = "Web端管理员分页查询课程")
|
||||
public BaseResponse<Page<CourseVO>> listCourseByPage(@Valid @RequestBody CourseQueryRequest courseQueryRequest) {
|
||||
long current = courseQueryRequest.getCurrent();
|
||||
long pageSize = courseQueryRequest.getPageSize();
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.greenorange.promotion.controller.course;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@ -47,6 +49,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
@ -88,7 +91,7 @@ public class CourseOrderController {
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序端用户生成课程订单", description = "参数:课程id,权限:管理员,方法名:addCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户生成课程订单")
|
||||
// @SysLog(title = "课程订单管理", content = "小程序端用户生成课程订单")
|
||||
public BaseResponse<Long> addCourseOrder(@Valid @RequestBody CourseOrderAddRequest courseOrderAddRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
@ -208,6 +211,13 @@ public class CourseOrderController {
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
|
||||
// 判断是否超过7天
|
||||
Date orderCreateTime = courseOrder.getCreateTime();
|
||||
Date now = DateUtil.date();
|
||||
// 计算两个时间相隔多少天(向下取整)
|
||||
long days = DateUtil.between(orderCreateTime, now, DateUnit.DAY);
|
||||
ThrowUtils.throwIf(days >= 7, ErrorCode.OPERATION_ERROR, "订单已超过7天,无法退款");
|
||||
|
||||
// 修改订单状态
|
||||
LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CourseOrder::getId, courseOrder.getId())
|
||||
@ -266,7 +276,7 @@ public class CourseOrderController {
|
||||
@PostMapping("cancel")
|
||||
@Operation(summary = "小程序端用户取消课程订单", description = "参数:订单id,权限:管理员,方法名:cancelCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户取消课程订单")
|
||||
// @SysLog(title = "课程订单管理", content = "小程序端用户取消课程订单")
|
||||
public BaseResponse<Long> cancelCourseOrder(@Valid @RequestBody CourseOrderAddRequest courseOrderAddRequest) {
|
||||
Long courseId = courseOrderAddRequest.getCourseId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(courseId);
|
||||
@ -286,7 +296,7 @@ public class CourseOrderController {
|
||||
@PostMapping("query/list")
|
||||
@Operation(summary = "小程序端用户查询课程订单列表", description = "参数:无,权限:管理员,方法名:queryCourseOrderList")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户查询课程订单列表")
|
||||
// @SysLog(title = "课程订单管理", content = "小程序端用户查询课程订单列表")
|
||||
public BaseResponse<List<CourseOrderCardVO>> queryCourseOrderList(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
List<CourseOrder> courseOrderList = commonService.findByFieldEqTargetField(CourseOrder::getUserId, userId, courseOrderService);
|
||||
@ -303,7 +313,7 @@ public class CourseOrderController {
|
||||
@PostMapping("query/detail")
|
||||
@Operation(summary = "小程序端用户根据id查询订单详情", description = "参数:订单id,权限:管理员,方法名:queryCourseOrderDetailById")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户根据id查询订单详情")
|
||||
// @SysLog(title = "课程订单管理", content = "小程序端用户根据id查询订单详情")
|
||||
public BaseResponse<CourseOrderVO> queryCourseOrderDetailById(@RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
@ -361,7 +371,7 @@ public class CourseOrderController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询课程订单", description = "参数:课程订单查询请求体,权限:管理员,方法名:queryCourseOrderById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "web端管理员根据id查询课程订单")
|
||||
// @SysLog(title = "课程订单管理", content = "web端管理员根据id查询课程订单")
|
||||
public BaseResponse<CourseOrderVO> queryCourseOrderById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
@ -377,7 +387,7 @@ public class CourseOrderController {
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询课程订单", description = "参数:课程订单查询请求体,权限:管理员,方法名:listCourseOrderByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "Web端管理员分页查询课程订单")
|
||||
// @SysLog(title = "课程订单管理", content = "Web端管理员分页查询课程订单")
|
||||
public BaseResponse<Page<CourseOrderBaseInfoVO>> listCourseOrderByPage(@Valid @RequestBody CourseOrderQueryRequest courseOrderQueryRequest) {
|
||||
long current = courseOrderQueryRequest.getCurrent();
|
||||
long pageSize = courseOrderQueryRequest.getPageSize();
|
||||
|
||||
@ -85,7 +85,8 @@ public class ProjectCommissionController {
|
||||
public BaseResponse<List<ProjectCommissionVO>> queryProjectCommission(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetField(ProjectCommission::getUserId, userId, projectCommissionService);
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId);
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetFieldWithSpecificFields(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId,
|
||||
List.of(ProjectDetail::getId, ProjectDetail::getProjectDetailName, ProjectDetail::getMaxCommissionRate));
|
||||
// 封装Map集合(键:项目明细id,值:项目明细名称)
|
||||
Map<Long, String> projectDetailMap = new HashMap<>();
|
||||
// 封装Map集合(键:项目明细id,值:项目明细最大抽佣比例)
|
||||
@ -213,7 +214,8 @@ public class ProjectCommissionController {
|
||||
lambdaQueryWrapper.eq(SubUserProjectCommission::getUserId, userId);
|
||||
List<SubUserProjectCommission> subUserProjectCommissionList = subUserProjectCommissionService.list(lambdaQueryWrapper);
|
||||
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(subUserProjectCommissionList, projectDetailService, SubUserProjectCommission::getProjectDetailId, ProjectDetail::getId);
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetFieldWithSpecificFields(subUserProjectCommissionList, projectDetailService, SubUserProjectCommission::getProjectDetailId, ProjectDetail::getId,
|
||||
List.of(ProjectDetail::getId, ProjectDetail::getProjectDetailName, ProjectDetail::getMaxCommissionRate));
|
||||
// 封装Map集合(键:项目明细id,值:项目明细名称)
|
||||
Map<Long, String> projectDetailMap = new HashMap<>();
|
||||
// 封装Map集合(键:项目明细id,值:项目明细最大抽佣比例)
|
||||
@ -253,6 +255,7 @@ public class ProjectCommissionController {
|
||||
// 封装下级用户项目抽佣列表
|
||||
LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userInfoLambdaQueryWrapper.eq(UserInfo::getParentUserId, userId);
|
||||
userInfoLambdaQueryWrapper.select(UserInfo::getId, UserInfo::getNickName);
|
||||
List<UserInfo> userInfoList = userInfoService.list(userInfoLambdaQueryWrapper);
|
||||
List<SubUserProjectCommissionVO> subUserProjectCommissionVOList = new ArrayList<>();
|
||||
for (UserInfo userInfo : userInfoList) {
|
||||
|
||||
@ -119,7 +119,8 @@ public class ProjectController {
|
||||
List<ProjectDetailVO> projectDetailVOS = commonService.convertList(projectDetailList, ProjectDetailVO.class);
|
||||
// 将项目明细的价格修改为当前用户的单价
|
||||
Map<SFunction<ProjectCommission, ?>, Object> fieldConditions = Map.of(ProjectCommission::getUserId, userId, ProjectCommission::getProjectId, id);
|
||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetFields(fieldConditions, projectCommissionService);
|
||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetFieldsWithSpecificColumns(fieldConditions, projectCommissionService,
|
||||
List.of(ProjectCommission::getProjectDetailId, ProjectCommission::getMyUnitPrice));
|
||||
// 封装Map集合(键:项目明细id, 值:项目结算价格)
|
||||
Map<Long, BigDecimal> projectCommissionMap = new HashMap<>();
|
||||
for (ProjectCommission projectCommission : projectCommissionList) {
|
||||
@ -174,7 +175,7 @@ public class ProjectController {
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加项目", description = "参数:项目添加请求体,权限:管理员,方法名:addProject")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目管理", content = "web端管理员添加项目")
|
||||
// @SysLog(title = "项目管理", content = "web端管理员添加项目")
|
||||
public BaseResponse<Long> addProject(@Valid @RequestBody ProjectAddRequest projectAddRequest) {
|
||||
Project project = commonService.copyProperties(projectAddRequest, Project.class);
|
||||
projectService.save(project);
|
||||
@ -189,12 +190,13 @@ public class ProjectController {
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员更新项目", description = "参数:项目更新请求体,权限:管理员,方法名:updateProject")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目管理", content = "web端管理员根据id修改项目信息")
|
||||
// @SysLog(title = "项目管理", content = "web端管理员根据id修改项目信息")
|
||||
public BaseResponse<Boolean> updateProject(@Valid @RequestBody ProjectUpdateRequest projectUpdateRequest) {
|
||||
Project project = commonService.copyProperties(projectUpdateRequest, Project.class);
|
||||
projectService.updateById(project);
|
||||
// 批量修改用户项目记录
|
||||
List<UserProject> userProjectList = commonService.findByFieldEqTargetField(UserProject::getProjectId, project.getId(), userProjectService);
|
||||
List<UserProject> userProjectList = commonService.findByFieldEqTargetFieldWithSpecificFields(UserProject::getProjectId, project.getId(), userProjectService,
|
||||
List.of(UserProject::getId));
|
||||
for (UserProject userProject : userProjectList) {
|
||||
userProject.setProjectName(project.getProjectName());
|
||||
userProject.setProjectImage(project.getProjectImage());
|
||||
@ -212,7 +214,7 @@ public class ProjectController {
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除项目", description = "参数:项目删除请求体,权限:管理员,方法名:delProject")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目管理", content = "web端管理员根据id删除项目")
|
||||
// @SysLog(title = "项目管理", content = "web端管理员根据id删除项目")
|
||||
public BaseResponse<Boolean> delProject(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
projectService.removeById(id);
|
||||
@ -261,7 +263,7 @@ public class ProjectController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询项目", description = "参数:项目查询请求体,权限:管理员,方法名:queryProjectById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目管理", content = "web端管理员根据id查询项目")
|
||||
// @SysLog(title = "项目管理", content = "web端管理员根据id查询项目")
|
||||
public BaseResponse<ProjectVO> queryProjectById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
ProjectVO projectVO = projectService.queryProjectById(commonRequest);
|
||||
return ResultUtils.success(projectVO);
|
||||
@ -275,7 +277,7 @@ public class ProjectController {
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询项目", description = "参数:项目查询请求体,权限:管理员,方法名:listProjectByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目管理", content = "Web端管理员分页查询项目")
|
||||
// @SysLog(title = "项目管理", content = "Web端管理员分页查询项目")
|
||||
public BaseResponse<Page<ProjectPageVO>> listProjectByPage(@Valid @RequestBody ProjectQueryRequest projectQueryRequest) {
|
||||
long current = projectQueryRequest.getCurrent();
|
||||
long pageSize = projectQueryRequest.getPageSize();
|
||||
@ -298,7 +300,7 @@ public class ProjectController {
|
||||
@PostMapping("shelves")
|
||||
@Operation(summary = "Web端管理员上(下)架项目", description = "参数:项目id,权限:管理员(admin, boss),方法名:updateProjectShelvesStatus")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目管理", content = "Web端管理员上(下)架项目")
|
||||
// @SysLog(title = "项目管理", content = "Web端管理员上(下)架项目")
|
||||
public BaseResponse<Boolean> updateProjectShelvesStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// 获取当前服务类商品的上(下)架状态
|
||||
Long id = commonRequest.getId();
|
||||
|
||||
@ -80,7 +80,7 @@ public class ProjectDetailController {
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加项目明细", description = "参数:项目明细添加请求体,权限:管理员,方法名:addProjectDetail")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目明细管理", content = "web端管理员添加项目明细")
|
||||
// @SysLog(title = "项目明细管理", content = "web端管理员添加项目明细")
|
||||
public BaseResponse<Boolean> addProjectDetail(@Valid @RequestBody ProjectDetailAddRequest projectDetailAddRequest) {
|
||||
Long proId = projectDetailAddRequest.getProjectId();
|
||||
Project pro = projectService.getById(proId);
|
||||
@ -96,9 +96,11 @@ public class ProjectDetailController {
|
||||
|
||||
// 获取所有的小程序用户
|
||||
LambdaQueryWrapper<UserInfo> miniUserInfoQueryWrapper = userInfoService.getMiniUserInfoQueryWrapper();
|
||||
miniUserInfoQueryWrapper.select(UserInfo::getId, UserInfo::getParentUserId);
|
||||
List<UserInfo> userInfoList = userInfoService.list(miniUserInfoQueryWrapper);
|
||||
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetFieldWithSpecificFields(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId,
|
||||
List.of(UserMainInfo::getUserId, UserMainInfo::getUniteRate));
|
||||
// 封装Map(键:用户id, 值:抽佣比例)
|
||||
Map<Long, BigDecimal> userCommissionRateMap = new HashMap<>();
|
||||
for (UserMainInfo userMainInfo : userMainInfoList) {
|
||||
@ -132,7 +134,7 @@ public class ProjectDetailController {
|
||||
List<SubUserProjectCommissionAddRequest> subUserProjectCommissionAddRequestList = new ArrayList<>();
|
||||
for (UserInfo userInfo : userInfoList) {
|
||||
if (userInfo.getParentUserId() == 0) continue;
|
||||
SubUserProjectCommissionAddRequest subUserProjectCommissionAddRequest = SubUserProjectCommissionAddRequest.builder()
|
||||
SubUserProjectCommissionAddRequest subUserProjectCommissionAddRequest = SubUserProjectCommissionAddRequest.builder()
|
||||
.projectDetailId(projectDetailId)
|
||||
.myUnitPrice(projectSettlementPrice)
|
||||
.projectId(projectId)
|
||||
@ -154,6 +156,13 @@ public class ProjectDetailController {
|
||||
Long subUserId = subUserProjectCommission.getSubUserId();
|
||||
// 设置抽佣比例
|
||||
BigDecimal uniteRate = userCommissionRateMap.get(userId);
|
||||
if (uniteRate == null && userId == 0) {
|
||||
LambdaQueryWrapper<UserMainInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserMainInfo::getUserId, subUserId);
|
||||
UserMainInfo userMainInfo = userMainInfoService.getOne(queryWrapper);
|
||||
uniteRate = userMainInfo.getUniteRate().min(projectDetail.getMaxCommissionRate());
|
||||
}
|
||||
uniteRate = uniteRate.min(projectDetail.getMaxCommissionRate());
|
||||
subUserProjectCommission.setCurrentCommissionRate(uniteRate);
|
||||
// 设置单价
|
||||
BigDecimal myUnitPrice = subUserProjectCommissionMap.get(userId);
|
||||
@ -264,7 +273,7 @@ public class ProjectDetailController {
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除项目明细", description = "参数:项目明细删除请求体,权限:管理员,方法名:delProjectDetail")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目明细管理", content = "web端管理员根据id删除项目明细")
|
||||
// @SysLog(title = "项目明细管理", content = "web端管理员根据id删除项目明细")
|
||||
public BaseResponse<Boolean> delProjectDetail(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
// 更新项目价格
|
||||
@ -297,7 +306,7 @@ public class ProjectDetailController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询项目明细", description = "参数:项目明细查询请求体,权限:管理员,方法名:queryProjectDetailById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目明细管理", content = "web端管理员根据id查询项目明细")
|
||||
// @SysLog(title = "项目明细管理", content = "web端管理员根据id查询项目明细")
|
||||
public BaseResponse<ProjectDetailVO> queryProjectDetailById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
ProjectDetail projectDetail = projectDetailService.getById(id);
|
||||
@ -314,7 +323,7 @@ public class ProjectDetailController {
|
||||
@PostMapping("query/pid")
|
||||
@Operation(summary = "web端管理员根据项目id查询项目明细", description = "参数:项目id,权限:管理员,方法名:queryProjectDetailByPid")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目明细管理", content = "web端管理员根据项目id查询项目明细")
|
||||
// @SysLog(title = "项目明细管理", content = "web端管理员根据项目id查询项目明细")
|
||||
public BaseResponse<List<ProjectDetailVO>> queryProjectDetailByPid(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldEqTargetField(ProjectDetail::getProjectId, id, projectDetailService);
|
||||
|
||||
@ -80,7 +80,7 @@ public class ProjectNotificationController {
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加项目通知", description = "参数:项目通知添加请求体,权限:管理员,方法名:addProjectNotification")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目通知管理", content = "web端管理员添加项目通知")
|
||||
// @SysLog(title = "项目通知管理", content = "web端管理员添加项目通知")
|
||||
public BaseResponse<Boolean> addProjectNotification(@Valid @RequestBody ProjectNotificationAddRequest projectNotificationAddRequest) {
|
||||
Long proId = projectNotificationAddRequest.getProjectId();
|
||||
Project pro = projectService.getById(proId);
|
||||
@ -98,7 +98,7 @@ public class ProjectNotificationController {
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员更新项目通知", description = "参数:项目通知更新请求体,权限:管理员,方法名:updateProjectNotification")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目通知管理", content = "web端管理员根据id修改项目通知信息")
|
||||
// @SysLog(title = "项目通知管理", content = "web端管理员根据id修改项目通知信息")
|
||||
public BaseResponse<Boolean> updateProjectNotification(@Valid @RequestBody ProjectNotificationUpdateRequest projectNotificationUpdateRequest) {
|
||||
ProjectNotification projectNotification = commonService.copyProperties(projectNotificationUpdateRequest, ProjectNotification.class);
|
||||
projectNotificationService.updateById(projectNotification);
|
||||
@ -113,7 +113,7 @@ public class ProjectNotificationController {
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除项目通知", description = "参数:项目通知删除请求体,权限:管理员,方法名:delProjectNotification")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目通知管理", content = "web端管理员根据id删除项目通知")
|
||||
// @SysLog(title = "项目通知管理", content = "web端管理员根据id删除项目通知")
|
||||
public BaseResponse<Boolean> delProjectNotification(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
projectNotificationService.removeById(id);
|
||||
@ -129,7 +129,7 @@ public class ProjectNotificationController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询项目通知", description = "参数:项目通知查询请求体,权限:管理员,方法名:queryProjectNotificationById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目通知管理", content = "web端管理员根据id查询项目通知")
|
||||
// @SysLog(title = "项目通知管理", content = "web端管理员根据id查询项目通知")
|
||||
public BaseResponse<ProjectNotificationVO> queryProjectNotificationById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
ProjectNotification projectNotification = projectNotificationService.getById(id);
|
||||
@ -146,7 +146,7 @@ public class ProjectNotificationController {
|
||||
@PostMapping("query/pid")
|
||||
@Operation(summary = "web端管理员根据项目id查询项目通知", description = "参数:项目id,权限:管理员,方法名:queryProjectNotificationByPid")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目通知管理", content = "web端管理员根据项目id查询项目通知")
|
||||
// @SysLog(title = "项目通知管理", content = "web端管理员根据项目id查询项目通知")
|
||||
public BaseResponse<List<ProjectNotificationVO>> queryProjectNotificationByPid(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
List<ProjectNotification> projectNotificationList = commonService.findByFieldEqTargetField(ProjectNotification::getProjectId, id, projectNotificationService);
|
||||
|
||||
@ -87,11 +87,11 @@ public class PromoCodeApplyController {
|
||||
String phoneNumber = promoCodeApplyRequest.getSalespersonPhone();
|
||||
// 判断是否重复绑定了手机号
|
||||
Map<SFunction<PromoCodeApply, ?>, Object> applyConditions = Map.of(PromoCodeApply::getUserId, userId, PromoCodeApply::getProjectId, projectId, PromoCodeApply::getSalespersonPhone, phoneNumber);
|
||||
List<PromoCodeApply> promoCodeApplyList = commonService.findByFieldEqTargetFields(applyConditions, promoCodeApplyService);
|
||||
List<PromoCodeApply> promoCodeApplyList = commonService.findByFieldEqTargetFieldsWithSpecificColumns(applyConditions, promoCodeApplyService, List.of(PromoCodeApply::getId));
|
||||
ThrowUtils.throwIf(!promoCodeApplyList.isEmpty(), ErrorCode.OPERATION_ERROR, "不能重复绑定手机号");
|
||||
|
||||
Map<SFunction<PromoCode, ?>, Object> fieldConditions = Map.of(PromoCode::getProjectId, projectId, PromoCode::getPromoCodeStatus, false);
|
||||
List<PromoCode> promoCodeList = commonService.findByFieldEqTargetFields(fieldConditions, promoCodeService);
|
||||
List<PromoCode> promoCodeList = commonService.findByFieldEqTargetFieldsWithSpecificColumns(fieldConditions, promoCodeService, List.of(PromoCode::getId));
|
||||
ThrowUtils.throwIf(promoCodeList.size() == 0, ErrorCode.OPERATION_ERROR, "当前项目没有推广码");
|
||||
PromoCode promoCode = promoCodeList.get(0);
|
||||
promoCode.setPromoCodeStatus(true);
|
||||
@ -105,7 +105,7 @@ public class PromoCodeApplyController {
|
||||
|
||||
// 更新项目的推广人数
|
||||
Map<SFunction<UserProject, ?>, Object> projectConditions = Map.of(UserProject::getProjectId, projectId, UserProject::getUserId, userId);
|
||||
List<UserProject> userProjectList = commonService.findByFieldEqTargetFields(projectConditions, userProjectService);
|
||||
List<UserProject> userProjectList = commonService.findByFieldEqTargetFieldsWithSpecificColumns(projectConditions, userProjectService, List.of(UserProject::getId));
|
||||
if (userProjectList.isEmpty()) project.setCurrentPromotionCount(project.getCurrentPromotionCount() + 1);
|
||||
|
||||
projectService.updateById(project);
|
||||
@ -154,7 +154,7 @@ public class PromoCodeApplyController {
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询推广码申请记录", description = "参数:推广码申请记录查询请求体,权限:管理员,方法名:listPromoCodeApplyByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "推广码申请记录管理", content = "Web端管理员分页查询推广码申请记录")
|
||||
// @SysLog(title = "推广码申请记录管理", content = "Web端管理员分页查询推广码申请记录")
|
||||
public BaseResponse<Page<PromoCodeApplyVO>> listPromoCodeApplyByPage(@Valid @RequestBody PromoCodeApplyQueryRequest promoCodeApplyQueryRequest) {
|
||||
long current = promoCodeApplyQueryRequest.getCurrent();
|
||||
long pageSize = promoCodeApplyQueryRequest.getPageSize();
|
||||
|
||||
@ -63,7 +63,7 @@ public class PromoCodeController {
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加推广码", description = "参数:推广码添加请求体,权限:管理员,方法名:addPromoCode")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "推广码管理", content = "web端管理员添加推广码")
|
||||
// @SysLog(title = "推广码管理", content = "web端管理员添加推广码")
|
||||
public BaseResponse<Boolean> addPromoCode(@Valid @RequestBody PromoCodeAddRequest promoCodeAddRequest) {
|
||||
Long proId = promoCodeAddRequest.getProjectId();
|
||||
Project pro = projectService.getById(proId);
|
||||
@ -81,7 +81,7 @@ public class PromoCodeController {
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员更新推广码", description = "参数:推广码更新请求体,权限:管理员,方法名:updatePromoCode")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "推广码管理", content = "web端管理员根据id修改推广码信息")
|
||||
// @SysLog(title = "推广码管理", content = "web端管理员根据id修改推广码信息")
|
||||
public BaseResponse<Boolean> updatePromoCode(@Valid @RequestBody PromoCodeUpdateRequest promoCodeUpdateRequest) {
|
||||
PromoCode promoCode = commonService.copyProperties(promoCodeUpdateRequest, PromoCode.class);
|
||||
promoCodeService.updateById(promoCode);
|
||||
@ -96,7 +96,7 @@ public class PromoCodeController {
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除推广码", description = "参数:推广码删除请求体,权限:管理员,方法名:delPromoCode")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "推广码管理", content = "web端管理员根据id删除推广码")
|
||||
// @SysLog(title = "推广码管理", content = "web端管理员根据id删除推广码")
|
||||
public BaseResponse<Boolean> delPromoCode(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
PromoCode promoCode = promoCodeService.getById(id);
|
||||
@ -114,7 +114,7 @@ public class PromoCodeController {
|
||||
@PostMapping("delBatch")
|
||||
@Operation(summary = "web端管理员批量删除推广码", description = "参数:推广码批量删除请求体,权限:管理员,方法名:delBatchPromoCode")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "推广码管理", content = "web端管理员批量删除推广码")
|
||||
// @SysLog(title = "推广码管理", content = "web端管理员批量删除推广码")
|
||||
public BaseResponse<Boolean> delBatchPromoCode(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
promoCodeService.delBatchPromoCode(commonBatchRequest);
|
||||
return ResultUtils.success(true);
|
||||
@ -128,7 +128,7 @@ public class PromoCodeController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询推广码", description = "参数:推广码查询请求体,权限:管理员,方法名:queryPromoCodeById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "推广码管理", content = "web端管理员根据id查询推广码")
|
||||
// @SysLog(title = "推广码管理", content = "web端管理员根据id查询推广码")
|
||||
public BaseResponse<PromoCodeVO> queryPromoCodeById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
PromoCode promoCode = promoCodeService.getById(id);
|
||||
@ -146,7 +146,7 @@ public class PromoCodeController {
|
||||
@PostMapping("queryByPid")
|
||||
@Operation(summary = "web端管理员根据id查询推广码", description = "参数:项目id,权限:管理员,方法名:queryPromoCodeByPid")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "推广码管理", content = "web端管理员根据项目id查询推广码")
|
||||
// @SysLog(title = "推广码管理", content = "web端管理员根据项目id查询推广码")
|
||||
public BaseResponse<List<PromoCodeVO>> queryPromoCodeByPid(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
LambdaQueryWrapper<PromoCode> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@ -90,7 +90,8 @@ public class ProjectSettlementController {
|
||||
Long id = commonRequest.getId();
|
||||
Map<SFunction<ProjectSettlement, ?>, Object> fieldConditions = Map.of(ProjectSettlement::getPromoCodeApplyId, id);
|
||||
List<ProjectSettlement> projectSettlementList = commonService.findByFieldEqTargetFields(fieldConditions, projectSettlementService);
|
||||
List<PromoCodeApply> promoCodeApplyList = commonService.findByFieldInTargetField(projectSettlementList, promoCodeApplyService, ProjectSettlement::getPromoCodeApplyId, PromoCodeApply::getId);
|
||||
List<PromoCodeApply> promoCodeApplyList = commonService.findByFieldInTargetFieldWithSpecificFields(projectSettlementList, promoCodeApplyService, ProjectSettlement::getPromoCodeApplyId, PromoCodeApply::getId,
|
||||
List.of(PromoCodeApply::getId, PromoCodeApply::getSalespersonName));
|
||||
// 封装Map集合(键:推广码申请记录id, 值:业务员姓名)
|
||||
Map<Long, String> salespersonNameMap = new HashMap<>();
|
||||
for (PromoCodeApply promoCodeApply : promoCodeApplyList) {
|
||||
@ -119,7 +120,8 @@ public class ProjectSettlementController {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
Map<SFunction<ProjectSettlement, ?>, Object> fieldConditions = Map.of(ProjectSettlement::getUserId, userId, ProjectSettlement::getProjectId, projectId);
|
||||
List<ProjectSettlement> projectSettlementList = commonService.findByFieldEqTargetFields(fieldConditions, projectSettlementService);
|
||||
List<PromoCodeApply> promoCodeApplyList = commonService.findByFieldInTargetField(projectSettlementList, promoCodeApplyService, ProjectSettlement::getPromoCodeApplyId, PromoCodeApply::getId);
|
||||
List<PromoCodeApply> promoCodeApplyList = commonService.findByFieldInTargetFieldWithSpecificFields(projectSettlementList, promoCodeApplyService, ProjectSettlement::getPromoCodeApplyId, PromoCodeApply::getId,
|
||||
List.of(PromoCodeApply::getId, PromoCodeApply::getSalespersonName));
|
||||
// 封装Map集合(键:推广码申请记录id, 值:业务员姓名)
|
||||
Map<Long, String> salespersonNameMap = new HashMap<>();
|
||||
for (PromoCodeApply promoCodeApply : promoCodeApplyList) {
|
||||
@ -143,7 +145,7 @@ public class ProjectSettlementController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Operation(summary = "web端管理员添加项目结算记录", description = "参数:项目结算记录添加请求体,权限:管理员,方法名:addProjectSettlement")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目结算记录管理", content = "web端管理员添加项目结算记录")
|
||||
// @SysLog(title = "项目结算记录管理", content = "web端管理员添加项目结算记录")
|
||||
public BaseResponse<Boolean> addProjectSettlement(@Valid @RequestBody ProjectSettlementAddRequest projectSettlementAddRequest) {
|
||||
// 添加当前用户的项目结算记录
|
||||
ProjectSettlement projectSettlement = commonService.copyProperties(projectSettlementAddRequest, ProjectSettlement.class);
|
||||
@ -210,7 +212,8 @@ public class ProjectSettlementController {
|
||||
fundsChangeService.save(fundsChange);
|
||||
|
||||
// 获取用户主要信息
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(pathToRoot, userMainInfoService, Function.identity(), UserMainInfo::getUserId);
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetFieldWithSpecificFields(pathToRoot, userMainInfoService, Function.identity(), UserMainInfo::getUserId,
|
||||
List.of(UserMainInfo::getUserId, UserMainInfo::getCurrentBalance));
|
||||
// 封装Map集合(键:用户id,值:用户余额)
|
||||
Map<Long, BigDecimal> userMainInfoMap = new HashMap<>();
|
||||
for (UserMainInfo mainInfo : userMainInfoList) {
|
||||
@ -271,7 +274,7 @@ public class ProjectSettlementController {
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除项目结算记录", description = "参数:项目结算记录删除请求体,权限:管理员,方法名:delProjectSettlement")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目结算记录管理", content = "web端管理员根据id删除项目结算记录")
|
||||
// @SysLog(title = "项目结算记录管理", content = "web端管理员根据id删除项目结算记录")
|
||||
public BaseResponse<Boolean> delProjectSettlement(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
projectSettlementService.removeById(id);
|
||||
@ -304,7 +307,7 @@ public class ProjectSettlementController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询项目结算记录", description = "参数:项目结算记录查询请求体,权限:管理员,方法名:queryProjectSettlementById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目结算记录管理", content = "web端管理员根据id查询项目结算记录")
|
||||
// @SysLog(title = "项目结算记录管理", content = "web端管理员根据id查询项目结算记录")
|
||||
public BaseResponse<ProjectSettlementVO> queryProjectSettlementById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
ProjectSettlement projectSettlement = projectSettlementService.getById(id);
|
||||
@ -321,7 +324,7 @@ public class ProjectSettlementController {
|
||||
@PostMapping("queryByPId")
|
||||
@Operation(summary = "Web端管理员根据推广码申请记录id查询项目结算记录列表", description = "参数:推广码申请记录id,权限:管理员,方法名:queryProjectSettlementByPid")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "项目结算记录管理", content = "Web端管理员根据推广码申请记录id查询项目结算记录列表")
|
||||
// @SysLog(title = "项目结算记录管理", content = "Web端管理员根据推广码申请记录id查询项目结算记录列表")
|
||||
public BaseResponse<List<ProjectSettlementVO>> queryProjectSettlementByPid(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
List<ProjectSettlement> projectSettlementList = commonService.findByFieldEqTargetField(ProjectSettlement::getPromoCodeApplyId, id, projectSettlementService);
|
||||
|
||||
@ -2,6 +2,7 @@ package com.greenorange.promotion.controller.projectSettlement;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
@ -10,12 +11,15 @@ import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyReviewRequest;
|
||||
import com.greenorange.promotion.model.entity.FundsChange;
|
||||
import com.greenorange.promotion.model.entity.UserAccount;
|
||||
import com.greenorange.promotion.model.entity.UserMainInfo;
|
||||
import com.greenorange.promotion.model.entity.WithdrawalApply;
|
||||
import com.greenorange.promotion.model.enums.WithdrawStatusEnum;
|
||||
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
|
||||
import com.greenorange.promotion.model.vo.fundsChange.FundsItemVO;
|
||||
import com.greenorange.promotion.model.vo.userAccount.UserAccountConditionVO;
|
||||
@ -173,6 +177,47 @@ public class WithdrawalApplyController {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员查看提现申请详情
|
||||
* @param commonRequest 提现申请记录id
|
||||
* @return 提现申请记录
|
||||
*/
|
||||
@PostMapping("get/id")
|
||||
@Operation(summary = "Web端管理员查看提现申请详情", description = "参数:提现申请记录id,权限:管理员,方法名:queryWithdrawalApplyById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "提现申请记录管理", content = "Web端管理员分页查询提现申请记录")
|
||||
public BaseResponse<WithdrawalApplyVO> queryWithdrawalApplyById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
WithdrawalApply withdrawalApply = withdrawalApplyService.getById(id);
|
||||
WithdrawalApplyVO withdrawalApplyVO = commonService.copyProperties(withdrawalApply, WithdrawalApplyVO.class);
|
||||
return ResultUtils.success(withdrawalApplyVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员审核提现申请
|
||||
* @param withdrawalApplyReviewRequest 提现申请记录审核请求体
|
||||
* @return 是否批准成功
|
||||
*/
|
||||
@PostMapping("review")
|
||||
@Operation(summary = "Web端管理员审核提现申请", description = "参数:提现申请记录审核请求体,权限:管理员,方法名:approveWithdrawalApplyById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "提现申请记录管理", content = "Web端管理员分页查询提现申请记录")
|
||||
public BaseResponse<Boolean> approveWithdrawalApplyById(@Valid @RequestBody WithdrawalApplyReviewRequest withdrawalApplyReviewRequest) {
|
||||
Long id = withdrawalApplyReviewRequest.getId();
|
||||
String withdrawalStatus = withdrawalApplyReviewRequest.getWithdrawalStatus();
|
||||
WithdrawalApply withdrawalApply = withdrawalApplyService.getById(id);
|
||||
ThrowUtils.throwIf(!withdrawalApply.getWithdrawalStatus().equals(WithdrawStatusEnum.PROCESSING.getValue()), ErrorCode.OPERATION_ERROR, "提现申请记录状态错误");
|
||||
LambdaUpdateWrapper<WithdrawalApply> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(WithdrawalApply::getId, id).set(WithdrawalApply::getWithdrawalStatus, withdrawalStatus);
|
||||
withdrawalApplyService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询提现申请记录
|
||||
* @param withdrawalApplyQueryRequest 提现申请记录查询请求体
|
||||
@ -181,7 +226,7 @@ public class WithdrawalApplyController {
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询提现申请记录", description = "参数:提现申请记录查询请求体,权限:管理员,方法名:listWithdrawalApplyByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "提现申请记录管理", content = "Web端管理员分页查询提现申请记录")
|
||||
// @SysLog(title = "提现申请记录管理", content = "Web端管理员分页查询提现申请记录")
|
||||
public BaseResponse<Page<WithdrawalApplyVO>> listWithdrawalApplyByPage(@Valid @RequestBody WithdrawalApplyQueryRequest withdrawalApplyQueryRequest) {
|
||||
long current = withdrawalApplyQueryRequest.getCurrent();
|
||||
long pageSize = withdrawalApplyQueryRequest.getPageSize();
|
||||
|
||||
@ -66,7 +66,7 @@ public class AdvancementApplyController {
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序端用户申请晋升", description = "参数:晋升申请添加请求体,权限:管理员,方法名:addAdvancementApply")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序端用户申请晋升")
|
||||
// @SysLog(title = "晋升申请管理", content = "小程序端用户申请晋升")
|
||||
public BaseResponse<Long> addAdvancementApply(@Valid @RequestBody AdvancementApplyAddRequest advancementApplyAddRequest) {
|
||||
String phone = advancementApplyAddRequest.getPhone();
|
||||
String verificationCode = advancementApplyAddRequest.getVerificationCode();
|
||||
@ -94,7 +94,7 @@ public class AdvancementApplyController {
|
||||
*/
|
||||
@PostMapping("modify/status")
|
||||
@Operation(summary = "小程序端用户撤销晋升申请记录", description = "参数:晋升申请记录id,权限:管理员,方法名:revokeAdvancementApply")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序端用户撤销晋升申请记录")
|
||||
// @SysLog(title = "晋升申请管理", content = "小程序端用户撤销晋升申请记录")
|
||||
public BaseResponse<Boolean> revokeAdvancementApply(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
LambdaUpdateWrapper<AdvancementApply> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
@ -162,7 +162,7 @@ public class AdvancementApplyController {
|
||||
@PostMapping("approve")
|
||||
@Operation(summary = "web端管理员批准用户的晋升申请", description = "参数:晋升申请id,权限:管理员,方法名:approveAdvancementApply")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "web端管理员批准用户的晋升申请")
|
||||
// @SysLog(title = "晋升申请管理", content = "web端管理员批准用户的晋升申请")
|
||||
public BaseResponse<Boolean> approveAdvancementApply(@Valid @RequestBody AdvancementApplyApproveRequest advancementApplyApproveRequest) {
|
||||
userInfoService.staffUserInfoMiniRegister(advancementApplyApproveRequest);
|
||||
return ResultUtils.success(true);
|
||||
@ -177,7 +177,7 @@ public class AdvancementApplyController {
|
||||
@PostMapping("reject")
|
||||
@Operation(summary = "web端管理员拒绝晋升申请", description = "参数:晋升申请拒绝请求体,权限:管理员,方法名:rejectAdvancementApply")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "web端管理员拒绝晋升申请")
|
||||
// @SysLog(title = "晋升申请管理", content = "web端管理员拒绝晋升申请")
|
||||
public BaseResponse<Boolean> rejectAdvancementApply(@Valid @RequestBody AdvancementApplyRejectRequest advancementApplyRejectRequest) {
|
||||
Long applyId = advancementApplyRejectRequest.getApplyId();
|
||||
String rejectReason = advancementApplyRejectRequest.getRejectReason();
|
||||
@ -198,7 +198,7 @@ public class AdvancementApplyController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询晋升申请", description = "参数:晋升申请id,权限:管理员,方法名:queryAdvancementApplyById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "web端管理员根据id查询晋升申请")
|
||||
// @SysLog(title = "晋升申请管理", content = "web端管理员根据id查询晋升申请")
|
||||
public BaseResponse<AdvancementApplyVOPlus> queryAdvancementApplyById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
AdvancementApply advancementApply = advancementApplyService.getById(id);
|
||||
@ -215,7 +215,7 @@ public class AdvancementApplyController {
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询晋升申请", description = "参数:晋升申请查询请求体,权限:管理员,方法名:listAdvancementApplyByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "Web端管理员分页查询晋升申请")
|
||||
// @SysLog(title = "晋升申请管理", content = "Web端管理员分页查询晋升申请")
|
||||
public BaseResponse<Page<AdvancementApplyVO>> listAdvancementApplyByPage(@Valid @RequestBody AdvancementApplyQueryRequest advancementApplyQueryRequest) {
|
||||
long current = advancementApplyQueryRequest.getCurrent();
|
||||
long pageSize = advancementApplyQueryRequest.getPageSize();
|
||||
@ -238,7 +238,7 @@ public class AdvancementApplyController {
|
||||
@PostMapping("query/supervisor")
|
||||
@Operation(summary = "Web端管理员查询主管信息列表", description = "参数:无,权限:管理员,方法名:listSupervisorUserInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "Web端管理员分页查询晋升申请")
|
||||
// @SysLog(title = "晋升申请管理", content = "Web端管理员分页查询晋升申请")
|
||||
public BaseResponse<List<SupervisorUserInfoVO>> listSupervisorUserInfo() {
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.SUPERVISOR_ROLE, userInfoService);
|
||||
List<SupervisorUserInfoVO> supervisorUserInfoVOS = commonService.convertList(userInfoList, SupervisorUserInfoVO.class);
|
||||
|
||||
@ -85,19 +85,115 @@ public class UserInfoController {
|
||||
// @PostMapping("test")
|
||||
// public BaseResponse<Boolean> test() throws IOException {
|
||||
// List<UserInfo> list = userInfoService.list();
|
||||
// List<UserMainInfo> userMainInfoList = userMainInfoService.list();
|
||||
// Map<Long, UserInfo> map = new HashMap<>();
|
||||
// for (UserInfo userInfo : list) {
|
||||
// map.put(userInfo.getId(), userInfo);
|
||||
// }
|
||||
// List<UserMainInfo> userMainInfoList = userMainInfoService.list();
|
||||
// for (UserMainInfo userMainInfo : userMainInfoList) {
|
||||
// Long userId = userMainInfo.getUserId();
|
||||
// UserInfo userInfo = map.get(userId);
|
||||
// String userRole = userInfo.getUserRole();
|
||||
// UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
// String wxQrCode = wechatGetQrcodeService.getWxQrCode(userInfo.getInvitationCode(), userRoleEnum);
|
||||
// UserMainInfo userMainInfo = UserMainInfo.builder().userId(userInfo.getId()).inviteQrCode(wxQrCode).build();
|
||||
// userMainInfoList.add(userMainInfo);
|
||||
// String view = wechatGetQrcodeService.getWxQrCode(userInfo.getInvitationCode(), userRoleEnum);
|
||||
// userMainInfo.setInviteQrCode(view);
|
||||
// }
|
||||
// userMainInfoService.saveOrUpdateBatch(userMainInfoList);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户校验token
|
||||
* @return 是否校验成功
|
||||
*/
|
||||
@PostMapping("verify/token")
|
||||
@Operation(summary = "小程序端用户校验token", description = "参数:token, 权限:管理员(boss, admin),方法名:verifyToken")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<Boolean> verifyToken() {
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端修改员工申请须知
|
||||
* @param commonStringRequest 修改内容
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("modify/applyNotice")
|
||||
@Operation(summary = "web端修改员工申请须知", description = "参数:修改内容,权限:管理员(boss, admin),方法名:modifyApplyNotice")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> modifyApplyNotice(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String applyNotice = commonStringRequest.getTemplateString();
|
||||
redisTemplate.opsForValue().set(UserConstant.APPLY_NOTICE_KEY, applyNotice);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (Web端)小程序端查询员工申请须知
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("query/applyNotice")
|
||||
@Operation(summary = "(Web端)小程序端查询员工申请须知", description = "参数:无,权限:管理员(boss, admin),方法名:queryApplyNotice")
|
||||
public BaseResponse<String> queryApplyNotice() {
|
||||
String applyNotice = redisTemplate.opsForValue().get(UserConstant.APPLY_NOTICE_KEY);
|
||||
return ResultUtils.success(applyNotice);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端修改课程购买须知
|
||||
* @param commonStringRequest 修改内容
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("modify/courseDesc")
|
||||
@Operation(summary = "web端修改课程购买须知", description = "参数:修改内容,权限:管理员(boss, admin),方法名:modifyCourseDesc")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> modifyCourseDesc(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String courseDesc = commonStringRequest.getTemplateString();
|
||||
redisTemplate.opsForValue().set(UserConstant.COURSE_DESC_KEY, courseDesc);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (Web端)小程序端查询课程购买须知
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("query/courseDesc")
|
||||
@Operation(summary = "(Web端)小程序端查询课程购买须知", description = "参数:无,权限:管理员(boss, admin),方法名:queryApplyNotice")
|
||||
public BaseResponse<String> queryCourseDesc() {
|
||||
String courseDesc = redisTemplate.opsForValue().get(UserConstant.COURSE_DESC_KEY);
|
||||
return ResultUtils.success(courseDesc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户修改用户昵称
|
||||
* @param commonStringRequest 昵称
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("modify/nickname")
|
||||
@Operation(summary = "小程序端用户修改用户昵称", description = "参数:昵称,权限:管理员(boss, admin),方法名:modifyNickname")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<Boolean> modifyNickname(@Valid @RequestBody CommonStringRequest commonStringRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
String nickName = commonStringRequest.getTemplateString();
|
||||
LambdaQueryWrapper<UserInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserInfo::getNickName, nickName);
|
||||
queryWrapper.ne(UserInfo::getId, userId);
|
||||
ThrowUtils.throwIf(userInfoService.count(queryWrapper) > 0, ErrorCode.PARAMS_ERROR, "昵称已存在");
|
||||
|
||||
LambdaUpdateWrapper<UserInfo> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(UserInfo::getId, userId).set(UserInfo::getNickName, nickName);
|
||||
userInfoService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户修改用户头像
|
||||
* @param commonStringRequest 头像view值
|
||||
@ -309,7 +405,7 @@ public class UserInfoController {
|
||||
*/
|
||||
@PostMapping("login")
|
||||
@Operation(summary = "web端管理员登录", description = "参数:web用户登录请求体,权限:管理员(boss, admin),方法名:userInfoLogin")
|
||||
@SysLog(title = "用户管理", content = "web端管理员登录")
|
||||
// @SysLog(title = "用户管理", content = "web端管理员登录")
|
||||
public BaseResponse<String> userInfoLogin(@Valid @RequestBody UserInfoLoginRequest userInfoLoginRequest) {
|
||||
String token = userInfoService.userInfoLogin(userInfoLoginRequest);
|
||||
return ResultUtils.success(token);
|
||||
@ -325,7 +421,7 @@ public class UserInfoController {
|
||||
@GetMapping("logout")
|
||||
@Operation(summary = "web端管理员退出登录", description = "参数:JWT,权限:管理员(boss, admin),方法名:userInfoLogout")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员退出登录")
|
||||
// @SysLog(title = "用户管理", content = "web端管理员退出登录")
|
||||
public BaseResponse<Boolean> userInfoLogout(@RequestHeader("Authorization") String token) {
|
||||
// 获取token的过期时间
|
||||
DecodedJWT decodedJWT = jwtUtils.verify(token);
|
||||
@ -348,7 +444,7 @@ public class UserInfoController {
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加用户", description = "参数:用户表添加请求体,权限:管理员(boss, admin),方法名:addUserInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员添加用户")
|
||||
// @SysLog(title = "用户管理", content = "web端管理员添加用户")
|
||||
public BaseResponse<Boolean> addUserInfo(@Valid @RequestBody UserInfoAddRequest userInfoAddRequest) {
|
||||
UserInfo userInfo = commonService.copyProperties(userInfoAddRequest, UserInfo.class);
|
||||
userInfo.setParentUserId(-1L);
|
||||
@ -367,7 +463,7 @@ public class UserInfoController {
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员更新用户", description = "参数:用户表更新请求体,权限:管理员(boss, admin),方法名:updateUserInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员根据id修改用户信息")
|
||||
// @SysLog(title = "用户管理", content = "web端管理员根据id修改用户信息")
|
||||
public BaseResponse<Boolean> updateUserInfo(@Valid @RequestBody UserInfoUpdateRequest userInfoUpdateRequest) {
|
||||
UserInfo userInfo = commonService.copyProperties(userInfoUpdateRequest, UserInfo.class);
|
||||
userInfoService.updateById(userInfo);
|
||||
@ -383,7 +479,7 @@ public class UserInfoController {
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除用户", description = "参数:用户表删除请求体,权限:管理员(boss, admin),方法名:delUserInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员根据id删除用户表")
|
||||
// @SysLog(title = "用户管理", content = "web端管理员根据id删除用户表")
|
||||
public BaseResponse<Boolean> delUserInfo(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
userInfoService.removeById(id);
|
||||
@ -400,7 +496,7 @@ public class UserInfoController {
|
||||
@PostMapping("delBatch")
|
||||
@Operation(summary = "web端管理员批量删除用户", description = "参数:用户表批量删除请求体,权限:管理员(boss, admin),方法名:delBatchUserInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员批量删除用户表")
|
||||
// @SysLog(title = "用户管理", content = "web端管理员批量删除用户表")
|
||||
public BaseResponse<Boolean> delBatchUserInfo(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
List<Long> ids = commonBatchRequest.getIds();
|
||||
userInfoService.removeByIds(ids);
|
||||
@ -418,7 +514,7 @@ public class UserInfoController {
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询用户", description = "参数:用户表查询请求体,权限:管理员(boss, admin),方法名:queryUserInfoById")
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员根据id查询用户")
|
||||
// @SysLog(title = "用户管理", content = "web端管理员根据id查询用户")
|
||||
public BaseResponse<UserInfoVO> queryUserInfoById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
UserInfo userInfo = userInfoService.getById(id);
|
||||
@ -438,7 +534,7 @@ public class UserInfoController {
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询用户", description = "参数:用户表查询请求体,权限:管理员(boss, admin),方法名:listUserInfoByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "用户管理", content = "Web端管理员分页查看用户")
|
||||
// @SysLog(title = "用户管理", content = "Web端管理员分页查看用户")
|
||||
public BaseResponse<Page<UserInfoVO>> listUserInfoByPage(@Valid @RequestBody UserInfoQueryRequest userInfoQueryRequest) {
|
||||
long current = userInfoQueryRequest.getCurrent();
|
||||
long pageSize = userInfoQueryRequest.getPageSize();
|
||||
|
||||
@ -71,8 +71,10 @@ public class UserMainInfoController {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userInfoLambdaQueryWrapper.eq(UserInfo::getParentUserId, userId);
|
||||
userInfoLambdaQueryWrapper.select(UserInfo::getId, UserInfo::getNickName, UserInfo::getPhoneNumber, UserInfo::getCreateTime);
|
||||
List<UserInfo> userInfoList = userInfoService.list(userInfoLambdaQueryWrapper);
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetFieldWithSpecificFields(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId,
|
||||
List.of(UserMainInfo::getUserId, UserMainInfo::getTeamSize, UserMainInfo::getParentEarnings));
|
||||
// 封装Map集合(键:用户id,值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) {
|
||||
|
||||
@ -513,14 +513,16 @@ public class UserPerformanceSummaryController {
|
||||
* 0 0 0 * * ?” = 每天 00:00:00 执行一次
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
@Scheduled(cron = "00 16 20 * * ?")
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
// @Scheduled(cron = "00 16 20 * * ?")
|
||||
@Operation(summary = "轮询课程推广待提成记录表", description = "参数:无,权限:管理员,方法名:pollCourseOrder")
|
||||
public void pollCourseOrder() {
|
||||
// 找出下单时间超过7天的订单,分别统计主管和员工的可结算金额
|
||||
Map<Long, BigDecimal> toSettleMap = new HashMap<>();
|
||||
Map<Long, BigDecimal> totalAmountMap = new HashMap<>();
|
||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = commonService.findByFieldEqTargetField(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.PENDING.getValue(), coursePromotionCommissionPendingService);
|
||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = commonService.findByFieldEqTargetFieldWithSpecificFields(CoursePromotionCommissionPending::getCommissionStatus,
|
||||
CommissionStatusEnum.PENDING.getValue(), coursePromotionCommissionPendingService, List.of(CoursePromotionCommissionPending::getId, CoursePromotionCommissionPending::getFirstUserId, CoursePromotionCommissionPending::getSecondUserId,
|
||||
CoursePromotionCommissionPending::getTotalAmount, CoursePromotionCommissionPending::getFirstReward, CoursePromotionCommissionPending::getSecondReward));
|
||||
for (CoursePromotionCommissionPending coursePromotionCommissionPending : coursePromotionCommissionPendingList) {
|
||||
Date orderCreateTime = coursePromotionCommissionPending.getOrderCreateTime();
|
||||
Date now = DateUtil.date();
|
||||
@ -536,7 +538,9 @@ public class UserPerformanceSummaryController {
|
||||
}
|
||||
coursePromotionCommissionPendingService.updateBatchById(coursePromotionCommissionPendingList);
|
||||
// 修改用户绩效汇总表
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list();
|
||||
LambdaQueryWrapper<UserPerformanceSummary> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(UserPerformanceSummary::getUserId, UserPerformanceSummary::getToRelease, UserPerformanceSummary::getToSettle, UserPerformanceSummary::getNetAmount, UserPerformanceSummary::getId);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list(lambdaQueryWrapper);
|
||||
for (UserPerformanceSummary userPerformanceSummary : userPerformanceSummaryList) {
|
||||
Long userId = userPerformanceSummary.getUserId();
|
||||
BigDecimal toSettleAmount = toSettleMap.get(userId);
|
||||
|
||||
@ -1,153 +1,153 @@
|
||||
package com.greenorange.promotion.controller.wechat;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.config.WxOpenConfig;
|
||||
import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.wxPay.WechatPayRequest;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.wechat.WechatPayService;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
import com.wechat.pay.java.service.refund.model.Refund;
|
||||
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "微信支付")
|
||||
@RequestMapping("/wxPay")
|
||||
@Transactional
|
||||
public class WechatPayController {
|
||||
|
||||
|
||||
@Resource
|
||||
private WechatPayService weChatService;
|
||||
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Resource
|
||||
private CourseOrderService courseOrderService;
|
||||
|
||||
@Resource
|
||||
private WxOpenConfig wxOpenConfig;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* JSAPI 下单
|
||||
*/
|
||||
@PostMapping("/payment/create")
|
||||
@Operation(summary = "JSAPI 下单", description = "参数:订单id, 权限:所有人, 方法名:createPayment")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<PrepayWithRequestPaymentResponse> createPayment(@Valid @RequestBody WechatPayRequest wechatPayRequest, HttpServletRequest request) {
|
||||
|
||||
String code = wechatPayRequest.getCode();
|
||||
WxMaJscode2SessionResult sessionInfo;
|
||||
String miniOpenId;
|
||||
try {
|
||||
WxMaService wxMaService = wxOpenConfig.getWxMaService();
|
||||
sessionInfo = wxMaService.jsCode2SessionInfo(code);
|
||||
miniOpenId = sessionInfo.getOpenid();
|
||||
if (StringUtils.isAnyBlank(miniOpenId)) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR);
|
||||
}
|
||||
} catch (WxErrorException e) {
|
||||
log.error("userLoginByWxOpen error", e);
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "登录失败,系统错误");
|
||||
}
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
|
||||
Long orderId = wechatPayRequest.getOrderId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
ThrowUtils.throwIf(courseOrder == null, ErrorCode.NOT_FOUND_ERROR, "订单不存在");
|
||||
ThrowUtils.throwIf(!courseOrder.getOrderStatus().equals(OrderStatusConstant.PENDING), ErrorCode.OPERATION_ERROR, "订单状态错误");
|
||||
if (!userInfo.getId().equals(courseOrder.getUserId())) {
|
||||
throw new BusinessException(ErrorCode.NO_AUTH_ERROR, "你不是该订单用户!");
|
||||
}
|
||||
PrepayWithRequestPaymentResponse response = weChatService.createPayment(String.valueOf(orderId), miniOpenId, courseOrder.getTotalAmount());
|
||||
return ResultUtils.success(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* JSAPI 下单回调
|
||||
*/
|
||||
@Hidden
|
||||
@PostMapping("/payment/callback")
|
||||
@Operation(summary = "JSAPI 下单回调", description = "参数:订单id, 权限:所有人, 方法名:callbackPayment")
|
||||
public synchronized BaseResponse<Boolean> callbackPayment(HttpServletRequest request) throws IOException {
|
||||
// 获取下单信息
|
||||
Transaction transaction = weChatService.getTransactionInfo(request);
|
||||
System.out.println("下单信息:" + transaction);
|
||||
// 支付回调
|
||||
boolean result = weChatService.paymentCallback(transaction);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR, "微信支付回调失败");
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Web管理员部分退款
|
||||
* @param commonRequest 订单id
|
||||
*/
|
||||
@PostMapping("/refund/part/create")
|
||||
@Operation(summary = "Web管理员部分退款", description = "参数:订单id, 权限:web端管理员, 方法名:createPartRefund")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Refund> createPartRefund(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long orderId = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
ThrowUtils.throwIf(courseOrder == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
|
||||
Refund refund = weChatService.refundPartPayment(String.valueOf(orderId), courseOrder.getTotalAmount());
|
||||
return ResultUtils.success(refund);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 部分退款回调
|
||||
*/
|
||||
@Hidden
|
||||
@PostMapping("/refund/part/callback")
|
||||
@Operation(summary = "部分退款回调", description = "参数:订单id, 权限:web端管理员, 方法名:callbackRefundPart")
|
||||
public BaseResponse<Boolean> callbackRefundPart(HttpServletRequest request) {
|
||||
// 获取退款信息
|
||||
RefundNotification refundNotification = weChatService.getRefundInfo(request);
|
||||
// 退款回调
|
||||
boolean result = weChatService.refundPartCallback(refundNotification);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR, "退款回调失败");
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//package com.greenorange.promotion.controller.wechat;
|
||||
//
|
||||
//import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
//import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
//import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
//import com.greenorange.promotion.common.BaseResponse;
|
||||
//import com.greenorange.promotion.common.ErrorCode;
|
||||
//import com.greenorange.promotion.common.ResultUtils;
|
||||
//import com.greenorange.promotion.config.WxOpenConfig;
|
||||
//import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
//import com.greenorange.promotion.constant.UserConstant;
|
||||
//import com.greenorange.promotion.exception.BusinessException;
|
||||
//import com.greenorange.promotion.exception.ThrowUtils;
|
||||
//import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
//import com.greenorange.promotion.model.dto.wxPay.WechatPayRequest;
|
||||
//import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
//import com.greenorange.promotion.model.entity.UserInfo;
|
||||
//import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
//import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
//import com.greenorange.promotion.service.wechat.WechatPayService;
|
||||
//import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
//import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
//import com.wechat.pay.java.service.refund.model.Refund;
|
||||
//import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||
//import io.swagger.v3.oas.annotations.Hidden;
|
||||
//import io.swagger.v3.oas.annotations.Operation;
|
||||
//import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
//import jakarta.annotation.Resource;
|
||||
//import jakarta.servlet.http.HttpServletRequest;
|
||||
//import jakarta.validation.Valid;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import me.chanjar.weixin.common.error.WxErrorException;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestBody;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@Tag(name = "微信支付")
|
||||
//@RequestMapping("/wxPay")
|
||||
//@Transactional
|
||||
//public class WechatPayController {
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private WechatPayService weChatService;
|
||||
//
|
||||
// @Resource
|
||||
// private UserInfoService userInfoService;
|
||||
//
|
||||
// @Resource
|
||||
// private CourseOrderService courseOrderService;
|
||||
//
|
||||
// @Resource
|
||||
// private WxOpenConfig wxOpenConfig;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * JSAPI 下单
|
||||
// */
|
||||
// @PostMapping("/payment/create")
|
||||
// @Operation(summary = "JSAPI 下单", description = "参数:订单id, 权限:所有人, 方法名:createPayment")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// public BaseResponse<PrepayWithRequestPaymentResponse> createPayment(@Valid @RequestBody WechatPayRequest wechatPayRequest, HttpServletRequest request) {
|
||||
//
|
||||
// String code = wechatPayRequest.getCode();
|
||||
// WxMaJscode2SessionResult sessionInfo;
|
||||
// String miniOpenId;
|
||||
// try {
|
||||
// WxMaService wxMaService = wxOpenConfig.getWxMaService();
|
||||
// sessionInfo = wxMaService.jsCode2SessionInfo(code);
|
||||
// miniOpenId = sessionInfo.getOpenid();
|
||||
// if (StringUtils.isAnyBlank(miniOpenId)) {
|
||||
// throw new BusinessException(ErrorCode.SYSTEM_ERROR);
|
||||
// }
|
||||
// } catch (WxErrorException e) {
|
||||
// log.error("userLoginByWxOpen error", e);
|
||||
// throw new BusinessException(ErrorCode.SYSTEM_ERROR, "登录失败,系统错误");
|
||||
// }
|
||||
// Long userId = (Long) request.getAttribute("userId");
|
||||
// UserInfo userInfo = userInfoService.getById(userId);
|
||||
//
|
||||
// Long orderId = wechatPayRequest.getOrderId();
|
||||
// CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
// ThrowUtils.throwIf(courseOrder == null, ErrorCode.NOT_FOUND_ERROR, "订单不存在");
|
||||
// ThrowUtils.throwIf(!courseOrder.getOrderStatus().equals(OrderStatusConstant.PENDING), ErrorCode.OPERATION_ERROR, "订单状态错误");
|
||||
// if (!userInfo.getId().equals(courseOrder.getUserId())) {
|
||||
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR, "你不是该订单用户!");
|
||||
// }
|
||||
// PrepayWithRequestPaymentResponse response = weChatService.createPayment(String.valueOf(orderId), miniOpenId, courseOrder.getTotalAmount());
|
||||
// return ResultUtils.success(response);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * JSAPI 下单回调
|
||||
// */
|
||||
// @Hidden
|
||||
// @PostMapping("/payment/callback")
|
||||
// @Operation(summary = "JSAPI 下单回调", description = "参数:订单id, 权限:所有人, 方法名:callbackPayment")
|
||||
// public synchronized BaseResponse<Boolean> callbackPayment(HttpServletRequest request) throws IOException {
|
||||
// // 获取下单信息
|
||||
// Transaction transaction = weChatService.getTransactionInfo(request);
|
||||
// System.out.println("下单信息:" + transaction);
|
||||
// // 支付回调
|
||||
// boolean result = weChatService.paymentCallback(transaction);
|
||||
// ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR, "微信支付回调失败");
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Web管理员部分退款
|
||||
// * @param commonRequest 订单id
|
||||
// */
|
||||
// @PostMapping("/refund/part/create")
|
||||
// @Operation(summary = "Web管理员部分退款", description = "参数:订单id, 权限:web端管理员, 方法名:createPartRefund")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// public BaseResponse<Refund> createPartRefund(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long orderId = commonRequest.getId();
|
||||
// CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
// ThrowUtils.throwIf(courseOrder == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
//
|
||||
// Refund refund = weChatService.refundPartPayment(String.valueOf(orderId), courseOrder.getTotalAmount());
|
||||
// return ResultUtils.success(refund);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 部分退款回调
|
||||
// */
|
||||
// @Hidden
|
||||
// @PostMapping("/refund/part/callback")
|
||||
// @Operation(summary = "部分退款回调", description = "参数:订单id, 权限:web端管理员, 方法名:callbackRefundPart")
|
||||
// public BaseResponse<Boolean> callbackRefundPart(HttpServletRequest request) {
|
||||
// // 获取退款信息
|
||||
// RefundNotification refundNotification = weChatService.getRefundInfo(request);
|
||||
// // 退款回调
|
||||
// boolean result = weChatService.refundPartCallback(refundNotification);
|
||||
// ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR, "退款回调失败");
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
@ -1,62 +1,62 @@
|
||||
package com.greenorange.promotion.controller.wechat;
|
||||
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.utils.OrderNumberUtils;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "微信提现模块")
|
||||
@RequestMapping("/payouts")
|
||||
@Transactional
|
||||
public class WechatPayoutsController {
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序积分提现到银行卡
|
||||
*/
|
||||
@Hidden
|
||||
@PostMapping("/points")
|
||||
@Operation(summary = "微信小程序积分提现到银行卡", description = "参数:无, 权限:所有人, 方法名:getQrcode")
|
||||
public BaseResponse<Boolean> pointsWithdrawnToBankCard(HttpServletRequest request) throws IOException {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("mch_id", "1700326544");
|
||||
param.put("partner_trade_no", OrderNumberUtils.generateOrderId());
|
||||
param.put("nonce_str", "fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t");
|
||||
param.put("sign", "");
|
||||
param.put("enc_bank_no", "6222031207006363442");
|
||||
param.put("enc_true_name", "陈新知");
|
||||
param.put("bank_code", "1002");
|
||||
param.put("amount", 5);
|
||||
param.put("desc", "提现");
|
||||
String url = "https://api.mch.weixin.qq.com/mmpaysptrans/pay_bank";
|
||||
String jsonParams = JSONUtil.toJsonStr(param);
|
||||
String response = HttpUtil.createPost(url)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(jsonParams)
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//package com.greenorange.promotion.controller.wechat;
|
||||
//
|
||||
//
|
||||
//import cn.hutool.http.HttpUtil;
|
||||
//import cn.hutool.json.JSONUtil;
|
||||
//import com.greenorange.promotion.common.BaseResponse;
|
||||
//import com.greenorange.promotion.common.ResultUtils;
|
||||
//import com.greenorange.promotion.utils.OrderNumberUtils;
|
||||
//import io.swagger.v3.oas.annotations.Hidden;
|
||||
//import io.swagger.v3.oas.annotations.Operation;
|
||||
//import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
//import jakarta.servlet.http.HttpServletRequest;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@Tag(name = "微信提现模块")
|
||||
//@RequestMapping("/payouts")
|
||||
//@Transactional
|
||||
//public class WechatPayoutsController {
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 微信小程序积分提现到银行卡
|
||||
// */
|
||||
// @Hidden
|
||||
// @PostMapping("/points")
|
||||
// @Operation(summary = "微信小程序积分提现到银行卡", description = "参数:无, 权限:所有人, 方法名:getQrcode")
|
||||
// public BaseResponse<Boolean> pointsWithdrawnToBankCard(HttpServletRequest request) throws IOException {
|
||||
// Map<String, Object> param = new HashMap<>();
|
||||
// param.put("mch_id", "1700326544");
|
||||
// param.put("partner_trade_no", OrderNumberUtils.generateOrderId());
|
||||
// param.put("nonce_str", "fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t");
|
||||
// param.put("sign", "");
|
||||
// param.put("enc_bank_no", "6222031207006363442");
|
||||
// param.put("enc_true_name", "陈新知");
|
||||
// param.put("bank_code", "1002");
|
||||
// param.put("amount", 5);
|
||||
// param.put("desc", "提现");
|
||||
// String url = "https://api.mch.weixin.qq.com/mmpaysptrans/pay_bank";
|
||||
// String jsonParams = JSONUtil.toJsonStr(param);
|
||||
// String response = HttpUtil.createPost(url)
|
||||
// .header("Content-Type", "application/json")
|
||||
// .body(jsonParams)
|
||||
// .execute()
|
||||
// .body();
|
||||
//
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
@ -89,5 +89,12 @@ public class GlobalExceptionHandler {
|
||||
}
|
||||
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public BaseResponse<?> runtimeExceptionHandler(RuntimeException e) {
|
||||
log.error("RuntimeException", e);
|
||||
return ResultUtils.error(ErrorCode.SYSTEM_ERROR, "未知异常");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package com.greenorange.promotion.model.dto.withdrawalApply;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.WithdrawStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 提现申请记录审核请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "提现申请记录审核请求体", requiredProperties = {
|
||||
"id", "withdrawalStatus"
|
||||
})
|
||||
public class WithdrawalApplyReviewRequest implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 提现申请ID
|
||||
*/
|
||||
@Min(value = 1L, message = "提现申请ID ID不能小于1")
|
||||
@Schema(description = "提现申请ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 提现状态[提现中(processing)|提现成功(success)|提现失败(failed)]
|
||||
*/
|
||||
@EnumValue(enumClass = WithdrawStatusEnum.class)
|
||||
@Schema(description = "提现状态[提现中(processing)|提现成功(success)|提现失败(failed)]", example = "processing")
|
||||
private String withdrawalStatus;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -256,9 +256,11 @@ public class ProjectCommissionServiceImpl extends ServiceImpl<ProjectCommissionM
|
||||
|
||||
LambdaQueryWrapper<ProjectCommission> projectCommissionLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
projectCommissionLambdaQueryWrapper.eq(ProjectCommission::getUserId, userId);
|
||||
projectCommissionLambdaQueryWrapper.select(ProjectCommission::getProjectDetailId, ProjectCommission::getId);
|
||||
List<ProjectCommission> projectCommissionList = this.list(projectCommissionLambdaQueryWrapper);
|
||||
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId);
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetFieldWithSpecificFields(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId,
|
||||
List.of(ProjectDetail::getId, ProjectDetail::getMaxCommissionRate, ProjectDetail::getProjectMinSettlementPrice));
|
||||
// 封装map集合(键:项目明细id, 值:项目明细最大抽佣比例)
|
||||
Map<Long, BigDecimal> map = new HashMap<>();
|
||||
Map<Long, BigDecimal> minPriceMap = new HashMap<>();
|
||||
@ -285,6 +287,7 @@ public class ProjectCommissionServiceImpl extends ServiceImpl<ProjectCommissionM
|
||||
// 修改下级用户的项目明细抽佣比例
|
||||
LambdaQueryWrapper<SubUserProjectCommission> subUserProjectCommissionLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
subUserProjectCommissionLambdaQueryWrapper.eq(SubUserProjectCommission::getUserId, userId);
|
||||
subUserProjectCommissionLambdaQueryWrapper.select(SubUserProjectCommission::getProjectDetailId, SubUserProjectCommission::getId);
|
||||
List<SubUserProjectCommission> subUserProjectCommissionList = subUserProjectCommissionService.list(subUserProjectCommissionLambdaQueryWrapper);
|
||||
for (SubUserProjectCommission subUserProjectCommission : subUserProjectCommissionList) {
|
||||
Long projectDetailId = subUserProjectCommission.getProjectDetailId();
|
||||
|
||||
@ -72,7 +72,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project>
|
||||
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
// 获取项目明细抽佣列表
|
||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetField(ProjectCommission::getUserId, userId, projectCommissionService);
|
||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetFieldWithSpecificFields(
|
||||
ProjectCommission::getUserId, userId, projectCommissionService, List.of(ProjectCommission::getProjectId, ProjectCommission::getMyUnitPrice));
|
||||
// 封装Map集合(键:项目id, 值:项目总价)
|
||||
Map<Long, BigDecimal> projectPriceMap = new HashMap<>();
|
||||
for (ProjectCommission projectCommission : projectCommissionList) {
|
||||
|
||||
@ -30,6 +30,7 @@ public class PromoCodeServiceImpl extends ServiceImpl<PromoCodeMapper, PromoCode
|
||||
List<Long> ids = commonBatchRequest.getIds();
|
||||
LambdaQueryWrapper<PromoCode> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(PromoCode::getId, ids).eq(PromoCode::getPromoCodeStatus, true);
|
||||
lambdaQueryWrapper.select(PromoCode::getId);
|
||||
List<PromoCode> promoCodeList = this.list(lambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(promoCodeList.size() > 0, ErrorCode.OPERATION_ERROR, "当前推广码正在使用中,无法删除");
|
||||
this.removeByIds(ids);
|
||||
|
||||
@ -101,4 +101,6 @@ public interface UserInfoService extends IService<UserInfo> {
|
||||
* 查询当前用户的所有下级用户(包括间接)
|
||||
*/
|
||||
List<Long> findAllSubUser(Long userId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.config.WxOpenConfig;
|
||||
import com.greenorange.promotion.constant.CommonConstant;
|
||||
import com.greenorange.promotion.constant.SystemConstant;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
@ -40,10 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@ -174,7 +170,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserInfo::getNickName, nickName).eq(UserInfo::getUserRole, UserConstant.SUPERVISOR_ROLE);
|
||||
UserInfo userInfo = this.getOne(lambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(userInfo != null, ErrorCode.OPERATION_ERROR, "昵称重复");
|
||||
ThrowUtils.throwIf(userInfo != null, ErrorCode.OPERATION_ERROR, "昵称已存在");
|
||||
}
|
||||
|
||||
// 根据邀请码获得上级用户信息
|
||||
@ -187,13 +183,30 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
userRoleMap.put(UserRoleEnum.STAFF, 2);
|
||||
userRoleMap.put(UserRoleEnum.SUPERVISOR, 3);
|
||||
userRoleMap.put(UserRoleEnum.MANAGER, 4);
|
||||
if (userRoleMap.get(parentUserRoleEnum) - userRoleMap.get(userRoleEnum) != 1 || UserRoleEnum.USER.equals(userRoleEnum) && UserRoleEnum.USER.equals(parentUserRoleEnum))
|
||||
int level = userRoleMap.get(parentUserRoleEnum) - userRoleMap.get(userRoleEnum);
|
||||
if (!(level == 1 || level == 0 && UserRoleEnum.USER.equals(userRoleEnum) && UserRoleEnum.USER.equals(parentUserRoleEnum)))
|
||||
throw new BusinessException(ErrorCode.OPERATION_ERROR, "邀请码错误");
|
||||
|
||||
// 保存用户
|
||||
UserInfo myUserInfo = commonService.copyProperties(userInfoRegisterRequest, UserInfo.class);
|
||||
myUserInfo.setParentUserId(parentUserInfo.getId());
|
||||
myUserInfo.setInvitationCode(RandomUtil.randomNumbers(6));
|
||||
// 获取唯一的邀请码
|
||||
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(UserInfo::getInvitationCode);
|
||||
lambdaQueryWrapper.in(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE, UserConstant.STAFF_ROLE, UserConstant.SUPERVISOR_ROLE, UserConstant.MANAGER_ROLE);
|
||||
List<UserInfo> userInfos;
|
||||
String inviteCode;
|
||||
while (true) {
|
||||
String tempCode = RandomUtil.randomNumbers(6);
|
||||
userInfos = this.list(lambdaQueryWrapper);
|
||||
boolean exists = userInfos.stream()
|
||||
.anyMatch(u -> u.getInvitationCode().equals(tempCode));
|
||||
if (!exists) {
|
||||
inviteCode = tempCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
myUserInfo.setInvitationCode(inviteCode);
|
||||
myUserInfo.setUserAccount(phoneNumber);
|
||||
myUserInfo.setUserRole(userRole);
|
||||
myUserInfo.setUserAvatar(UserConstant.USER_DEFAULT_AVATAR);
|
||||
@ -210,11 +223,16 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
|
||||
// 生成邀请二维码
|
||||
String invitationQrcode = generateInvitationQrcode(myUserInfo.getInvitationCode(), userRoleEnum);
|
||||
|
||||
// 添加用户主要信息
|
||||
UserMainInfo userMainInfo = UserMainInfo.builder().userId(myUserInfo.getId()).inviteQrCode(invitationQrcode).build();
|
||||
userMainInfoService.save(userMainInfo);
|
||||
|
||||
// // 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
|
||||
// saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
|
||||
// 更新上级用户团队人数
|
||||
updateParentUserInfoTeamCount(parentUserInfo.getId());
|
||||
|
||||
// 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
|
||||
saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
|
||||
}
|
||||
|
||||
|
||||
@ -349,7 +367,13 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
|
||||
// 判断手机号是否已注册
|
||||
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber).eq(UserInfo::getUserRole, userRole);
|
||||
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
if (UserRoleEnum.USER.equals(userRoleEnum)) {
|
||||
lambdaQueryWrapper.eq(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE);
|
||||
} else {
|
||||
lambdaQueryWrapper.in(UserInfo::getUserRole, UserConstant.STAFF_ROLE, UserConstant.SUPERVISOR_ROLE, UserConstant.MANAGER_ROLE);
|
||||
}
|
||||
lambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber);
|
||||
UserInfo userInfo = this.getOne(lambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(userInfo != null, ErrorCode.OPERATION_ERROR, "手机号已注册");
|
||||
|
||||
@ -360,6 +384,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户手机号和验证码
|
||||
*/
|
||||
@ -371,9 +396,12 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
phoneNumberLambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber);
|
||||
phoneNumberLambdaQueryWrapper = getQueryWrapperByUserRole(userRoleEnum, phoneNumberLambdaQueryWrapper);
|
||||
UserInfo userInfo = this.getOne(phoneNumberLambdaQueryWrapper);
|
||||
String userRole = userInfo.getUserRole();
|
||||
UserRoleEnum currentUserRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
ThrowUtils.throwIf(userInfo != null, ErrorCode.OPERATION_ERROR, "该手机号为"+ currentUserRoleEnum.getText() +"账号");
|
||||
if (userInfo != null) {
|
||||
String userRole = userInfo.getUserRole();
|
||||
UserRoleEnum currentUserRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
if (!currentUserRoleEnum.equals(userRoleEnum)) throw new BusinessException(ErrorCode.OPERATION_ERROR, "该手机号为"+ currentUserRoleEnum.getText() +"账号");
|
||||
else throw new BusinessException(ErrorCode.OPERATION_ERROR, "该手机号已注册");
|
||||
}
|
||||
}
|
||||
String code = redisTemplate.opsForValue().get(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
ThrowUtils.throwIf(code == null, ErrorCode.OPERATION_ERROR, "验证码已失效");
|
||||
@ -407,6 +435,11 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
AdvancementApply advancementApply = advancementApplyService.getById(applyId);
|
||||
String phoneNumber = advancementApply.getPhone();
|
||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
||||
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber)
|
||||
.in(UserInfo::getUserRole, UserConstant.STAFF_ROLE, UserConstant.SUPERVISOR_ROLE, UserConstant.MANAGER_ROLE);
|
||||
UserInfo userInfo = this.getOne(lambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(userInfo != null, ErrorCode.OPERATION_ERROR, "手机号已注册");
|
||||
|
||||
// 根据邀请码获得上级用户信息
|
||||
Long userId = advancementApplyApproveRequest.getUserId();
|
||||
@ -433,11 +466,16 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
|
||||
// 生成邀请二维码
|
||||
String invitationQrcode = generateInvitationQrcode(myUserInfo.getInvitationCode(), UserRoleEnum.STAFF);
|
||||
|
||||
// 添加用户主要信息
|
||||
UserMainInfo userMainInfo = UserMainInfo.builder().userId(myUserInfo.getId()).inviteQrCode(invitationQrcode).build();
|
||||
userMainInfoService.save(userMainInfo);
|
||||
|
||||
// // 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
|
||||
// saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
|
||||
// 更新上级用户团队人数
|
||||
updateParentUserInfoTeamCount(parentUserInfo.getId());
|
||||
|
||||
// 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
|
||||
saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
|
||||
|
||||
// 修改晋升申请记录的审核状态,并绑定申请成功的用户id
|
||||
LambdaUpdateWrapper<AdvancementApply> advancementApplyLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
@ -485,7 +523,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
@Override
|
||||
public LambdaQueryWrapper<UserInfo> getMiniUserInfoQueryWrapper() {
|
||||
LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userInfoLambdaQueryWrapper.in(UserInfo::getUserRole, UserRoleEnum.USER, UserRoleEnum.MANAGER, UserRoleEnum.SUPERVISOR, UserRoleEnum.STAFF);
|
||||
userInfoLambdaQueryWrapper.in(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE, UserConstant.STAFF_ROLE, UserConstant.SUPERVISOR_ROLE, UserConstant.MANAGER_ROLE);
|
||||
return userInfoLambdaQueryWrapper;
|
||||
}
|
||||
|
||||
@ -505,16 +543,13 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
/**
|
||||
* 批量更新父级用户团队人数
|
||||
*/
|
||||
private UserMainInfo updateParentUserInfoTeamCount(Long userId) {
|
||||
UserMainInfo userMainInfo = new UserMainInfo();
|
||||
userMainInfo.setUserId(userId);
|
||||
private void updateParentUserInfoTeamCount(Long userId) {
|
||||
List<Long> pathToRoot = this.findPathToRoot(userId);
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(pathToRoot, userMainInfoService, id -> id, UserMainInfo::getUserId);
|
||||
for (UserMainInfo mainInfo : userMainInfoList) {
|
||||
mainInfo.setTeamSize(mainInfo.getTeamSize() + 1);
|
||||
}
|
||||
userMainInfoService.updateBatchById(userMainInfoList);
|
||||
return userMainInfo;
|
||||
}
|
||||
|
||||
|
||||
@ -540,7 +575,8 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetField(ProjectCommission::getUserId, parentUserId, projectCommissionService);
|
||||
// 封装Map集合(键:项目明细id, 值:项目最小价格)
|
||||
Map<Long, BigDecimal> projectDetailMinPriceMap = new HashMap<>();
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId);
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetFieldWithSpecificFields(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId,
|
||||
List.of(ProjectDetail::getId, ProjectDetail::getProjectMinSettlementPrice));
|
||||
for (ProjectDetail projectDetail : projectDetailList) {
|
||||
projectDetailMinPriceMap.put(projectDetail.getId(), projectDetail.getProjectMinSettlementPrice());
|
||||
}
|
||||
@ -593,6 +629,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -1,368 +1,367 @@
|
||||
package com.greenorange.promotion.service.wechat.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.config.WxPayConfig;
|
||||
import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
import com.greenorange.promotion.constant.SystemConstant;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.entity.*;
|
||||
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||
import com.greenorange.promotion.service.course.CourseService;
|
||||
import com.greenorange.promotion.service.refund.RefundRecordService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserPerformanceSummaryService;
|
||||
import com.greenorange.promotion.service.wechat.WechatPayService;
|
||||
import com.greenorange.promotion.utils.RefundUtils;
|
||||
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||
import com.wechat.pay.java.core.notification.RequestParam;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
import com.wechat.pay.java.service.refund.model.AmountReq;
|
||||
import com.wechat.pay.java.service.refund.model.CreateRequest;
|
||||
import com.wechat.pay.java.service.refund.model.Refund;
|
||||
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author 陈新知
|
||||
*/
|
||||
@Service
|
||||
public class WechatPayServiceImpl implements WechatPayService {
|
||||
|
||||
|
||||
@Resource
|
||||
private WxPayConfig wxPayConfig;
|
||||
|
||||
|
||||
@Resource
|
||||
private CourseOrderService courseOrderService;
|
||||
|
||||
|
||||
@Resource
|
||||
private CourseService courseService;
|
||||
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
|
||||
@Resource
|
||||
private RefundRecordService refundRecordService;
|
||||
|
||||
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
|
||||
@Resource
|
||||
private UserPerformanceSummaryService userPerformanceSummaryService;
|
||||
|
||||
|
||||
@Resource
|
||||
private CoursePromotionCommissionPendingService coursePromotionCommissionPendingService;
|
||||
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
public static RequestParam requestParam = null;
|
||||
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
*/
|
||||
@Override
|
||||
public PrepayWithRequestPaymentResponse createPayment(String orderId, String miniOpenId, BigDecimal amount) {
|
||||
// request.setXxx(val)设置所需参数,具体参数可见Request定义
|
||||
PrepayRequest request = new PrepayRequest();
|
||||
// 金额
|
||||
Amount WxAmount = new Amount();
|
||||
WxAmount.setTotal(amount.movePointRight(2).intValue());
|
||||
WxAmount.setCurrency("CNY");
|
||||
request.setAmount(WxAmount);
|
||||
// 公众号id
|
||||
request.setAppid(wxPayConfig.getAppId());
|
||||
// 商户号
|
||||
request.setMchid(wxPayConfig.getMerchantId());
|
||||
// 支付者信息
|
||||
Payer payer = new Payer();
|
||||
payer.setOpenid(miniOpenId);
|
||||
request.setPayer(payer);
|
||||
// 获取订单号
|
||||
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
String orderNumber = courseOrder.getOrderNumber();
|
||||
// 描述
|
||||
request.setDescription("订单号:" + orderNumber);
|
||||
// 微信回调地址
|
||||
request.setNotifyUrl(wxPayConfig.getNotifyUrl() + "/wxPay/payment/callback");
|
||||
// 商户订单号
|
||||
request.setOutTradeNo(orderNumber);
|
||||
//返回数据,前端调起支付
|
||||
return wxPayConfig.getJsapiServiceExtension().prepayWithRequestPayment(request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付回调
|
||||
*/
|
||||
@Override
|
||||
public boolean paymentCallback(Transaction transaction) throws IOException {
|
||||
System.out.println("---------------------------微信支付回调(开始)-------------------------------");
|
||||
// 获取订单信息
|
||||
String orderNumber = transaction.getOutTradeNo();
|
||||
LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CourseOrder::getOrderNumber, orderNumber);
|
||||
CourseOrder courseOrder = courseOrderService.getOne(queryWrapper);
|
||||
|
||||
// 修改订单状态
|
||||
LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CourseOrder::getId, courseOrder.getId())
|
||||
.set(CourseOrder::getOrderStatus, OrderStatusConstant.SUCCESS);
|
||||
courseOrderService.update(updateWrapper);
|
||||
|
||||
// 修改当前课程下单人数
|
||||
Long courseId = courseOrder.getCourseId();
|
||||
Course course = courseService.getById(courseId);
|
||||
if (course != null) {
|
||||
course.setOrderCount(course.getOrderCount() + 1);
|
||||
courseService.updateById(course);
|
||||
}
|
||||
|
||||
// 更新主管和员工的绩效记录
|
||||
Long userId = courseOrder.getUserId();
|
||||
List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
||||
List<Long> superUserIdList = pathToRoot.subList(1, 3);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(superUserIdList, userPerformanceSummaryService, Function.identity(), UserPerformanceSummary::getUserId);
|
||||
BigDecimal rate;
|
||||
Map<String, BigDecimal> rateMap = userPerformanceSummaryService.queryRakeRewardsRate();
|
||||
for (int i = 0; i < userPerformanceSummaryList.size(); i ++ ) {
|
||||
if (i == 0) rate = rateMap.get("first");
|
||||
else rate = rateMap.get("second");
|
||||
// 计算理论上获得的最大提成奖励
|
||||
BigDecimal rakeRewards = courseOrder.getTotalAmount().multiply(rate);
|
||||
UserPerformanceSummary userPerformanceSummary = userPerformanceSummaryList.get(i);
|
||||
|
||||
userPerformanceSummary.setTotalAmount(userPerformanceSummary.getTotalAmount().add(courseOrder.getTotalAmount()));
|
||||
userPerformanceSummary.setNetAmount(userPerformanceSummary.getNetAmount().add(courseOrder.getTotalAmount().multiply(SystemConstant.FEE_RATE)));
|
||||
userPerformanceSummary.setOrderCount(userPerformanceSummary.getOrderCount() + 1);
|
||||
userPerformanceSummary.setToRelease(userPerformanceSummary.getToRelease().add(rakeRewards.multiply(SystemConstant.REFUND_RATE)));
|
||||
userPerformanceSummary.setToSettle(userPerformanceSummary.getToSettle().add(rakeRewards.multiply(SystemConstant.FEE_RATE)));
|
||||
}
|
||||
userPerformanceSummaryService.updateBatchById(userPerformanceSummaryList);
|
||||
|
||||
|
||||
// 添加课程推广待提成记录
|
||||
Long firstUserId = pathToRoot.get(0);
|
||||
Long secondUserId = pathToRoot.get(1);
|
||||
CoursePromotionCommissionPending coursePromotionCommissionPending = CoursePromotionCommissionPending.builder()
|
||||
.firstUserId(firstUserId)
|
||||
.secondUserId(secondUserId)
|
||||
.courseId(courseId)
|
||||
.name(courseOrder.getName())
|
||||
.type(courseOrder.getType())
|
||||
.image(courseOrder.getImage())
|
||||
.orderId(courseOrder.getId())
|
||||
.userId(userId)
|
||||
.firstRate(rateMap.get("first"))
|
||||
.secondRate(rateMap.get("second"))
|
||||
.firstReward(courseOrder.getTotalAmount().multiply(rateMap.get("first")))
|
||||
.secondReward(courseOrder.getTotalAmount().multiply(rateMap.get("second")))
|
||||
.totalAmount(courseOrder.getTotalAmount())
|
||||
.commissionStatus(CommissionStatusEnum.PENDING.getValue())
|
||||
.orderCreateTime(courseOrder.getCreateTime())
|
||||
.build();
|
||||
coursePromotionCommissionPendingService.save(coursePromotionCommissionPending);
|
||||
|
||||
|
||||
System.out.println("---------------------------微信支付回调(结束)-------------------------------");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 部分退款申请
|
||||
*/
|
||||
@Override
|
||||
public Refund refundPartPayment(String orderId, BigDecimal refundAmount) {
|
||||
// 获取订单
|
||||
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
ThrowUtils.throwIf(courseOrder == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
// 判断该订单是否已经退款
|
||||
ThrowUtils.throwIf(courseOrder.getOrderStatus().equals(OrderStatusConstant.REFUNDED), ErrorCode.OPERATION_ERROR, "订单已退款");
|
||||
|
||||
String orderNumber = courseOrder.getOrderNumber();
|
||||
// 退款请求
|
||||
CreateRequest createRequest = new CreateRequest();
|
||||
// 商户订单号
|
||||
createRequest.setOutTradeNo(orderNumber);
|
||||
// 商户退款单号
|
||||
String outRefundNo = RefundUtils.generateRefundNo();
|
||||
createRequest.setOutRefundNo(outRefundNo);
|
||||
// 退款结果回调
|
||||
createRequest.setNotifyUrl(wxPayConfig.getNotifyUrl() + "/wxPay/refund/part/callback");
|
||||
// 退款金额
|
||||
AmountReq amountReq = new AmountReq();
|
||||
|
||||
amountReq.setRefund(refundAmount.movePointRight(2).longValue());
|
||||
amountReq.setTotal(courseOrder.getTotalAmount().movePointRight(2).longValue());
|
||||
amountReq.setCurrency("CNY");
|
||||
createRequest.setAmount(amountReq);
|
||||
|
||||
// // 生成退款记录
|
||||
// Course course = courseService.getById(courseOrder.getCourseId());
|
||||
// RefundRecord refundRecord = commonService.copyProperties(course, RefundRecord.class);
|
||||
// refundRecord.setId(null);
|
||||
// refundRecord.setOutTradeNo(orderNumber);
|
||||
// refundRecord.setOutRefundNo(outRefundNo);
|
||||
// refundRecord.setTotalAmount(courseOrder.getTotalAmount().movePointRight(2));
|
||||
// refundRecord.setRefundAmount(refundAmount.movePointRight(2));
|
||||
// refundRecord.setUserId(courseOrder.getUserId());
|
||||
// refundRecord.setCreateTime(null);
|
||||
// refundRecord.setUpdateTime(null);
|
||||
// refundRecordService.save(refundRecord);
|
||||
|
||||
// 申请退款
|
||||
System.out.println("退款请求:" + createRequest);
|
||||
Refund refund = wxPayConfig.getRefundService().create(createRequest);
|
||||
System.out.println("退款申请结果:" + refund);
|
||||
|
||||
return refund;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 部分退款回调
|
||||
*/
|
||||
@Override
|
||||
public boolean refundPartCallback(RefundNotification refundNotification) {
|
||||
System.out.println("---------------------------微信退款回调(开始)-------------------------------");
|
||||
// 获取订单信息
|
||||
String orderNumber = refundNotification.getOutTradeNo();
|
||||
LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CourseOrder::getOrderNumber, orderNumber);
|
||||
CourseOrder courseOrder = courseOrderService.getOne(queryWrapper);
|
||||
|
||||
// 修改订单状态
|
||||
LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CourseOrder::getId, courseOrder.getId())
|
||||
.set(CourseOrder::getOrderStatus, OrderStatusConstant.REFUNDED);
|
||||
courseOrderService.update(updateWrapper);
|
||||
|
||||
// 修改课程下单人数
|
||||
Long courseId = courseOrder.getCourseId();
|
||||
Course course = courseService.getById(courseId);
|
||||
if (course != null) {
|
||||
course.setOrderCount(course.getOrderCount() - 1);
|
||||
courseService.updateById(course);
|
||||
}
|
||||
|
||||
// 更新主管和员工的绩效记录
|
||||
Long userId = courseOrder.getUserId();
|
||||
List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
||||
List<Long> superUserIdList = pathToRoot.subList(1, 3);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(superUserIdList, userPerformanceSummaryService, Function.identity(), UserPerformanceSummary::getUserId);
|
||||
BigDecimal rate;
|
||||
LambdaQueryWrapper<CoursePromotionCommissionPending> coursePromotionQueryWrapper = new LambdaQueryWrapper<>();
|
||||
coursePromotionQueryWrapper.eq(CoursePromotionCommissionPending::getOrderId, courseOrder.getId());
|
||||
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getOne(coursePromotionQueryWrapper);
|
||||
for (int i = 0; i < userPerformanceSummaryList.size(); i ++ ) {
|
||||
if (i == 0) rate = coursePromotionCommissionPending.getFirstRate();
|
||||
else rate = coursePromotionCommissionPending.getSecondRate();
|
||||
// 计算理论上获得的最大提成奖励
|
||||
BigDecimal rakeRewards = courseOrder.getTotalAmount().multiply(rate);
|
||||
UserPerformanceSummary userPerformanceSummary = userPerformanceSummaryList.get(i);
|
||||
|
||||
userPerformanceSummary.setTotalAmount(userPerformanceSummary.getTotalAmount().subtract(courseOrder.getTotalAmount()));
|
||||
userPerformanceSummary.setNetAmount(userPerformanceSummary.getNetAmount().subtract(courseOrder.getTotalAmount().multiply(SystemConstant.FEE_RATE)));
|
||||
userPerformanceSummary.setToRelease(userPerformanceSummary.getToRelease().subtract(rakeRewards.multiply(SystemConstant.REFUND_RATE)));
|
||||
userPerformanceSummary.setRefunded(userPerformanceSummary.getRefunded().add(courseOrder.getTotalAmount().multiply(SystemConstant.REFUND_RATE)));
|
||||
}
|
||||
userPerformanceSummaryService.updateBatchById(userPerformanceSummaryList);
|
||||
|
||||
// 修改课程推广待提成状态为"已失效"
|
||||
LambdaUpdateWrapper<CoursePromotionCommissionPending> coursePromotionUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
coursePromotionUpdateWrapper.eq(CoursePromotionCommissionPending::getOrderId, courseOrder.getId())
|
||||
.set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.EXPIRED.getValue());
|
||||
coursePromotionCommissionPendingService.update(coursePromotionUpdateWrapper);
|
||||
|
||||
System.out.println("---------------------------微信退款回调(结束)-------------------------------");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取支付回调信息
|
||||
*/
|
||||
@Override
|
||||
public Transaction getTransactionInfo(HttpServletRequest request) {
|
||||
NotificationParser notificationParser = getNotificationParser(request);
|
||||
return notificationParser.parse(requestParam, Transaction.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取退款回调信息
|
||||
*/
|
||||
@Override
|
||||
public RefundNotification getRefundInfo(HttpServletRequest request) {
|
||||
NotificationParser notificationParser = getNotificationParser(request);
|
||||
return notificationParser.parse(requestParam, RefundNotification.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据微信官方发送的请求获取信息
|
||||
*/
|
||||
@SneakyThrows
|
||||
public NotificationParser getNotificationParser(HttpServletRequest request) {
|
||||
System.out.println("---------------------------获取信息-------------------------------");
|
||||
// 获取RSA配置
|
||||
NotificationParser notificationParser = new NotificationParser(wxPayConfig.getRSAConfig());
|
||||
// 构建请求
|
||||
StringBuilder bodyBuilder = new StringBuilder();
|
||||
BufferedReader reader = request.getReader();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
bodyBuilder.append(line);
|
||||
}
|
||||
String body = bodyBuilder.toString();
|
||||
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||
String nonce = request.getHeader("Wechatpay-Nonce");
|
||||
String signature = request.getHeader("Wechatpay-Signature");
|
||||
String singType = request.getHeader("Wechatpay-Signature-Type");
|
||||
String wechatPayCertificateSerialNumber = request.getHeader("Wechatpay-Serial");
|
||||
requestParam = new RequestParam.Builder()
|
||||
.serialNumber(wechatPayCertificateSerialNumber)
|
||||
.nonce(nonce)
|
||||
.signature(signature)
|
||||
.timestamp(timestamp)
|
||||
.signType(singType)
|
||||
.body(body)
|
||||
.build();
|
||||
System.out.println(requestParam.toString());
|
||||
System.out.println("---------------------------信息获取完毕-------------------------------");
|
||||
return notificationParser;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//package com.greenorange.promotion.service.wechat.impl;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
//import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
//import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
//import com.greenorange.promotion.common.ErrorCode;
|
||||
//import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
//import com.greenorange.promotion.constant.SystemConstant;
|
||||
//import com.greenorange.promotion.exception.ThrowUtils;
|
||||
//import com.greenorange.promotion.model.entity.*;
|
||||
//import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||
//import com.greenorange.promotion.service.common.CommonService;
|
||||
//import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
//import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||
//import com.greenorange.promotion.service.course.CourseService;
|
||||
//import com.greenorange.promotion.service.refund.RefundRecordService;
|
||||
//import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
//import com.greenorange.promotion.service.userInfo.UserPerformanceSummaryService;
|
||||
//import com.greenorange.promotion.service.wechat.WechatPayService;
|
||||
//import com.greenorange.promotion.utils.RefundUtils;
|
||||
//import com.wechat.pay.java.core.notification.NotificationParser;
|
||||
//import com.wechat.pay.java.core.notification.RequestParam;
|
||||
//import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||
//import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
||||
//import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
||||
//import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
//import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
//import com.wechat.pay.java.service.refund.model.AmountReq;
|
||||
//import com.wechat.pay.java.service.refund.model.CreateRequest;
|
||||
//import com.wechat.pay.java.service.refund.model.Refund;
|
||||
//import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||
//import jakarta.annotation.Resource;
|
||||
//import jakarta.servlet.http.HttpServletRequest;
|
||||
//import lombok.SneakyThrows;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import java.io.BufferedReader;
|
||||
//import java.io.IOException;
|
||||
//import java.math.BigDecimal;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.function.Function;
|
||||
//
|
||||
///**
|
||||
// * @author 陈新知
|
||||
// */
|
||||
//@Service
|
||||
//public class WechatPayServiceImpl implements WechatPayService {
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private WxPayConfig wxPayConfig;
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private CourseOrderService courseOrderService;
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private CourseService courseService;
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private CommonService commonService;
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private RefundRecordService refundRecordService;
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private UserInfoService userInfoService;
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private UserPerformanceSummaryService userPerformanceSummaryService;
|
||||
//
|
||||
//
|
||||
// @Resource
|
||||
// private CoursePromotionCommissionPendingService coursePromotionCommissionPendingService;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 请求参数
|
||||
// */
|
||||
// public static RequestParam requestParam = null;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 微信支付
|
||||
// */
|
||||
// @Override
|
||||
// public PrepayWithRequestPaymentResponse createPayment(String orderId, String miniOpenId, BigDecimal amount) {
|
||||
// // request.setXxx(val)设置所需参数,具体参数可见Request定义
|
||||
// PrepayRequest request = new PrepayRequest();
|
||||
// // 金额
|
||||
// Amount WxAmount = new Amount();
|
||||
// WxAmount.setTotal(amount.movePointRight(2).intValue());
|
||||
// WxAmount.setCurrency("CNY");
|
||||
// request.setAmount(WxAmount);
|
||||
// // 公众号id
|
||||
// request.setAppid(wxPayConfig.getAppId());
|
||||
// // 商户号
|
||||
// request.setMchid(wxPayConfig.getMerchantId());
|
||||
// // 支付者信息
|
||||
// Payer payer = new Payer();
|
||||
// payer.setOpenid(miniOpenId);
|
||||
// request.setPayer(payer);
|
||||
// // 获取订单号
|
||||
// CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
// String orderNumber = courseOrder.getOrderNumber();
|
||||
// // 描述
|
||||
// request.setDescription("订单号:" + orderNumber);
|
||||
// // 微信回调地址
|
||||
// request.setNotifyUrl(wxPayConfig.getNotifyUrl() + "/wxPay/payment/callback");
|
||||
// // 商户订单号
|
||||
// request.setOutTradeNo(orderNumber);
|
||||
// //返回数据,前端调起支付
|
||||
// return wxPayConfig.getJsapiServiceExtension().prepayWithRequestPayment(request);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 支付回调
|
||||
// */
|
||||
// @Override
|
||||
// public boolean paymentCallback(Transaction transaction) throws IOException {
|
||||
// System.out.println("---------------------------微信支付回调(开始)-------------------------------");
|
||||
// // 获取订单信息
|
||||
// String orderNumber = transaction.getOutTradeNo();
|
||||
// LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(CourseOrder::getOrderNumber, orderNumber);
|
||||
// CourseOrder courseOrder = courseOrderService.getOne(queryWrapper);
|
||||
//
|
||||
// // 修改订单状态
|
||||
// LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
// updateWrapper.eq(CourseOrder::getId, courseOrder.getId())
|
||||
// .set(CourseOrder::getOrderStatus, OrderStatusConstant.SUCCESS);
|
||||
// courseOrderService.update(updateWrapper);
|
||||
//
|
||||
// // 修改当前课程下单人数
|
||||
// Long courseId = courseOrder.getCourseId();
|
||||
// Course course = courseService.getById(courseId);
|
||||
// if (course != null) {
|
||||
// course.setOrderCount(course.getOrderCount() + 1);
|
||||
// courseService.updateById(course);
|
||||
// }
|
||||
//
|
||||
// // 更新主管和员工的绩效记录
|
||||
// Long userId = courseOrder.getUserId();
|
||||
// List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
||||
// List<Long> superUserIdList = pathToRoot.subList(1, 3);
|
||||
// List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(superUserIdList, userPerformanceSummaryService, Function.identity(), UserPerformanceSummary::getUserId);
|
||||
// BigDecimal rate;
|
||||
// Map<String, BigDecimal> rateMap = userPerformanceSummaryService.queryRakeRewardsRate();
|
||||
// for (int i = 0; i < userPerformanceSummaryList.size(); i ++ ) {
|
||||
// if (i == 0) rate = rateMap.get("first");
|
||||
// else rate = rateMap.get("second");
|
||||
// // 计算理论上获得的最大提成奖励
|
||||
// BigDecimal rakeRewards = courseOrder.getTotalAmount().multiply(rate);
|
||||
// UserPerformanceSummary userPerformanceSummary = userPerformanceSummaryList.get(i);
|
||||
//
|
||||
// userPerformanceSummary.setTotalAmount(userPerformanceSummary.getTotalAmount().add(courseOrder.getTotalAmount()));
|
||||
// userPerformanceSummary.setNetAmount(userPerformanceSummary.getNetAmount().add(courseOrder.getTotalAmount().multiply(SystemConstant.FEE_RATE)));
|
||||
// userPerformanceSummary.setOrderCount(userPerformanceSummary.getOrderCount() + 1);
|
||||
// userPerformanceSummary.setToRelease(userPerformanceSummary.getToRelease().add(rakeRewards.multiply(SystemConstant.REFUND_RATE)));
|
||||
// userPerformanceSummary.setToSettle(userPerformanceSummary.getToSettle().add(rakeRewards.multiply(SystemConstant.FEE_RATE)));
|
||||
// }
|
||||
// userPerformanceSummaryService.updateBatchById(userPerformanceSummaryList);
|
||||
//
|
||||
//
|
||||
// // 添加课程推广待提成记录
|
||||
// Long firstUserId = pathToRoot.get(0);
|
||||
// Long secondUserId = pathToRoot.get(1);
|
||||
// CoursePromotionCommissionPending coursePromotionCommissionPending = CoursePromotionCommissionPending.builder()
|
||||
// .firstUserId(firstUserId)
|
||||
// .secondUserId(secondUserId)
|
||||
// .courseId(courseId)
|
||||
// .name(courseOrder.getName())
|
||||
// .type(courseOrder.getType())
|
||||
// .image(courseOrder.getImage())
|
||||
// .orderId(courseOrder.getId())
|
||||
// .userId(userId)
|
||||
// .firstRate(rateMap.get("first"))
|
||||
// .secondRate(rateMap.get("second"))
|
||||
// .firstReward(courseOrder.getTotalAmount().multiply(rateMap.get("first")))
|
||||
// .secondReward(courseOrder.getTotalAmount().multiply(rateMap.get("second")))
|
||||
// .totalAmount(courseOrder.getTotalAmount())
|
||||
// .commissionStatus(CommissionStatusEnum.PENDING.getValue())
|
||||
// .orderCreateTime(courseOrder.getCreateTime())
|
||||
// .build();
|
||||
// coursePromotionCommissionPendingService.save(coursePromotionCommissionPending);
|
||||
//
|
||||
//
|
||||
// System.out.println("---------------------------微信支付回调(结束)-------------------------------");
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 部分退款申请
|
||||
// */
|
||||
// @Override
|
||||
// public Refund refundPartPayment(String orderId, BigDecimal refundAmount) {
|
||||
// // 获取订单
|
||||
// CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
// ThrowUtils.throwIf(courseOrder == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||
// // 判断该订单是否已经退款
|
||||
// ThrowUtils.throwIf(courseOrder.getOrderStatus().equals(OrderStatusConstant.REFUNDED), ErrorCode.OPERATION_ERROR, "订单已退款");
|
||||
//
|
||||
// String orderNumber = courseOrder.getOrderNumber();
|
||||
// // 退款请求
|
||||
// CreateRequest createRequest = new CreateRequest();
|
||||
// // 商户订单号
|
||||
// createRequest.setOutTradeNo(orderNumber);
|
||||
// // 商户退款单号
|
||||
// String outRefundNo = RefundUtils.generateRefundNo();
|
||||
// createRequest.setOutRefundNo(outRefundNo);
|
||||
// // 退款结果回调
|
||||
// createRequest.setNotifyUrl(wxPayConfig.getNotifyUrl() + "/wxPay/refund/part/callback");
|
||||
// // 退款金额
|
||||
// AmountReq amountReq = new AmountReq();
|
||||
//
|
||||
// amountReq.setRefund(refundAmount.movePointRight(2).longValue());
|
||||
// amountReq.setTotal(courseOrder.getTotalAmount().movePointRight(2).longValue());
|
||||
// amountReq.setCurrency("CNY");
|
||||
// createRequest.setAmount(amountReq);
|
||||
//
|
||||
//// // 生成退款记录
|
||||
//// Course course = courseService.getById(courseOrder.getCourseId());
|
||||
//// RefundRecord refundRecord = commonService.copyProperties(course, RefundRecord.class);
|
||||
//// refundRecord.setId(null);
|
||||
//// refundRecord.setOutTradeNo(orderNumber);
|
||||
//// refundRecord.setOutRefundNo(outRefundNo);
|
||||
//// refundRecord.setTotalAmount(courseOrder.getTotalAmount().movePointRight(2));
|
||||
//// refundRecord.setRefundAmount(refundAmount.movePointRight(2));
|
||||
//// refundRecord.setUserId(courseOrder.getUserId());
|
||||
//// refundRecord.setCreateTime(null);
|
||||
//// refundRecord.setUpdateTime(null);
|
||||
//// refundRecordService.save(refundRecord);
|
||||
//
|
||||
// // 申请退款
|
||||
// System.out.println("退款请求:" + createRequest);
|
||||
// Refund refund = wxPayConfig.getRefundService().create(createRequest);
|
||||
// System.out.println("退款申请结果:" + refund);
|
||||
//
|
||||
// return refund;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 部分退款回调
|
||||
// */
|
||||
// @Override
|
||||
// public boolean refundPartCallback(RefundNotification refundNotification) {
|
||||
// System.out.println("---------------------------微信退款回调(开始)-------------------------------");
|
||||
// // 获取订单信息
|
||||
// String orderNumber = refundNotification.getOutTradeNo();
|
||||
// LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(CourseOrder::getOrderNumber, orderNumber);
|
||||
// CourseOrder courseOrder = courseOrderService.getOne(queryWrapper);
|
||||
//
|
||||
// // 修改订单状态
|
||||
// LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
// updateWrapper.eq(CourseOrder::getId, courseOrder.getId())
|
||||
// .set(CourseOrder::getOrderStatus, OrderStatusConstant.REFUNDED);
|
||||
// courseOrderService.update(updateWrapper);
|
||||
//
|
||||
// // 修改课程下单人数
|
||||
// Long courseId = courseOrder.getCourseId();
|
||||
// Course course = courseService.getById(courseId);
|
||||
// if (course != null) {
|
||||
// course.setOrderCount(course.getOrderCount() - 1);
|
||||
// courseService.updateById(course);
|
||||
// }
|
||||
//
|
||||
// // 更新主管和员工的绩效记录
|
||||
// Long userId = courseOrder.getUserId();
|
||||
// List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
||||
// List<Long> superUserIdList = pathToRoot.subList(1, 3);
|
||||
// List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(superUserIdList, userPerformanceSummaryService, Function.identity(), UserPerformanceSummary::getUserId);
|
||||
// BigDecimal rate;
|
||||
// LambdaQueryWrapper<CoursePromotionCommissionPending> coursePromotionQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// coursePromotionQueryWrapper.eq(CoursePromotionCommissionPending::getOrderId, courseOrder.getId());
|
||||
// CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getOne(coursePromotionQueryWrapper);
|
||||
// for (int i = 0; i < userPerformanceSummaryList.size(); i ++ ) {
|
||||
// if (i == 0) rate = coursePromotionCommissionPending.getFirstRate();
|
||||
// else rate = coursePromotionCommissionPending.getSecondRate();
|
||||
// // 计算理论上获得的最大提成奖励
|
||||
// BigDecimal rakeRewards = courseOrder.getTotalAmount().multiply(rate);
|
||||
// UserPerformanceSummary userPerformanceSummary = userPerformanceSummaryList.get(i);
|
||||
//
|
||||
// userPerformanceSummary.setTotalAmount(userPerformanceSummary.getTotalAmount().subtract(courseOrder.getTotalAmount()));
|
||||
// userPerformanceSummary.setNetAmount(userPerformanceSummary.getNetAmount().subtract(courseOrder.getTotalAmount().multiply(SystemConstant.FEE_RATE)));
|
||||
// userPerformanceSummary.setToRelease(userPerformanceSummary.getToRelease().subtract(rakeRewards.multiply(SystemConstant.REFUND_RATE)));
|
||||
// userPerformanceSummary.setRefunded(userPerformanceSummary.getRefunded().add(courseOrder.getTotalAmount().multiply(SystemConstant.REFUND_RATE)));
|
||||
// }
|
||||
// userPerformanceSummaryService.updateBatchById(userPerformanceSummaryList);
|
||||
//
|
||||
// // 修改课程推广待提成状态为"已失效"
|
||||
// LambdaUpdateWrapper<CoursePromotionCommissionPending> coursePromotionUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
// coursePromotionUpdateWrapper.eq(CoursePromotionCommissionPending::getOrderId, courseOrder.getId())
|
||||
// .set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.EXPIRED.getValue());
|
||||
// coursePromotionCommissionPendingService.update(coursePromotionUpdateWrapper);
|
||||
//
|
||||
// System.out.println("---------------------------微信退款回调(结束)-------------------------------");
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取支付回调信息
|
||||
// */
|
||||
// @Override
|
||||
// public Transaction getTransactionInfo(HttpServletRequest request) {
|
||||
// NotificationParser notificationParser = getNotificationParser(request);
|
||||
// return notificationParser.parse(requestParam, Transaction.class);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取退款回调信息
|
||||
// */
|
||||
// @Override
|
||||
// public RefundNotification getRefundInfo(HttpServletRequest request) {
|
||||
// NotificationParser notificationParser = getNotificationParser(request);
|
||||
// return notificationParser.parse(requestParam, RefundNotification.class);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 根据微信官方发送的请求获取信息
|
||||
// */
|
||||
// @SneakyThrows
|
||||
// public NotificationParser getNotificationParser(HttpServletRequest request) {
|
||||
// System.out.println("---------------------------获取信息-------------------------------");
|
||||
// // 获取RSA配置
|
||||
// NotificationParser notificationParser = new NotificationParser(wxPayConfig.getRSAConfig());
|
||||
// // 构建请求
|
||||
// StringBuilder bodyBuilder = new StringBuilder();
|
||||
// BufferedReader reader = request.getReader();
|
||||
// String line;
|
||||
// while ((line = reader.readLine()) != null) {
|
||||
// bodyBuilder.append(line);
|
||||
// }
|
||||
// String body = bodyBuilder.toString();
|
||||
// String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||
// String nonce = request.getHeader("Wechatpay-Nonce");
|
||||
// String signature = request.getHeader("Wechatpay-Signature");
|
||||
// String singType = request.getHeader("Wechatpay-Signature-Type");
|
||||
// String wechatPayCertificateSerialNumber = request.getHeader("Wechatpay-Serial");
|
||||
// requestParam = new RequestParam.Builder()
|
||||
// .serialNumber(wechatPayCertificateSerialNumber)
|
||||
// .nonce(nonce)
|
||||
// .signature(signature)
|
||||
// .timestamp(timestamp)
|
||||
// .signType(singType)
|
||||
// .body(body)
|
||||
// .build();
|
||||
// System.out.println(requestParam.toString());
|
||||
// System.out.println("---------------------------信息获取完毕-------------------------------");
|
||||
// return notificationParser;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
@ -81,31 +81,11 @@ mybatis-plus:
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
appId: wx8711c8d4fb04fef9
|
||||
appSecret: 3ec1f19949d99f059e2ae4be62d02123
|
||||
|
||||
|
||||
|
||||
|
||||
@ -74,28 +74,8 @@ mybatis-plus:
|
||||
|
||||
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
|
||||
appId: wx8711c8d4fb04fef9
|
||||
appSecret: 3ec1f19949d99f059e2ae4be62d02123
|
||||
|
||||
|
||||
|
||||
|
||||
107
src/main/resources/application-graduation.yml
Normal file
107
src/main/resources/application-graduation.yml
Normal file
@ -0,0 +1,107 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://160.202.242.36:3306/qingcheng_graduation?serverTimezone=Asia/Shanghai
|
||||
username: qingcheng
|
||||
password: Qc@8ls2jf
|
||||
hikari:
|
||||
maximum-pool-size: 300
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
rabbitmq:
|
||||
host: 160.202.242.36
|
||||
port: 5672
|
||||
username: qingcheng
|
||||
password: cksys6509
|
||||
virtual-host: vhost-graduation
|
||||
listener:
|
||||
simple:
|
||||
prefetch: 1
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
host: 160.202.242.36
|
||||
database: 6
|
||||
password: Cksys6509
|
||||
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
|
||||
|
||||
# 文件上传和下载地址
|
||||
file:
|
||||
upload-dir: /www/wwwroot/fileUpload_qc/
|
||||
# upload-dir: D:/qingcheng/image/
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
default-flat-param-object: true
|
||||
|
||||
#线程池配置
|
||||
threadpool:
|
||||
corePoolSize: 10
|
||||
maxPoolSize: 50
|
||||
queueCapacity: 1024
|
||||
keepAliveTime: 60
|
||||
|
||||
|
||||
server:
|
||||
port: 9099
|
||||
|
||||
|
||||
|
||||
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: wx8711c8d4fb04fef9
|
||||
appSecret: 3ec1f19949d99f059e2ae4be62d02123
|
||||
#
|
||||
# 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
|
||||
@ -63,32 +63,11 @@ mybatis-plus:
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
appId: wx8711c8d4fb04fef9
|
||||
appSecret: 3ec1f19949d99f059e2ae4be62d02123
|
||||
|
||||
|
||||
knife4j:
|
||||
|
||||
112
src/main/resources/application-prod.yml
Normal file
112
src/main/resources/application-prod.yml
Normal file
@ -0,0 +1,112 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://160.202.242.36:3306/qingcheng_test?serverTimezone=Asia/Shanghai
|
||||
username: qingcheng
|
||||
password: Qc@8ls2jf
|
||||
hikari:
|
||||
maximum-pool-size: 300
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
rabbitmq:
|
||||
host: 160.202.242.36
|
||||
port: 5672
|
||||
username: qingcheng
|
||||
password: cksys6509
|
||||
virtual-host: vhost-test
|
||||
listener:
|
||||
simple:
|
||||
prefetch: 1
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
host: 160.202.242.36
|
||||
database: 8
|
||||
password: Cksys6509
|
||||
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
|
||||
|
||||
# 文件上传和下载地址
|
||||
file:
|
||||
upload-dir: /www/wwwroot/fileUpload_qc/
|
||||
# upload-dir: D:/qingcheng/image/
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
default-flat-param-object: true
|
||||
|
||||
#线程池配置
|
||||
threadpool:
|
||||
corePoolSize: 10
|
||||
maxPoolSize: 50
|
||||
queueCapacity: 1024
|
||||
keepAliveTime: 60
|
||||
|
||||
|
||||
server:
|
||||
port: 9095
|
||||
ssl:
|
||||
key-store: classpath:static/www.chenxinzhi.top.jks
|
||||
key-store-password: 3fqodotz
|
||||
key-store-type: JKS
|
||||
|
||||
|
||||
|
||||
|
||||
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: wx8711c8d4fb04fef9
|
||||
appSecret: 3ec1f19949d99f059e2ae4be62d02123
|
||||
#
|
||||
# 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
|
||||
@ -77,28 +77,28 @@ mybatis-plus:
|
||||
|
||||
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
|
||||
appId: wx8711c8d4fb04fef9
|
||||
appSecret: 3ec1f19949d99f059e2ae4be62d02123
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: test
|
||||
active: graduation
|
||||
|
||||
|
||||
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
$libDir = "D:\青橙\backend\src\main\resources\lib" # 使用绝对路径指定 lib 目录
|
||||
$repositoryDir = "D:\software\Maven\maven-repository" # 设置自定义仓库目录
|
||||
|
||||
# 遍历 lib 目录下的所有 JAR 文件并安装到指定的仓库
|
||||
Get-ChildItem -Path $libDir -Filter "*.jar" | ForEach-Object {
|
||||
mvn install:install-file -Dfile=$_.FullName `
|
||||
-DgroupId=com.example `
|
||||
-DartifactId=$($_.BaseName) `
|
||||
-Dversion=1.0 `
|
||||
-Dpackaging=jar `
|
||||
-DlocalRepositoryPath=$repositoryDir
|
||||
}
|
||||
BIN
src/main/resources/static/www.chenxinzhi.top.jks
Normal file
BIN
src/main/resources/static/www.chenxinzhi.top.jks
Normal file
Binary file not shown.
Reference in New Issue
Block a user