Commit 50a3f25b by DESKTOP-3F024UL\tianming

Merge remote-tracking branch 'origin/v5.6.0' into v5.6.0

2 parents 61b22715 6dc643ec
Showing 21 changed files with 256 additions and 151 deletions
......@@ -13,7 +13,7 @@ public class DailyReportFillCheckDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("补填的日期 yyyy-MM-dd")
@ApiModelProperty("补填的月份 yyyy-MM")
private String fillDate;
@ApiModelProperty("员工手机号")
......
......@@ -30,6 +30,9 @@ public class StaffSalaryAppealSummaryDTO implements Serializable {
@ApiModelProperty("登录角色")
private Integer loginRole;
@ApiModelProperty("登录人手机号")
private String loginPhone;
@ApiModelProperty("日报完成天数")
private Integer dailyReportDays;
......
package cn.com.glsx.dj.staff.enums.perfSalary;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
/**
* 有效转介绍审核状态枚举
*/
@Getter
@AllArgsConstructor
public enum EffectiveReferralReviewStatusEnum {
NOT_SUBMITTED(0, "未提交"),
DRAFT(1, "草稿"),
SUBMITTED(2, "已提交");
/**
* 状态编码
*/
private final Integer code;
/**
* 状态描述
*/
private final String description;
/**
* 根据编码获取枚举
*
* @param code 编码
* @return 对应的枚举,找不到时返回null
*/
public static EffectiveReferralReviewStatusEnum getByCode(Integer code) {
if (code == null) {
return null;
}
for (EffectiveReferralReviewStatusEnum status : EffectiveReferralReviewStatusEnum.values()) {
if (status.getCode().equals(code)) {
return status;
}
}
return null;
}
/**
* 根据编码获取描述
*
* @param code 编码
* @return 描述,找不到时返回null
*/
public static String getDescriptionByCode(Integer code) {
EffectiveReferralReviewStatusEnum status = getByCode(code);
return status != null ? status.getDescription() : null;
}
/**
* 根据描述获取枚举
*
* @param description 描述
* @return 对应的枚举,找不到时返回null
*/
public static EffectiveReferralReviewStatusEnum getByDescription(String description) {
if (StringUtils.isBlank(description)) {
return null;
}
for (EffectiveReferralReviewStatusEnum status : EffectiveReferralReviewStatusEnum.values()) {
if (status.getDescription().equals(description)) {
return status;
}
}
return null;
}
/**
* 根据描述获取编码
*
* @param description 描述
* @return 编码,找不到时返回null
*/
public static Integer getCodeByDescription(String description) {
EffectiveReferralReviewStatusEnum status = getByDescription(description);
return status != null ? status.getCode() : null;
}
/**
* 检查编码是否有效
*
* @param code 编码
* @return 是否有效
*/
public static boolean isValid(Integer code) {
return getByCode(code) != null;
}
}
\ No newline at end of file
......@@ -98,4 +98,9 @@ public interface PerfRuleRemote {
* 申诉考勤天数
*/
RpcResponse<Boolean> effectiveReferralAppeal();
/**
* 企微通知测试
*/
RpcResponse<Boolean> qwNotifyTest();
}
package cn.com.glsx.dj.staff.remote.salaryappealapply;
import cn.com.glsx.dj.staff.dto.StaffSalaryAppealApplyRecordDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.DailyReportFillCheckDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealOrderStatDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealSummaryDTO;
import cn.com.glsx.framework.core.annotation.ApiService;
......@@ -61,5 +60,5 @@ public interface StaffSalaryAppealApplyRecordRemote {
/**
* 判断选中日期是否可补填日报
*/
RpcResponse<Boolean> isDailyReportFillAllowed(DailyReportFillCheckDTO dto);
RpcResponse<Boolean> checkTodayInT1ToT5();
}
......@@ -9,7 +9,6 @@ import cn.com.glsx.dj.staff.model.StaffMonthSalarySlip;
import cn.com.glsx.dj.staff.model.StaffMonthSalarySlipSend;
import cn.com.glsx.dj.staff.service.common.QWManager;
import cn.com.glsx.dj.staff.service.salary.StaffMonthSalarySlipService;
import cn.com.glsx.dj.staff.util.DateUtils;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.WorkWechatTextCardMessageDTO;
......@@ -28,7 +27,6 @@ import org.springframework.core.task.TaskExecutor;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.UUID;
......@@ -84,6 +82,9 @@ public class StaffMonthSalaryJob implements SimpleJob {
// 保存发送信息
try {
StaffMonthSalarySlipSend slipSend = saveSendMsg(monthSalary);
if (slipSend == null) {
return;
}
sendMessage(monthSalary, slipSend);
} catch (Exception e) {
log.error("员工:{},手机号:{} 发送企微消息异常:{}", staffBaseInfo.getStaffName(), staffBaseInfo.getStaffPhone(), e.getMessage(), e);
......@@ -103,6 +104,15 @@ public class StaffMonthSalaryJob implements SimpleJob {
}
private StaffMonthSalarySlipSend saveSendMsg(StaffMonthSalarySlip monthSalary) {
// 先判断是否已经发送过,如果存在,则不再发送
StaffMonthSalarySlipSend query = new StaffMonthSalarySlipSend();
query.setSalaryMonth(monthSalary.getSalaryMonth());
query.setStaffPhone(monthSalary.getStaffPhone());
query.setDeletedFlag("N");
List<StaffMonthSalarySlipSend> list = staffMonthSalarySlipSendMapper.select(query);
if (list != null && !list.isEmpty()) {
return null;
}
StaffMonthSalarySlipSend staffMonthSalarySlipSend = new StaffMonthSalarySlipSend();
staffMonthSalarySlipSend.setStaffName(monthSalary.getStaffName());
staffMonthSalarySlipSend.setStaffPhone(monthSalary.getStaffPhone());
......@@ -136,7 +146,6 @@ public class StaffMonthSalaryJob implements SimpleJob {
}
private String buildEntryDate(StaffMonthSalarySlip monthSalary) {
StaffMonthSalaryBaseInfo staffMonthSalaryBaseInfo = new StaffMonthSalaryBaseInfo();
staffMonthSalaryBaseInfo.setStaffPhone(monthSalary.getStaffPhone());
......
......@@ -29,6 +29,10 @@ public class PerfRuleRemoteImpl implements PerfRuleRemote {
private EffectiveReferralReviewService effectiveReferralReviewService;
@Resource
private AttendanceSummaryService attendanceSummaryService;
@Resource
private PerfQwNotificationService perfQwNotificationService;
@Resource
private EffectiveReferralReviewQwService effectiveReferralReviewQwService;
/**
......@@ -241,5 +245,18 @@ public class PerfRuleRemoteImpl implements PerfRuleRemote {
return RpcResponse.success(true);
}
/**
* 企微通知测试
*/
@Override
public RpcResponse<Boolean> qwNotifyTest() {
// perfQwNotificationService.perfQwNotification();
// effectiveReferralReviewQwService.qwManagerNotification();
// effectiveReferralReviewQwService.qwOnLineNotification();
// effectiveReferralReviewQwService.qwOnlineNotification();
// effectiveReferralReviewQwService.changeCountManagerQwNotification();
return RpcResponse.success(true);
}
}
package cn.com.glsx.dj.staff.remote.salaryappealapply;
import cn.com.glsx.dj.staff.dto.StaffSalaryAppealApplyRecordDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.DailyReportFillCheckDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealOrderStatDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealSummaryDTO;
import cn.com.glsx.dj.staff.service.StaffSalaryAppealApplyRecordService;
......@@ -134,10 +133,9 @@ public class StaffSalaryAppealApplyRecordRemoteImpl implements StaffSalaryAppeal
}
@Override
public RpcResponse<Boolean> isDailyReportFillAllowed(DailyReportFillCheckDTO dto) {
public RpcResponse<Boolean> checkTodayInT1ToT5() {
try {
log.info("isDailyReportFillAllowed start, dto:{}", dto);
Boolean result = staffSalaryAppealApplyRecordService.isDailyReportFillAllowed(dto);
Boolean result = staffSalaryAppealApplyRecordService.checkTodayInT1ToT5();
return RpcResponse.success(result);
} catch (Exception e) {
log.error(e.getMessage(),e);
......
......@@ -9,7 +9,6 @@ import cn.com.glsx.dj.staff.dto.MerchantInfo;
import cn.com.glsx.dj.staff.dto.SalaryAppealApplyAttachmentDTO;
import cn.com.glsx.dj.staff.dto.StaffSalaryAppealApplyRecordDTO;
import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.DailyReportFillCheckDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealOrderStatDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealSummaryDTO;
import cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum;
......@@ -504,17 +503,13 @@ public class StaffSalaryAppealApplyRecordService {
}
private void setAppealAvailability(StaffSalaryAppealSummaryDTO dto, StaffSalaryAppealSummaryDTO result, String appealMonth) {
if (dto.getIsSuper() != null && dto.getIsSuper() || Objects.equals(dto.getLoginRole(), 3)) {
result.setAttendanceAppealable(false);
result.setPadAppealable(false);
result.setDailyReportable(false);
return;
}
// 获取上个月月份字符串
String lastMonth = DateUtils.getLastMonthString(new Date());
// 判断appealMonth是否等于上个月
boolean isLastMonth = Objects.equals(appealMonth, lastMonth);
// 判断是否为驻店人员 (登录人和查询的人一致认为是驻店人员)
boolean isStoreStaff = Objects.equals(dto.getLoginPhone(), dto.getStaffPhone());
// 获取T3时间配置(考勤申诉周期)
PerformanceTimeCycleDTO t3Cycle =
......@@ -524,35 +519,13 @@ public class StaffSalaryAppealApplyRecordService {
Date now = new Date();
inT3Period = !now.before(t3Cycle.getStartDate()) && !now.after(t3Cycle.getEndDate());
}
// 考勤申诉:只允许在T3周期内申诉上个月的
result.setAttendanceAppealable(isLastMonth && inT3Period);
// 平板申诉:只允许在T3周期内申诉上个月的
result.setPadAppealable(isLastMonth && inT3Period);
// 考勤申诉:只允许驻店人员在T3周期内申诉上个月的
result.setAttendanceAppealable(isStoreStaff && isLastMonth && inT3Period);
// 平板申诉:只允许驻店人员在T3周期内申诉上个月的
result.setPadAppealable(isStoreStaff && isLastMonth && inT3Period);
// 获取T1-T5时间配置(补日报周期)
boolean inT1ToT5Period = false;
if (isLastMonth) {
// 检查是否在T1到T5的任意一个周期内
String[] tCodes = {
PerformanceTimeCycleCodeEnum.T1.getCode(),
PerformanceTimeCycleCodeEnum.T2.getCode(),
PerformanceTimeCycleCodeEnum.T3.getCode(),
PerformanceTimeCycleCodeEnum.T4.getCode(),
PerformanceTimeCycleCodeEnum.T5.getCode()
};
Date now = new Date();
Map<String, PerformanceTimeCycleDTO> cycleMap = performanceTimeCycleService.list().stream()
.collect(Collectors.toMap(PerformanceTimeCycleDTO::getCycleCode, Function.identity()));
for (String tCode : tCodes) {
PerformanceTimeCycleDTO cycle = cycleMap.get(tCode);
if (cycle != null && cycle.getStartDate() != null && cycle.getEndDate() != null) {
if (!now.before(cycle.getStartDate()) && !now.after(cycle.getEndDate())) {
inT1ToT5Period = true;
break;
}
}
}
}
boolean inT1ToT5Period = checkTodayInT1ToT5();
// 补日报:只允许在T1-T5周期内补上个月的日报
result.setDailyReportable(isLastMonth && inT1ToT5Period);
SimpleDateFormat sdf = new SimpleDateFormat("d");
......@@ -668,71 +641,34 @@ public class StaffSalaryAppealApplyRecordService {
}
/**
* 判断选中日期是否可补填日报
* @param dto 包含补填日期、员工信息等
* 检查今天是否在T1-T5周期内
* @return true-可以补填,false-不可以补填
*/
public Boolean isDailyReportFillAllowed(DailyReportFillCheckDTO dto) {
log.info("isDailyReportFillAllowed start, dto:{}", dto);
// 1. 校验参数
if (dto == null || dto.getFillDate() == null) {
log.error("参数不能为空");
return false;
}
// 2. 超级管理员和角色3不允许补填日报
if (dto.getIsSuper() != null && dto.getIsSuper() || Objects.equals(dto.getLoginRole(), 3)) {
log.info("超级管理员或角色3不允许补填日报");
return false;
}
try {
// 3. 解析补填日期,获取所属月份 yyyy-MM
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date fillDate = sdf.parse(dto.getFillDate());
SimpleDateFormat monthFormat = new SimpleDateFormat("yyyy-MM");
String fillMonth = monthFormat.format(fillDate);
// 4. 获取上个月月份字符串
String lastMonth = DateUtils.getLastMonthString(new Date());
// 5. 判断fillMonth是否等于上个月
boolean isLastMonth = Objects.equals(fillMonth, lastMonth);
if (!isLastMonth) {
log.info("补填日期{}不是上个月,不允许补填", dto.getFillDate());
return false;
}
// 6. 检查是否在T1到T5的任意一个周期内
String[] tCodes = {
PerformanceTimeCycleCodeEnum.T1.getCode(),
PerformanceTimeCycleCodeEnum.T2.getCode(),
PerformanceTimeCycleCodeEnum.T3.getCode(),
PerformanceTimeCycleCodeEnum.T4.getCode(),
PerformanceTimeCycleCodeEnum.T5.getCode()
};
Date now = new Date();
Map<String, PerformanceTimeCycleDTO> cycleMap = performanceTimeCycleService.list().stream()
.collect(Collectors.toMap(PerformanceTimeCycleDTO::getCycleCode, Function.identity()));
for (String tCode : tCodes) {
PerformanceTimeCycleDTO cycle = cycleMap.get(tCode);
if (cycle != null && cycle.getStartDate() != null && cycle.getEndDate() != null) {
if (!now.before(cycle.getStartDate()) && !now.after(cycle.getEndDate())) {
log.info("当前时间在{}周期内,允许补填日报", tCode);
return true;
}
public Boolean checkTodayInT1ToT5() {
// 5. 检查是否在T1到T5的任意一个周期内
String[] tCodes = {
PerformanceTimeCycleCodeEnum.T1.getCode(),
PerformanceTimeCycleCodeEnum.T2.getCode(),
PerformanceTimeCycleCodeEnum.T3.getCode(),
PerformanceTimeCycleCodeEnum.T4.getCode(),
PerformanceTimeCycleCodeEnum.T5.getCode()
};
Date now = new Date();
Map<String, PerformanceTimeCycleDTO> cycleMap = performanceTimeCycleService.list().stream()
.collect(Collectors.toMap(PerformanceTimeCycleDTO::getCycleCode, Function.identity()));
for (String tCode : tCodes) {
PerformanceTimeCycleDTO cycle = cycleMap.get(tCode);
if (cycle != null && cycle.getStartDate() != null && cycle.getEndDate() != null) {
if (!now.before(cycle.getStartDate()) && !now.after(cycle.getEndDate())) {
log.info("当前时间在{}周期内,允许补填日报", tCode);
return true;
}
}
log.info("当前时间不在T1-T5周期内,不允许补填日报");
return false;
} catch (ParseException e) {
log.error("日期格式解析异常,fillDate:{}", dto.getFillDate(), e);
return false;
}
log.info("当前时间不在T1-T5周期内,不允许补填日报");
return false;
}
}
\ No newline at end of file
......@@ -86,7 +86,7 @@ public class QWManager {
*/
public Map<String, String> getSendUserIds() {
EntmicroStaffRequest entmicroStaffRequest = new EntmicroStaffRequest();
// dev = 44209813 test = 44209813 线上 = 44202977
// dev = 44211227 test = 44209813 线上 = 44202977
Integer merchantId = OrePropertyConfigurer.getProperty("dj.send.work.wechat.merchant.id",Integer.class,44202977);
entmicroStaffRequest.setMerchantId(merchantId);
RpcResponse<List<EntmicroStaffResponse>> staffResponse = entmicroStaffRemote.findStaffByMerchantId(entmicroStaffRequest);
......
......@@ -75,6 +75,8 @@ public class AttendanceSummaryService {
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void confirmUpdateAppealAttendance(String mobilePhone, String attendanceMonth, BigDecimal appealAttendanceDays) {
// 打印入参
log.info("确认修改申诉考勤-入参:mobilePhone:{},attendanceMonth:{},appealAttendanceDays:{}", mobilePhone, attendanceMonth, appealAttendanceDays);
Example example = new Example(AttendanceSummary.class);
example.createCriteria().andEqualTo("mobilePhone", mobilePhone)
.andEqualTo("attendanceMonth", attendanceMonth).andEqualTo("deletedFlag", "N");
......
......@@ -112,7 +112,7 @@ public class AutoPerfEvaluationService {
// "itemCodes": "A036",
// "startDate": "2025-12-01",
// "endDate": "2025-12-31",
// "brandIds": "1,-2,2695,-4",
// "brandIds": "-1,-2,2695,-4",
// "exts": "staffIds",
// "dateType":2
//}
......@@ -120,8 +120,8 @@ public class AutoPerfEvaluationService {
dataBizQueryParamsDTO.setItemCodes("A036");
dataBizQueryParamsDTO.setStartDate(DateUtil.format(lastMonthFirstYMD, DatePattern.NORM_DATE_PATTERN));
dataBizQueryParamsDTO.setEndDate(DateUtil.format(lastMonthLastYMD, DatePattern.NORM_DATE_PATTERN));
// 线上 default.brand.id=1,-2,2695,-4
String brandIds = OrePropertyConfigurer.getProperty("default.brand.id", String.class, "1,-2,2695,-4");
// 线上 default.brand.id=-1,-2,2695,-4 测试环境 -1,-2,3454,-4
String brandIds = OrePropertyConfigurer.getProperty("default.brand.id", String.class, "-1,-2,2695,-4");
dataBizQueryParamsDTO.setBrandIds(brandIds);
dataBizQueryParamsDTO.setExts("staffIds");
dataBizQueryParamsDTO.setDateType(2);
......@@ -342,8 +342,8 @@ public class AutoPerfEvaluationService {
performanceEvaluation.setAutoGradeType(null);
}
performanceEvaluation.setOutputValue(staffOutValue);
performanceEvaluation.setAutoPerformanceConfigId(autoPerformRule.getId());
performanceEvaluation.setPerformanceGradeUuid(autoPerformRule.getPerformanceLevelUuid());
performanceEvaluation.setAutoPerformanceConfigId(ObjectUtil.isNotEmpty(autoPerformRule) ? autoPerformRule.getId() : null);
performanceEvaluation.setPerformanceGradeUuid(ObjectUtil.isNotEmpty(autoPerformRule) ? autoPerformRule.getPerformanceLevelUuid() : null);
performanceEvaluation.setAmountCalculationType(1);
performanceEvaluation.setCreatedBy("system");
......
......@@ -6,6 +6,7 @@ import cn.com.glsx.dj.staff.dto.perfSalary.*;
import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO;
import cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum;
import cn.com.glsx.dj.staff.enums.perfSalary.EffectiveReferralBrandTypeEnum;
import cn.com.glsx.dj.staff.enums.perfSalary.EffectiveReferralReviewStatusEnum;
import cn.com.glsx.dj.staff.enums.perfSalary.EffectiveReferralSceneEnum;
import cn.com.glsx.dj.staff.mapper.perfSalary.EffectiveReferralReviewMapper;
import cn.com.glsx.dj.staff.model.Dict;
......@@ -96,9 +97,16 @@ public class EffectiveReferralReviewMiniProgramService {
.andEqualTo("reviewMonth", item.getReviewMonth())
.andEqualTo("merchantId", item.getMerchantId());
List<EffectiveReferralReview> effectiveReferralReviews = effectiveReferralReviewMapper.selectByExample(example);
List<EffectiveReferralReview> lightModificationList = effectiveReferralReviews.stream().filter(effectiveReferralReview -> effectiveReferralReview.getSceneType() == 1).collect(Collectors.toList());
List<EffectiveReferralReview> interestList = effectiveReferralReviews.stream().filter(effectiveReferralReview -> effectiveReferralReview.getSceneType() == 2).collect(Collectors.toList());
List<EffectiveReferralReview> singleExtendedWarrantyList = effectiveReferralReviews.stream().filter(effectiveReferralReview -> effectiveReferralReview.getSceneType() == 3).collect(Collectors.toList());
//获取不同业务场景Map
Map<Byte, List<EffectiveReferralReview>> effectiveReferralReviewsMap = effectiveReferralReviews.stream()
.filter(e -> e.getSceneType() != null)
.collect(Collectors.groupingBy(EffectiveReferralReview::getSceneType));
//轻改
List<EffectiveReferralReview> lightModificationList = effectiveReferralReviewsMap.get(EffectiveReferralSceneEnum.PREMIUM_UPGRADE.getCode());
//会员权益
List<EffectiveReferralReview> interestList = effectiveReferralReviewsMap.get(EffectiveReferralSceneEnum.MEMBER_RIGHTS.getCode());
//单延保
List<EffectiveReferralReview> singleExtendedWarrantyList = effectiveReferralReviewsMap.get(EffectiveReferralSceneEnum.SINGLE_EXTENDED_WARRANTY.getCode());
if (CollectionUtils.isNotEmpty(lightModificationList)) {
item.setLightModificationSubmitStatus(lightModificationList.get(0).getStatus());
}
......@@ -111,15 +119,13 @@ public class EffectiveReferralReviewMiniProgramService {
//当前时间年月是否比核查时间晚并超过1个月,或者当前时间不在T1时间配置内,则不可编辑
long monthDiff = getMonthDiff(effectiveReferralReviews.get(0).getReviewMonth());
if ((Objects.nonNull(performanceTimeCycleDTO)
item.setUpdateFlag(1);
if (Objects.nonNull(performanceTimeCycleDTO)
&& performanceTimeCycleDTO.getStartDate() != null
&& performanceTimeCycleDTO.getEndDate() != null
&& new Date().after(performanceTimeCycleDTO.getEndDate()))
|| monthDiff > 1) {
item.setUpdateFlag(0);
}
else {
item.setUpdateFlag(1);
&& performanceTimeCycleDTO.getEndDate() != null) {
if (new Date().after(performanceTimeCycleDTO.getEndDate()) || monthDiff > 1) {
item.setUpdateFlag(0);
}
}
});
}
......@@ -148,15 +154,13 @@ public class EffectiveReferralReviewMiniProgramService {
//6、封装返回参数
StoreEffectiveReferralDetailDTO detailDTO = new StoreEffectiveReferralDetailDTO();
if ((Objects.nonNull(performanceTimeCycleDTO)
detailDTO.setUpdateFlag(1);
if (Objects.nonNull(performanceTimeCycleDTO)
&& performanceTimeCycleDTO.getStartDate() != null
&& performanceTimeCycleDTO.getEndDate() != null
&& new Date().after(performanceTimeCycleDTO.getEndDate()))
|| monthDiff > 1) {
detailDTO.setUpdateFlag(0);
}
else {
detailDTO.setUpdateFlag(1);
&& performanceTimeCycleDTO.getEndDate() != null) {
if (new Date().after(performanceTimeCycleDTO.getEndDate()) || monthDiff > 1) {
detailDTO.setUpdateFlag(0);
}
}
detailDTO.setMerchantName(referralReviewCommonDTOS.get(0).getMerchantName());
detailDTO.setSceneTypeEffectiveReferrals(sceneTypeEffectiveReferrals);
......@@ -292,6 +296,7 @@ public class EffectiveReferralReviewMiniProgramService {
updateEffectiveReferralInfo(dto, referralReviewCommonDTOSMap, sendMessageFlag);
//4、异步发送企微
log.info("effectiveReferralStoreSubmit-sendMessageFlag:{},referralReviewCommonDTO:{}", sendMessageFlag,JSON.toJSONString(referralReviewCommonDTOS.get(0)));
sendMessageAsync(sendMessageFlag, referralReviewCommonDTOS.get(0));
return true;
}
......@@ -320,7 +325,9 @@ public class EffectiveReferralReviewMiniProgramService {
&& !item.getEffectiveReferralCount().equals(referralReviewCommonDTOSMap.get(item.getId()).getTotalDeliveryCount())) {
review.setIsNeedReviewed(1);
review.setIsReviewed(0);
sendMessageFlag.set(true);
if (Objects.equals(EffectiveReferralReviewStatusEnum.SUBMITTED.getCode(),dto.getStatus())) {
sendMessageFlag.set(true);
}
}
else {
review.setIsNeedReviewed(0);
......
......@@ -56,11 +56,13 @@ public class EffectiveReferralReviewQwService {
DateTime lastMonthDate = DateUtil.offsetMonth(new Date(), -1);
String lastMonth = DateUtil.format(lastMonthDate, DatePattern.NORM_MONTH_PATTERN);
List<String> mobilePhoneList = effectiveReferralReviewMapper.queryQwSendMobilePhoneList(lastMonth);
log.info("通知区域经理-mobilePhoneList:{}", mobilePhoneList);
if (CollUtil.isEmpty(mobilePhoneList)) {
log.info("没有未处理有效引荐数对应的区域运营手机号");
return;
}
Map<String, String> sendUserIds = qWManager.getSendUserIds();
log.info("sendUserIds:{}", sendUserIds);
String joinedUserIds = qWManager.getJoinedUserIds(sendUserIds, mobilePhoneList);
log.info("发送给的企微用户id:{}", joinedUserIds);
if (StrUtil.isBlank(joinedUserIds)) {
......@@ -120,11 +122,13 @@ public class EffectiveReferralReviewQwService {
String lastMonth = DateUtil.format(lastMonthDate, DatePattern.NORM_MONTH_PATTERN);
// 查询是否有需要待复核的数据
List<String> mobilePhoneList = effectiveReferralReviewMapper.queryOnlineNoHandlerQwSendMobilePhone(lastMonth, null, null);
log.info("通知总部运营-mobilePhoneList:{}", mobilePhoneList);
if (CollUtil.isEmpty(mobilePhoneList)) {
log.info("没有未处理有效引荐数对应的区域运营手机号");
return;
}
Map<String, String> sendUserIds = qWManager.getSendUserIds();
log.info("sendUserIds:{}", sendUserIds);
String joinedUserIds = qWManager.getJoinedUserIds(sendUserIds, mobilePhoneList);
log.info("发送给的企微用户id:{}", joinedUserIds);
if (StrUtil.isBlank(joinedUserIds)) {
......@@ -169,14 +173,17 @@ public class EffectiveReferralReviewQwService {
* @param sceneType 1-精品升级(轻改);2-会员权益(广联权益);3-单延保
*/
public void qwOnlineNotification(String reviewMonth, Integer changedMerchantId, byte sceneType) {
log.info("调用参数:reviewMonth:{} , changedMerchantId:{}, sceneType:{}", reviewMonth, changedMerchantId, sceneType);
PerformanceTimeCycleDTO performanceTimeCycleDTO = performanceTimeCycleMapper.selectByCode(PerformanceTimeCycleCodeEnum.T1.getCode());
Date endDate = performanceTimeCycleDTO.getEndDate();
List<String> mobilePhoneList = effectiveReferralReviewMapper.queryOnlineNoHandlerQwSendMobilePhone(reviewMonth, changedMerchantId, sceneType);
log.info("通知线上运营-mobilePhoneList:{}", mobilePhoneList);
if (CollUtil.isEmpty(mobilePhoneList)) {
log.info("没有未处理有效引荐数对应的区域运营手机号");
log.info("没有未处理有效引荐数对应的线上运营手机号");
return;
}
Map<String, String> sendUserIds = qWManager.getSendUserIds();
log.info("sendUserIds:{}", sendUserIds);
String joinedUserIds = qWManager.getJoinedUserIds(sendUserIds, mobilePhoneList);
log.info("发送给的企微用户id:{}", joinedUserIds);
if (StrUtil.isBlank(joinedUserIds)) {
......@@ -219,12 +226,14 @@ public class EffectiveReferralReviewQwService {
* @param mobilePhone 需要通知的区域运营手机号
*/
public void changeCountManagerQwNotification(String changedMerchantName, String mobilePhone) {
log.info("调用参数:changedMerchantName:{} , mobilePhone:{}", changedMerchantName, mobilePhone);
List<String> mobilePhoneList = StrUtil.split(mobilePhone, ",");
if (CollUtil.isEmpty(mobilePhoneList)) {
log.info("没有未处理有效引荐数对应的区域运营手机号");
return;
}
Map<String, String> sendUserIds = qWManager.getSendUserIds();
log.info("sendUserIds:{}", sendUserIds);
String joinedUserIds = qWManager.getJoinedUserIds(sendUserIds, mobilePhoneList);
log.info("发送给的企微用户id:{}", joinedUserIds);
if (StrUtil.isBlank(joinedUserIds)) {
......
......@@ -122,13 +122,13 @@ public class EffectiveReferralReviewService {
//4、填充复核状态,待复核状态下的数据,如果当前时间大于T1时间配置内的结束时间,置为已失效
for (EffectiveReferralReviewCommonDTO item : list) {
if ((Objects.nonNull(performanceTimeCycleDTO)
if (Objects.nonNull(performanceTimeCycleDTO)
&& performanceTimeCycleDTO.getStartDate() != null
&& performanceTimeCycleDTO.getEndDate() != null
&& item.getIsReviewed().equals(0)
&& new Date().after(performanceTimeCycleDTO.getEndDate()))
|| (item.getIsReviewed().equals(0) && monthDiff > 1)) {
item.setIsReviewed(2);
&& item.getIsReviewed().equals(0)) {
if (new Date().after(performanceTimeCycleDTO.getEndDate()) || monthDiff > 1) {
item.setIsReviewed(2);
}
}
}
......@@ -173,13 +173,13 @@ public class EffectiveReferralReviewService {
//3、当前时间年月是否比核查时间晚并超过1个月, 则不可编辑
long monthDiff = getMonthDiff(reviewCommonDTO.getReviewMonth());
if ((Objects.nonNull(performanceTimeCycleDTO)
if (Objects.nonNull(performanceTimeCycleDTO)
&& performanceTimeCycleDTO.getStartDate() != null
&& performanceTimeCycleDTO.getEndDate() != null
&& reviewCommonDTO.getIsReviewed().equals(0)
&& new Date().after(performanceTimeCycleDTO.getEndDate()))
|| (reviewCommonDTO.getIsReviewed().equals(0) && monthDiff > 1)) {
reviewCommonDTO.setIsReviewed(2);
&& reviewCommonDTO.getIsReviewed().equals(0)) {
if (new Date().after(performanceTimeCycleDTO.getEndDate()) || monthDiff > 1) {
reviewCommonDTO.setIsReviewed(2);
}
}
return reviewCommonDTO;
}
......
......@@ -51,11 +51,13 @@ public class PerfQwNotificationService {
DateTime lastMonthDate = DateUtil.offsetMonth(new Date(), -1);
String lastMonth = DateUtil.format(lastMonthDate, DatePattern.NORM_MONTH_PATTERN);
List<String> mobilePhoneList = performanceEvaluationMapper.querySuperiorLeaderMobilePhoneLeader(lastMonth);
log.info("未处理绩效的员工的上级领导手机号:{}", mobilePhoneList);
if (CollUtil.isEmpty(mobilePhoneList)) {
log.info("没有未处理绩效的员工的上级领导手机号");
return;
}
Map<String, String> sendUserIds = qWManager.getSendUserIds();
log.info("sendUserIds:{}", sendUserIds);
String joinedUserIds = qWManager.getJoinedUserIds(sendUserIds, mobilePhoneList);
SendWorkWechatMessageRequestDTO requestDTO = new SendWorkWechatMessageRequestDTO();
// dev = 44209813 test = 44209813
......
......@@ -239,6 +239,8 @@ public class StaffMonthSalarySlipService {
dailyDeductCount += deduct.getBehaviorCount();
}
}
}else {
log.error("获取员工日常扣除记录失败:{}", JSON.toJSONString(resp));
}
// 获取工资绩效数据
StaffMonthSalaryDTO salary1 = performanceEvaluationMapper.queryStaffMonthSalary(info.getSalaryMonth(), info.getStaffPhone());
......
......@@ -209,14 +209,15 @@
</select>
<select id="attendanceSummary" resultType="cn.com.glsx.dj.staff.dto.perfSalary.AttendanceStaffSummaryDTO">
select sas.id as id,
sas.name as name,
sas.mobile_phone as mobilePhone,
sas.attendance_month as attendanceMonth,
sas.total_work_hours as totalWorkHours,
sas.late_early_hours as lateEarlyHours,
sas.missing_punch_count as missingPunchCount,
sas.oId_job_post as positionName
select sas.id as id,
sas.name as name,
sas.mobile_phone as mobilePhone,
sas.attendance_month as attendanceMonth,
IF(sas.appeal_attendance_days IS NOT NULL, sas.appeal_attendance_days * 8,
sas.total_work_hours) AS totalWorkHours,
sas.late_early_hours as lateEarlyHours,
sas.missing_punch_count as missingPunchCount,
sas.oId_job_post as positionName
from sal_attendance_summary sas
where sas.deleted_flag = 'N'
and sas.mobile_phone = #{mobilePhone}
......
......@@ -45,6 +45,7 @@
<update id="deleteLatestRuleConfig">
UPDATE sal_auto_perform_rule
SET deleted_flag = 'D'
WHERE effective_status != 1
ORDER BY created_date DESC
LIMIT 1
</update>
......
......@@ -111,7 +111,9 @@
AND serr.is_reviewed = #{isReviewed}
</if>
<if test="isReviewed != null and isReviewed == 2 and cycleStartDate != null and cycleEndDate != null">
AND serr.is_reviewed = 0 AND (now() &lt; #{cycleStartDate} OR now() &gt; #{cycleEndDate})
AND serr.is_reviewed = 0
AND ((now() &lt; #{cycleStartDate} OR now() &gt; #{cycleEndDate})
OR PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), REPLACE(serr.review_month, '-', '')) &gt; 1)
</if>
<if test="isReviewed != null and isReviewed == 2 and cycleStartDate == null and cycleEndDate == null">
AND serr.is_reviewed = #{isReviewed}
......
......@@ -4,7 +4,9 @@ import cn.com.glsx.dj.sale.service.BaseServiceTest;
import cn.com.glsx.dj.staff.dto.salary.StaffMonthSalarySlipSendDTO;
import cn.com.glsx.dj.staff.dto.salary.StaffSalaryDetailDTO;
import cn.com.glsx.dj.staff.dto.salary.StaffSalaryDetailRequestDTO;
import cn.com.glsx.dj.staff.mapper.StaffMonthSalarySlipSendMapper;
import cn.com.glsx.dj.staff.model.StaffMonthSalarySlip;
import cn.com.glsx.dj.staff.model.StaffMonthSalarySlipSend;
import cn.com.glsx.dj.staff.service.common.QWManager;
import cn.com.glsx.dj.staff.service.salary.StaffMonthSalarySlipService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
......@@ -19,6 +21,8 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import java.util.List;
@Slf4j
public class StaffMonthSalaryServiceTest extends BaseServiceTest {
......@@ -28,6 +32,9 @@ public class StaffMonthSalaryServiceTest extends BaseServiceTest {
private Environment env;
@Autowired
private QWManager qwManager;
@Autowired
private StaffMonthSalarySlipSendMapper staffMonthSalarySlipSendMapper;
@Test
public void testStatStaffMonthSalary() {
......@@ -40,6 +47,16 @@ public class StaffMonthSalaryServiceTest extends BaseServiceTest {
@Test
public void testSendMessage() {
// 先判断是否已经发送过,如果存在,则不再发送
StaffMonthSalarySlipSend query = new StaffMonthSalarySlipSend();
query.setSalaryMonth("2025-12");
query.setStaffPhone("18925261040");
query.setDeletedFlag("N");
List<StaffMonthSalarySlipSend> list = staffMonthSalarySlipSendMapper.select(query);
if (list != null && !list.isEmpty()){
log.info("员工:{},手机号:{} 已经发送过,请勿重复发送", "张三", "18925261040");
return;
}
Integer merchantId = 44210895;
// 发送自建应用消息对应(wechat-build-server)配置门店号
Integer sendConfigMerchantId = 442108951;
......
  • @wangxw1
    commented
    Master

    你好。我是资深软件开发工程师,很高兴为你进行代码审查。本次提交涉及提成计算核心逻辑的调整,并补充了详尽的设计文档。以下是针对本次代码变更的审查意见:

    一、关键问题与优化建议

    • 问题 1:潜在的 NullPointerException (NPE) 风险(功能正确性与健壮性)

      • 问题描述:在 StaffPerformanceCalService.java 第 540 行左右,代码删除了对 detailDTO.getCommissionTypeValue() 的判空逻辑,直接进行 multiply 运算。
      • 影响分析:如果数据库配置中该比例值(CommissionTypeValue)由于误操作或历史原因缺失(为 null),该计算逻辑在运行时会直接抛出 NullPointerException,导致整个员工绩效计算任务中断。
      • 优化建议:保留判空逻辑,或在计算前通过 Optional 提供默认值(如 BigDecimal.ZERO),确保系统的健壮性。 java // 优化建议示例 BigDecimal value = detailDTO.getCommissionTypeValue(); if (value != null) { commission = detailDTO.getGmvOutput().multiply(value); } else { log.warn("佣金比例配置为空,跳过计算: {}", detailDTO.getStaffPhone()); commission = BigDecimal.ZERO; }
    • 问题 2:集合操作未进行安全检查(安全性与潜在风险)

      • 问题描述:在 StaffPerformanceDetailService.java 中,代码直接调用 performanceDetailDTOS.get(0) 来获取 staffPhone 和 merchantId 等信息,用于逻辑删除旧数据。
      • 影响分析:如果上层逻辑传入的 performanceDetailDTOS 为空列表(Empty List),此处会触发 IndexOutOfBoundsException。此外,依赖列表首个元素来决定删除范围的逻辑在多线程或批量操作场景下存在一定风险。
      • 优化建议:在调用 get(0) 前必须进行 CollectionUtils.isNotEmpty() 校验。同时,建议确保传入的列表中所有元素的关键维度(月份、商户等)是一致的,防止误删。
    • 问题 3:硬编码业务逻辑且缺乏注释(最佳实践与可维护性)

      • 问题描述:在 StaffProductPerformanceService.java 中,Stream 过滤条件新增了 !Objects.equals(o.getCommissionType(), CommissionTypeEnum.XS.getCode())。
      • 影响分析:代码中直接排除了 XS(销售提成)类型的数据,但未通过注释说明业务原因。对于后续维护者来说,难以理解为何在该统计维度下需要剔除销售提成。
      • 优化建议:在过滤逻辑上方增加简要注释,说明业务背景(例如:“品类绩效汇总需排除纯销售类提成”),提高代码的可读性。

    二、评分明细

    • 功能实现的正确性与健壮性(32/40分):逻辑调整符合业务需求,但删除了必要的防御性判空,且存在集合越界隐患。
    • 安全性与潜在风险(26/30分):SQL 层面增加了 deleted_flag 过滤,安全性有所提升;但代码层面的异常处理不够严谨,可能影响服务稳定性。
    • 最佳实践与可维护性(18/20分):非常出色地补充了技术设计文档(Markdown),极大降低了后期维护成本。代码命名规范,结构清晰。
    • 性能与资源利用(5/5分):使用 Stream 流进行高效过滤与分组,性能表现良好。
    • 提交信息质量(4/5分):Commit 信息“提成计算相关-问题修复”基本准确,但若能更具体地描述修复了哪个环节的问题会更好。

    三、总分

    总分:85分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!