修改了晋升申请的接口
This commit is contained in:
@ -7,8 +7,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
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.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
import com.greenorange.promotion.model.dto.advancementApply.*;
|
||||
@ -65,15 +67,14 @@ public class AdvancementApplyController {
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序端用户申请晋升", description = "参数:晋升申请添加请求体,权限:管理员,方法名:addAdvancementApply")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序端用户申请晋升")
|
||||
public BaseResponse<String> addAdvancementApply(@Valid @RequestBody AdvancementApplyAddRequest advancementApplyAddRequest) {
|
||||
public BaseResponse<Long> addAdvancementApply(@Valid @RequestBody AdvancementApplyAddRequest advancementApplyAddRequest) {
|
||||
String phone = advancementApplyAddRequest.getPhone();
|
||||
String verificationCode = advancementApplyAddRequest.getVerificationCode();
|
||||
// 校验用户手机号和验证码
|
||||
userInfoService.checkPhoneAndVerificationCode(phone, verificationCode, UserRoleEnum.STAFF);
|
||||
AdvancementApply advancementApply = commonService.copyProperties(advancementApplyAddRequest, AdvancementApply.class);
|
||||
advancementApply.setCredential(UUID.randomUUID().toString());
|
||||
advancementApplyService.save(advancementApply);
|
||||
return ResultUtils.success(advancementApply.getCredential());
|
||||
return ResultUtils.success(advancementApply.getId());
|
||||
}
|
||||
|
||||
|
||||
@ -114,18 +115,18 @@ public class AdvancementApplyController {
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据凭证(credential)查询晋升申请记录
|
||||
* 小程序端用户根据身份证号查询晋升申请记录
|
||||
* @param commonStringRequest 查询凭证
|
||||
* @return 晋升申请记录信息
|
||||
*/
|
||||
@PostMapping("query/credential")
|
||||
@Operation(summary = "小程序端用户根据凭证(credential)查询晋升申请记录", description = "参数:晋升申请更新请求体,权限:管理员,方法名:queryAdvancementApplyByCredential")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序端用户根据凭证(credential)查询晋升申请记录")
|
||||
@Operation(summary = "小程序端用户根据身份证号查询晋升申请记录", description = "参数:晋升申请更新请求体,权限:管理员,方法名:queryAdvancementApplyByCredential")
|
||||
public BaseResponse<AdvancementApplyApproveVO> queryAdvancementApplyByCredential(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String credential = commonStringRequest.getTemplateString();
|
||||
String idCard = commonStringRequest.getTemplateString();
|
||||
LambdaQueryWrapper<AdvancementApply> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(AdvancementApply::getCredential, credential);
|
||||
lambdaQueryWrapper.eq(AdvancementApply::getIdCard, idCard);
|
||||
AdvancementApply advancementApply = advancementApplyService.getOne(lambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(advancementApply == null, ErrorCode.OPERATION_ERROR, "未找到该申请记录");
|
||||
AdvancementApplyApproveVO advancementApplyApproveVO = commonService.copyProperties(advancementApply, AdvancementApplyApproveVO.class);
|
||||
String reviewStatus = advancementApply.getReviewStatus();
|
||||
ReviewStatusEnum reviewStatusEnum = ReviewStatusEnum.getEnumByValue(reviewStatus);
|
||||
@ -229,7 +230,7 @@ public class AdvancementApplyController {
|
||||
@Operation(summary = "Web端管理员查询主管信息列表", description = "参数:无,权限:管理员,方法名:listSupervisorUserInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "Web端管理员分页查询晋升申请")
|
||||
public BaseResponse<List<SupervisorUserInfoVO>> listSupervisorUserInfo(@Valid @RequestBody AdvancementApplyQueryRequest advancementApplyQueryRequest) {
|
||||
public BaseResponse<List<SupervisorUserInfoVO>> listSupervisorUserInfo() {
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.SUPERVISOR_ROLE, userInfoService);
|
||||
List<SupervisorUserInfoVO> supervisorUserInfoVOS = commonService.convertList(userInfoList, SupervisorUserInfoVO.class);
|
||||
return ResultUtils.success(supervisorUserInfoVOS);
|
||||
|
@ -253,12 +253,21 @@ public class UserPerformanceSummaryController {
|
||||
public BaseResponse<Page<SupervisorPerformanceSummaryVO>> listSupervisorPerformanceSummaryRankingsByPage(@Valid @RequestBody UserPerformanceSummaryRankQueryRequest userPerformanceSummaryRankQueryRequest) {
|
||||
String startTimeStr = userPerformanceSummaryRankQueryRequest.getStartDate();
|
||||
String endTimeStr = userPerformanceSummaryRankQueryRequest.getEndDate();
|
||||
DateTime startDate = DateUtil.parse(startTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
DateTime endDate = DateUtil.parse(endTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
DateTime startDate = null;
|
||||
DateTime endDate = null;
|
||||
boolean isAddDate = true;
|
||||
try {
|
||||
startDate = DateUtil.parse(startTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
endDate = DateUtil.parse(endTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
} catch (Exception e) {
|
||||
isAddDate = false;
|
||||
}
|
||||
|
||||
QueryWrapper<EmployeePromotionRecords> empQueryWrapper = new QueryWrapper<>();
|
||||
if (isAddDate) {
|
||||
empQueryWrapper.ge(StringUtils.isNotBlank(startTimeStr), "createTime", startDate);
|
||||
empQueryWrapper.le(StringUtils.isNotBlank(endTimeStr), "createTime", endDate);
|
||||
}
|
||||
List<EmployeePromotionRecords> employeePromotionRecordsList = employeePromotionRecordsService.list(empQueryWrapper);
|
||||
// 封装Map集合(键:主管id, 值:推广数量)
|
||||
Map<Long, Integer> supervisorCntMap = new HashMap<>();
|
||||
@ -291,7 +300,7 @@ public class UserPerformanceSummaryController {
|
||||
}
|
||||
supervisorNetSalesAmountMap.merge(firstUserId, totalAmount, BigDecimal::add);
|
||||
}
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserRoleEnum.SUPERVISOR, userInfoService);
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.SUPERVISOR_ROLE, userInfoService);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(userInfoList, userPerformanceSummaryService, UserInfo::getId, UserPerformanceSummary::getUserId);
|
||||
|
||||
// 封装Map集合(键:主管id, 用户信息)
|
||||
@ -333,12 +342,20 @@ public class UserPerformanceSummaryController {
|
||||
public BaseResponse<Page<SupervisorPerformanceSummaryVO>> listStaffUserPerformanceSummaryRankingsByPage(@Valid @RequestBody UserPerformanceSummaryRankQueryRequest userPerformanceSummaryRankQueryRequest) {
|
||||
String startTimeStr = userPerformanceSummaryRankQueryRequest.getStartDate();
|
||||
String endTimeStr = userPerformanceSummaryRankQueryRequest.getEndDate();
|
||||
DateTime startDate = DateUtil.parse(startTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
DateTime endDate = DateUtil.parse(endTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
DateTime startDate = null;
|
||||
DateTime endDate = null;
|
||||
boolean isAddDate = true;
|
||||
try {
|
||||
startDate = DateUtil.parse(startTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
endDate = DateUtil.parse(endTimeStr, "yyyy-MM-dd HH:mm:ss");
|
||||
} catch (Exception e) {
|
||||
isAddDate = false;
|
||||
}
|
||||
QueryWrapper<EmployeePromotionRecords> empQueryWrapper = new QueryWrapper<>();
|
||||
if (isAddDate) {
|
||||
empQueryWrapper.ge(StringUtils.isNotBlank(startTimeStr), "createTime", startDate);
|
||||
empQueryWrapper.le(StringUtils.isNotBlank(endTimeStr), "createTime", endDate);
|
||||
}
|
||||
List<EmployeePromotionRecords> employeePromotionRecordsList = employeePromotionRecordsService.list(empQueryWrapper);
|
||||
// 封装Map集合(键:员工id, 值:推广数量)
|
||||
Map<Long, Integer> staffCntMap = new HashMap<>();
|
||||
@ -371,7 +388,7 @@ public class UserPerformanceSummaryController {
|
||||
}
|
||||
staffNetSalesAmountMap.merge(secondUserId, totalAmount, BigDecimal::add);
|
||||
}
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserRoleEnum.STAFF, userInfoService);
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.STAFF_ROLE, userInfoService);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(userInfoList, userPerformanceSummaryService, UserInfo::getId, UserPerformanceSummary::getUserId);
|
||||
|
||||
// 封装Map集合(键:主管id, 用户信息)
|
||||
@ -686,7 +703,7 @@ public class UserPerformanceSummaryController {
|
||||
}
|
||||
supervisorNetSalesAmountMap.merge(firstUserId, totalAmount, BigDecimal::add);
|
||||
}
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserRoleEnum.SUPERVISOR, userInfoService);
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.SUPERVISOR_ROLE, userInfoService);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(userInfoList, userPerformanceSummaryService, UserInfo::getId, UserPerformanceSummary::getUserId);
|
||||
|
||||
// 封装Map集合(键:主管id, 用户信息)
|
||||
@ -765,7 +782,7 @@ public class UserPerformanceSummaryController {
|
||||
}
|
||||
staffNetSalesAmountMap.merge(secondUserId, totalAmount, BigDecimal::add);
|
||||
}
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserRoleEnum.STAFF, userInfoService);
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.STAFF_ROLE, userInfoService);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(userInfoList, userPerformanceSummaryService, UserInfo::getId, UserPerformanceSummary::getUserId);
|
||||
|
||||
// 封装Map集合(键:主管id, 用户信息)
|
||||
|
@ -40,6 +40,13 @@ public class AdvancementApplyAddRequest implements Serializable {
|
||||
@Schema(description = "验证码", example = "666999")
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@NotBlank(message = "身份证号不能为空")
|
||||
@Schema(description = "身份证号", example = "320123199901010001")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 简历(view值)
|
||||
*/
|
||||
|
@ -37,9 +37,9 @@ public class AdvancementApply implements Serializable {
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 查询凭证
|
||||
* 身份证号
|
||||
*/
|
||||
private String credential;
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
|
@ -41,10 +41,10 @@ public class AdvancementApplyVO implements Serializable {
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 查询凭证
|
||||
* 身份证号
|
||||
*/
|
||||
@Schema(description = "查询凭证", example = "cef281c7-578f-4cc9-aca9-f1b5f6bcacb1")
|
||||
private String credential;
|
||||
@Schema(description = "身份证号", example = "320123199901010001")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
|
Reference in New Issue
Block a user