Commit ccb0a5f9 by 张富康

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

2 parents f24ceabf 13e72158
......@@ -27,4 +27,7 @@ public class EffectiveReferralCountDTO implements Serializable {
@ApiModelProperty(value = "有效引荐数")
@NotNull(message = "有效引荐数不能为空")
private Integer effectiveReferralCount;
@ApiModelProperty(value = "复核有效引荐数(前端无须传)")
private Integer reviewedEffectiveCount;
}
......@@ -7,6 +7,7 @@ import lombok.experimental.Accessors;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
......@@ -53,6 +54,24 @@ public class StaffMonthBdmCount implements Serializable {
private Integer behaviorCount;
/**
* 实际售前触客数
*/
@Column(name = "shop_count")
private Integer shopCount;
/**
* 录音总数
*/
@Column(name = "recording_count")
private Integer recordingCount;
/**
* pad扣款金额配置
*/
@Column(name = "pad_deduction")
private BigDecimal padDeduction;
/**
* 是否修正(0-未修正,1-已修正)
*/
@Column(name = "modify_flag")
......
......@@ -70,6 +70,9 @@ public class StaffMonthSalaryJob implements SimpleJob {
}
for (StaffBaseInfo staffBaseInfo : staffBaseInfos) {
try {
if (StringUtils.isBlank(staffBaseInfo.getStaffName()) || StringUtils.isBlank(staffBaseInfo.getStaffPhone())) {
continue;
}
StaffMonthSalarySlip slip = new StaffMonthSalarySlip();
slip.setSalaryMonth(statMonth);
slip.setUpdatedBy(CommonConstants.DEFAULT_UPDATE_BY);
......@@ -79,8 +82,12 @@ public class StaffMonthSalaryJob implements SimpleJob {
// 发送企微消息
executor.execute(() -> {
// 保存发送信息
Integer id = saveSendMsg(monthSalary);
sendMessage(monthSalary, id);
try {
StaffMonthSalarySlipSend slipSend = saveSendMsg(monthSalary);
sendMessage(monthSalary, slipSend);
} catch (Exception e) {
log.error("员工:{},手机号:{} 发送企微消息异常:{}", staffBaseInfo.getStaffName(), staffBaseInfo.getStaffPhone(), e.getMessage(), e);
}
});
} catch (Exception e) {
......@@ -95,7 +102,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
}
}
private Integer saveSendMsg(StaffMonthSalarySlip monthSalary) {
private StaffMonthSalarySlipSend saveSendMsg(StaffMonthSalarySlip monthSalary) {
StaffMonthSalarySlipSend staffMonthSalarySlipSend = new StaffMonthSalarySlipSend();
staffMonthSalarySlipSend.setStaffName(monthSalary.getStaffName());
staffMonthSalarySlipSend.setStaffPhone(monthSalary.getStaffPhone());
......@@ -125,7 +132,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
// 封装入职日期
staffMonthSalarySlipSend.setEntryDate(buildEntryDate(monthSalary));
staffMonthSalarySlipSendMapper.insertUseGeneratedKeys(staffMonthSalarySlipSend);
return staffMonthSalarySlipSend.getId();
return staffMonthSalarySlipSend;
}
public static String parsePerformanceLevelString(Integer performanceLevel) {
......@@ -171,15 +178,15 @@ public class StaffMonthSalaryJob implements SimpleJob {
* 发送
*
* @param monthSalary 工资条
* @param id 消息id
* @param slipSend 消息
*/
private void sendMessage(StaffMonthSalarySlip monthSalary, Integer id) {
private void sendMessage(StaffMonthSalarySlip monthSalary, StaffMonthSalarySlipSend slipSend) {
log.info("发送员工:{},手机号:{} 工资计算结果", monthSalary.getStaffName(), monthSalary.getStaffPhone());
// 获取企微员工标识门店号
Integer merchantId = env.getProperty("staff.month.salary.send.qw.notice.merchantId", Integer.class, 44202977);
// 发送自建应用消息对应(wechat-build-server)配置门店号
Integer sendConfigMerchantId = env.getProperty("staff.month.salary.send.qw.config.merchantId", Integer.class, 442029771);
String agentId = env.getProperty("staff.month.salary.send.qw.notice.agentId", String.class,"1000024");
String agentId = env.getProperty("staff.month.salary.send.qw.notice.agentId", String.class, "1000024");
String titleEnv = env.getProperty("staff.month.salary.send.qw.notice.title", String.class, "%s工资条系统数据");
String descriptionEvn = env.getProperty("staff.month.salary.send.qw.notice.description", String.class, "您好!感谢您这一月的辛勤工作,以下是您%s月的系统数据工资条,请查收!如有疑问请联系您的管辖上级处理。");
String urlEvn = env.getProperty("staff.month.salary.send.qw.notice.url", String.class);
......@@ -187,7 +194,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
if (StringUtils.isBlank(userId)) {
log.info("员工:{},手机号:{} 获取企微员工标识失败", monthSalary.getStaffName(), monthSalary.getStaffPhone());
StaffMonthSalarySlipSend staffMonthSalarySlipSend = new StaffMonthSalarySlipSend();
staffMonthSalarySlipSend.setId(id);
staffMonthSalarySlipSend.setId(slipSend.getId());
staffMonthSalarySlipSend.setStatus(3);
staffMonthSalarySlipSend.setErrMsg("获取企微员工标识失败");
staffMonthSalarySlipSendMapper.updateByPrimaryKeySelective(staffMonthSalarySlipSend);
......@@ -199,11 +206,15 @@ public class StaffMonthSalaryJob implements SimpleJob {
requestDTO.setToUser(userId);
requestDTO.setMsgType(WorkWechatAppMessageTypeEnum.TEXTCARD.getValue());
String title = String.format(titleEnv, monthSalary.getSalaryMonth().substring(0, 4));
String description = String.format(descriptionEvn, monthSalary.getSalaryMonth().substring(5, 7));
String month = monthSalary.getSalaryMonth().substring(5, 7);
if (month.startsWith("0")) {
month = month.substring(1);
}
String description = String.format(descriptionEvn, month);
WorkWechatTextCardMessageDTO textCard = new WorkWechatTextCardMessageDTO();
textCard.setTitle(title);
textCard.setDescription(description);
textCard.setUrl(urlEvn);
textCard.setUrl(urlEvn + "?uuid=" + slipSend.getUuid());
requestDTO.setTextCard(textCard);
SendWorkWechatMessageResponseDTO responseDTO = null;
try {
......@@ -214,15 +225,15 @@ public class StaffMonthSalaryJob implements SimpleJob {
if (responseDTO != null && responseDTO.isSuccess()) {
log.info("员工:{},手机号:{} 获取企微员工标识成功", monthSalary.getStaffName(), monthSalary.getStaffPhone());
StaffMonthSalarySlipSend staffMonthSalarySlipSend = new StaffMonthSalarySlipSend();
staffMonthSalarySlipSend.setId(id);
staffMonthSalarySlipSend.setId(slipSend.getId());
staffMonthSalarySlipSend.setStatus(2);
staffMonthSalarySlipSendMapper.updateByPrimaryKeySelective(staffMonthSalarySlipSend);
} else {
log.info("员工:{},手机号:{} 获取企微员工标识失败:{}", monthSalary.getStaffName(), monthSalary.getStaffPhone(), JSON.toJSONString(responseDTO));
StaffMonthSalarySlipSend staffMonthSalarySlipSend = new StaffMonthSalarySlipSend();
staffMonthSalarySlipSend.setId(id);
staffMonthSalarySlipSend.setId(slipSend.getId());
staffMonthSalarySlipSend.setStatus(3);
staffMonthSalarySlipSend.setErrMsg(responseDTO.getErrMsg());
staffMonthSalarySlipSend.setErrMsg(responseDTO != null ? responseDTO.getErrMsg() : "发送企微应用消息异常");
staffMonthSalarySlipSendMapper.updateByPrimaryKeySelective(staffMonthSalarySlipSend);
}
......
......@@ -6,6 +6,7 @@ import cn.com.glsx.dj.smartcarlife.model.StaffBaseInfo;
import cn.com.glsx.dj.staff.dto.salary.SalaryStaffInfoDTO;
import cn.com.glsx.dj.staff.dto.salary.StaffSalaryDetailDTO;
import cn.com.glsx.dj.staff.dto.salary.StaffSalaryDetailRequestDTO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
......@@ -24,4 +25,24 @@ public interface StaffMonthSalarySlipMapper extends OreMapper<StaffMonthSalarySl
List<StaffSalaryDetailDTO> getStaffMonthSalaryDetailData(StaffSalaryDetailRequestDTO condition);
List<StaffBaseInfo> queryStaffBaseInfo(@Param("statMonth") String statMonth);
/**
* 获取实际售前触客数
* @param staffPhone
* @param startDate
* @param endDate
* @return
*/
Integer getShopCount(@Param("staffPhone")String staffPhone, @Param("startDate")String startDate,
@Param("endDate")String endDate);
/**
* 获取平板录音数
* @param staffPhone
* @param startDate
* @param endDate
* @return
*/
Integer getRecordingsCount(@Param("staffPhone")String staffPhone, @Param("startDate")String startDate,
@Param("endDate")String endDate);
}
\ No newline at end of file
......@@ -170,6 +170,7 @@ public class EffectiveReferralReviewMiniProgramService {
countDTO.setBrandType(EffectiveReferralBrandTypeEnum.getCodeByDescription(item.getBrandName()));
countDTO.setDeliveryCount(item.getTotalDeliveryCount());
countDTO.setEffectiveReferralCount(item.getAreaEffectiveCount());
countDTO.setReviewedEffectiveCount(item.getReviewedEffectiveCount());
effectiveReferralCountDTOS.add(countDTO);
}
);
......
......@@ -20,6 +20,7 @@ import java.time.format.DateTimeParseException;
import java.time.temporal.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -43,6 +44,10 @@ public class DateUtils extends cn.com.glsx.framework.core.util.DateUtils {
public static final String CURRENT_MONTH = "当月";
private static final String [] PARSER_PATTERNS = {"yyyy-MM-dd","yyyy-M-d HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm:ss.S"};
private static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM");
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private static final Pattern MONTH_PATTERN = Pattern.compile("^\\d{4}-(0[1-9]|1[0-2])$");
public static int getDateYear(Date date) {
Calendar c = Calendar.getInstance();
......@@ -236,8 +241,10 @@ public class DateUtils extends cn.com.glsx.framework.core.util.DateUtils {
public static void main(String[] args) {
// System.out.println(getMonthStartTimeByDate("2025-03-17", true));
// System.out.println(getMonthEndTimeByDate("2025-03-17", true));
List<Date> list = getMonthDates("2026-01");
list.forEach(System.out::println);
// List<Date> list = getMonthDates("2026-01");
// list.forEach(System.out::println);
String[] list = getMonthBoundariesArray("2025-12");
System.out.println(Arrays.toString(list));
}
/**
......@@ -1530,5 +1537,84 @@ public class DateUtils extends cn.com.glsx.framework.core.util.DateUtils {
return outputFormat.format(date);
}
/**
* 获取指定月份的第一天和最后一天
*
* @param monthStr 月份字符串,格式:yyyy-MM
* @return Map,包含firstDay和lastDay
* @throws IllegalArgumentException 如果月份格式无效
*/
public static Map<String, String> getMonthBoundaries(String monthStr) {
validateMonthFormat(monthStr);
try {
// 解析年月
YearMonth yearMonth = YearMonth.parse(monthStr, MONTH_FORMATTER);
// 获取第一天和最后一天
LocalDate firstDay = yearMonth.atDay(1);
LocalDate lastDay = yearMonth.atEndOfMonth();
// 返回结果
Map<String, String> result = new HashMap<>();
result.put("firstDay", firstDay.format(DATE_FORMATTER));
result.put("lastDay", lastDay.format(DATE_FORMATTER));
return result;
} catch (DateTimeParseException e) {
throw new IllegalArgumentException("月份格式无效,请输入yyyy-MM格式,如:2024-01", e);
}
}
/**
* 获取指定月份的第一天
*/
public static String getFirstDayOfMonth(String monthStr) {
Map<String, String> boundaries = getMonthBoundaries(monthStr);
return boundaries.get("firstDay");
}
/**
* 获取指定月份的最后一天
*/
public static String getLastDayOfMonth(String monthStr) {
Map<String, String> boundaries = getMonthBoundaries(monthStr);
return boundaries.get("lastDay");
}
/**
* 获取月份的第一天和最后一天(返回数组形式)
*/
public static String[] getMonthBoundariesArray(String monthStr) {
Map<String, String> boundaries = getMonthBoundaries(monthStr);
return new String[] { boundaries.get("firstDay"), boundaries.get("lastDay") };
}
/**
* 验证月份格式
*/
private static void validateMonthFormat(String monthStr) {
if (monthStr == null || monthStr.trim().isEmpty()) {
throw new IllegalArgumentException("月份字符串不能为空");
}
String trimmed = monthStr.trim();
if (!MONTH_PATTERN.matcher(trimmed).matches()) {
throw new IllegalArgumentException("月份格式无效,请输入yyyy-MM格式,如:2024-01");
}
// 验证月份是否有效
String[] parts = trimmed.split("-");
int year = Integer.parseInt(parts[0]);
int month = Integer.parseInt(parts[1]);
if (year < 1) {
throw new IllegalArgumentException("年份不能小于1");
}
if (month < 1 || month > 12) {
throw new IllegalArgumentException("月份必须在1-12之间");
}
}
}
......@@ -10,8 +10,11 @@
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="deduct_month" property="deductMonth" jdbcType="CHAR" />
<result column="behavior_deduct_type" property="behaviorDeductType" jdbcType="TINYINT" />
<result column="behavior_count" property="behaviorCount" jdbcType="INTEGER" />
<result column="modify_flag" property="modifyFlag" jdbcType="INTEGER" />
<result column="shop_count" property="behaviorCount" jdbcType="INTEGER" />
<result column="behavior_count" property="shopCount" jdbcType="INTEGER" />
<result column="recording_count" property="recordingCount" jdbcType="INTEGER" />
<result column="pad_deduction" property="padDeduction" jdbcType="DECIMAL" />
<result column="modify_flag" property="modifyFlag" jdbcType="INTEGER" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="create_by" property="createBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
......@@ -22,7 +25,7 @@
<!--
WARNING - @mbg.generated
-->
id, staff_name, staff_phone, deduct_month, behavior_deduct_type, behavior_count,
id, staff_name, staff_phone, deduct_month, behavior_deduct_type, behavior_count, shop_count, recording_count, pad_deduction,
modify_flag, created_date, create_by, updated_date, updated_by, deleted_flag
</sql>
</mapper>
\ No newline at end of file
......@@ -208,6 +208,28 @@
ORDER BY
s1.phone_number
</select>
<select id="getShopCount" resultType="java.lang.Integer">
SELECT SUM(IFNULL(h.equity_to_shop_count, 0))
FROM `dj_car_life_staff_daily_report_huawei` h
INNER JOIN `dj_car_life_staff_info` s
ON h.staff_uuid = s.staff_uuid
WHERE h.report_date <![CDATA[>=]]> #{startDate}
AND h.report_date <![CDATA[<=]]> #{endDate}
AND s.phone_number = #{staffPhone}
AND h.deleted_flag = 'N'
AND s.deleted_flag = 'N'
</select>
<select id="getRecordingsCount" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM `reception_customer_info` h
INNER JOIN `dj_car_life_staff_info` s
ON h.staff_uuid = s.staff_uuid
WHERE h.reception_start_time <![CDATA[>=]]> #{startDate}
AND h.reception_start_time <![CDATA[<=]]> #{endDate}
AND s.phone_number = #{staffPhone}
AND h.deleted_flag = 'N'
AND s.deleted_flag = 'N'
</select>
<sql id="list_condition">
<where>
......
......@@ -73,8 +73,8 @@ public class StaffMonthSalaryServiceTest extends BaseServiceTest {
@Test
public void testStatMonthSalary() {
StaffMonthSalarySlip info = new StaffMonthSalarySlip();
info.setStaffName("叶立庆");
info.setStaffPhone("18126301457");
info.setStaffName("明明长岭园区店员工01");
info.setStaffPhone("15626599736");
info.setSalaryMonth("2025-12");
info.setUpdatedBy("system");
long l = System.currentTimeMillis();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!