Commit 16479694 by 林永健

feat: 合并svn 5.4.1版本相关改动

1 parent 5e536224
package cn.com.glsx.dj.mindworkplate.constant;
import com.alibaba.metrics.StringUtils;
import java.util.Objects;
/**
* 数字化管理-日报管理相关常量
*/
......@@ -26,16 +30,24 @@ public class DigitalManagementConstants {
public static final String RECORD_ITEM_KEY_IS_TRAINING_ORGANIZED = "isTrainingOrganized"; // 是否组织培训
public static final String RECORD_ITEM_KEY_ASSESSMENT_RESULT = "assessmentResult"; // 考核结果
public static final String RECORD_ITEM_KEY_TOMORROW_PLAN = "tomorrowPlan"; // 明日计划
public static final String RECORD_ITEM_KEY_TODAY_SUMMARY = "todaySummary"; // 今日总结
// 布尔值是/否
public static final String BOOL_VALUE_TRUE = "是";
public static final String BOOL_VALUE_FALSE = "否";
public static final String HIDE_VALUE = "0";
public static final String HIDE_VALUE = " ";
// 定制推送标题
public static final String PUSH_TITLE_MONTHLY_TOTAL_TRAINING = "本月累计培训次数:";
public static final String PUSH_TITLE_VALUE_UN_TRAIN = "未培训";
public static boolean isHideValue(String val){
if (StringUtils.isBlank(val)) {
return true;
}
return Objects.equals(HIDE_VALUE, val);
}
}
......@@ -28,7 +28,7 @@ import java.util.stream.Collectors;
* @Version 1.0
*/
@Slf4j
@ElasticJobConf(name = "MonthlyTrainingStatisticsJob", cron = "0 0 10 ? * MON", description = "运营日报填写每月培训场次统计", overwrite = false)
//@ElasticJobConf(name = "MonthlyTrainingStatisticsJob", cron = "0 0 10 ? * MON", description = "运营日报填写每月培训场次统计", overwrite = false)
public class MonthlyTrainingStatisticsJob implements SimpleJob {
@Autowired
......
......@@ -22,4 +22,6 @@ public interface DigitalManagementStaffRecordItemMapper extends OreMapper<Digita
void updateHistoryRate(@Param("ids") List<Integer> ids, @Param("rate") String rate, @Param("isMonth") boolean isMonth);
List<DigitalManagementStaffRecordItemDTO> findByRecordId(@Param("recordId") Integer recordId);
List<DigitalManagementStaffRecordItem> selectByRecordId(@Param("recordId") Integer recordId);
}
\ No newline at end of file
......@@ -15,4 +15,6 @@ public interface ExtractSourceMapper extends OreMapper<ExtractSource> {
List<ExtractSource> selectDealOrderSoundRecordingTask(@Param("score") BigDecimal score);
List<ExtractSource> selectDealSoundRecordingTask(@Param("score") BigDecimal score);
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
......@@ -318,32 +319,45 @@ public class DigitalManagementStaffRecordService {
RpcAssert.assertNotNull(template, DefaultErrorEnum.VALIDATE_FAILED, "您当前无需提交该日报");
DigitalManagementStaffRecord staffRecord = staffRecordMapper.myRecordDetail(uuid, today);
RpcAssert.assertIsNull(staffRecord, DefaultErrorEnum.DATA_EXIST, "当天日报已填写,无需重复填写。");
staffRecord = new DigitalManagementStaffRecord();
staffRecord.setStaffUuid(uuid);
staffRecord.setTemplateCode(template.getCode());
staffRecord.setCreatedBy(uuid);
staffRecord.setUpdatedBy(uuid);
staffRecord.setCreatedDate(today);
staffRecord.setUpdatedDate(today);
staffRecord.setDeletedFlag(DeleteFlagEnum.N.getValue());
List<DigitalManagementTemplateItemDTO> templateItems = templateItemMapper.findByCode(template.getCode());
List<DigitalManagementStaffRecordItem> recordItems = templateItems.stream().map(item -> {
DigitalManagementStaffRecordItem recordItem = new DigitalManagementStaffRecordItem();
BeanUtils.copyProperties(item, recordItem);
recordItem.setValue(form.get(item.getKey()));
recordItem.setCreatedBy(uuid);
recordItem.setUpdatedBy(uuid);
recordItem.setCreatedDate(today);
recordItem.setUpdatedDate(today);
recordItem.setDeletedFlag(DeleteFlagEnum.N.getValue());
if (Objects.equals(RECORD_ITEM_KEY_ATTENDING_STAFF, item.getKey())) {
recordItem.setStaffIds(form.get(RECORD_ITEM_KEY_STAFF_IDS));
}
return recordItem;
}).collect(Collectors.toList());
// 20251208 区域运营支持当日模板进行编辑
boolean supportEdit = StringUtils.isNotBlank(template.getExtendField())
&& Optional.ofNullable(JSON.parseObject(template.getExtendField())).map(p -> p.getBoolean("supportEdit")).orElse(false);
boolean nonExist = staffRecord == null;
RpcAssert.assertIsTrue(supportEdit || nonExist, DefaultErrorEnum.DATA_EXIST, "当天日报已填写,无需重复填写。");
List<DigitalManagementStaffRecordItem> recordItems;
if (nonExist) {
staffRecord = new DigitalManagementStaffRecord();
staffRecord.setStaffUuid(uuid);
staffRecord.setTemplateCode(template.getCode());
staffRecord.setCreatedBy(uuid);
staffRecord.setCreatedDate(today);
staffRecord.setDeletedFlag(DeleteFlagEnum.N.getValue());
List<DigitalManagementTemplateItemDTO> templateItems = templateItemMapper.findByCode(template.getCode());
recordItems = templateItems.stream().map(item -> {
DigitalManagementStaffRecordItem recordItem = new DigitalManagementStaffRecordItem();
BeanUtils.copyProperties(item, recordItem);
recordItem.setValue(form.get(item.getKey()));
recordItem.setCreatedBy(uuid);
recordItem.setUpdatedBy(uuid);
recordItem.setCreatedDate(today);
recordItem.setUpdatedDate(today);
recordItem.setDeletedFlag(DeleteFlagEnum.N.getValue());
if (Objects.equals(RECORD_ITEM_KEY_ATTENDING_STAFF, item.getKey())) {
recordItem.setStaffIds(form.get(RECORD_ITEM_KEY_STAFF_IDS));
}
return recordItem;
}).collect(Collectors.toList());
}else {
staffRecord.setUpdatedBy(uuid);
staffRecord.setUpdatedDate(today);
recordItems = staffRecordItemMapper.selectByRecordId(staffRecord.getId());
recordItems.forEach(item -> {
item.setValue(form.get(item.getKey()));
item.setUpdatedBy(uuid);
item.setUpdatedDate(today);
});
}
DigitalManagementStaffRecordDTO todayRecordDTO = new DigitalManagementStaffRecordDTO();
BeanUtils.copyProperties(staffRecord, todayRecordDTO);
......@@ -358,16 +372,22 @@ public class DigitalManagementStaffRecordService {
Map<String, String> weekRateMap = computeRateAndUpdateHistory(todayRecordDTO, false);
Map<String, String> monthRateMap = computeRateAndUpdateHistory(todayRecordDTO, true);
staffRecordMapper.insertUseGeneratedKeys(staffRecord);
Integer staffRecordId = staffRecord.getId();
recordItems.forEach(item -> {
item.setRecordId(staffRecordId);
item.setWeekRate(weekRateMap.get(item.getKey()));
item.setMonthRate(monthRateMap.get(item.getKey()));
});
staffRecordItemMapper.insertList(recordItems);
return staffRecordId;
if (nonExist) {
staffRecordMapper.insertUseGeneratedKeys(staffRecord);
Integer staffRecordId = staffRecord.getId();
recordItems.forEach(item -> item.setRecordId(staffRecordId));
staffRecordItemMapper.insertList(recordItems);
}else {
staffRecordMapper.updateByPrimaryKey(staffRecord);
recordItems.forEach(item -> staffRecordItemMapper.updateByPrimaryKey(item));
}
return staffRecord.getId();
}
/**
......@@ -589,9 +609,9 @@ public class DigitalManagementStaffRecordService {
AtomicBoolean dayOffStatus = new AtomicBoolean(false);
boolean isRegionalTemplate = isRegionalTemplate(recordDTO.getTemplateCode());
if (isRegionalTemplate) {
contentBuilder
.append(PUSH_TITLE_MONTHLY_TOTAL_TRAINING)
.append(staffRecordMapper.getMonthlyIsTrainingOrganizedCount(recordDTO.getStaffUuid())).append("次\n");
// contentBuilder
// .append(PUSH_TITLE_MONTHLY_TOTAL_TRAINING)
// .append(staffRecordMapper.getMonthlyIsTrainingOrganizedCount(recordDTO.getStaffUuid())).append("次\n");
// 取"业绩报告-当日休假"字段判断,并将其移动到上一层级
// DigitalManagementStaffRecordItemDTO dayOffStatusItem;
recordDTO.getTypes().stream()
......@@ -607,9 +627,9 @@ public class DigitalManagementStaffRecordService {
});
});
// 休假时,删除"工作总结"
if (dayOffStatus.get()) {
recordDTO.setTypes(recordDTO.getTypes().stream().filter(p -> !RECORD_ITEM_KEY_WORK_SUMMARY.equals(p.getKey())).collect(Collectors.toList()));
}
// if (dayOffStatus.get()) {
// recordDTO.setTypes(recordDTO.getTypes().stream().filter(p -> !RECORD_ITEM_KEY_WORK_SUMMARY.equals(p.getKey())).collect(Collectors.toList()));
// }
}
return buildRecordContent(contentBuilder, recordDTO, dayOffStatus.get(), isRegionalTemplate);
}
......@@ -627,23 +647,23 @@ public class DigitalManagementStaffRecordService {
StringBuilder subContentBuilder = new StringBuilder();
for (DigitalManagementStaffRecordItemDTO type : recordDTO.getTypes()) {
// 判断"是否组织培训"为否,则上级只须展示"未培训"
if (type.getKey().startsWith(RECORD_ITEM_KEY_ORGANIZE_TRAINING) && CollectionUtils.isNotEmpty(type.getItems())) {
Boolean isTrainingOrganized = type.getItems().stream()
.filter(item -> item.getKey().startsWith(RECORD_ITEM_KEY_IS_TRAINING_ORGANIZED))
.map(item -> BOOL_VALUE_TRUE.equals(item.getValue()))
.findFirst().orElse(false);
if (!isTrainingOrganized) {
if (isRegionalTemplate) {
subContentBuilder.append("【").append(type.getName()).append("】\n");
subContentBuilder.append(PUSH_TITLE_VALUE_UN_TRAIN).append("\n");
}
continue;
}
}
// if (type.getKey().startsWith(RECORD_ITEM_KEY_ORGANIZE_TRAINING) && CollectionUtils.isNotEmpty(type.getItems())) {
// Boolean isTrainingOrganized = type.getItems().stream()
// .filter(item -> item.getKey().startsWith(RECORD_ITEM_KEY_IS_TRAINING_ORGANIZED))
// .map(item -> BOOL_VALUE_TRUE.equals(item.getValue()))
// .findFirst().orElse(false);
// if (!isTrainingOrganized) {
// if (isRegionalTemplate) {
// subContentBuilder.append("【").append(type.getName()).append("】\n");
// subContentBuilder.append(PUSH_TITLE_VALUE_UN_TRAIN).append("\n");
// }
// continue;
// }
// }
// hideDefaultValue=true时,如果全部都是默认值,则上级都不用展示了
if (hideDefaultValue
&& type.getItems().stream().allMatch(item -> HIDE_VALUE.equals(item.getValue()))) {
&& type.getItems().stream().allMatch(item -> isHideValue(item.getValue()))) {
continue;
}
......@@ -651,7 +671,7 @@ public class DigitalManagementStaffRecordService {
for (DigitalManagementStaffRecordItemDTO item : type.getItems()) {
String value = item.getValue();
// 默认值则隐藏此项
if (hideDefaultValue && HIDE_VALUE.equals(value)) {
if (hideDefaultValue && isHideValue(value)) {
continue;
}
......@@ -665,6 +685,10 @@ public class DigitalManagementStaffRecordService {
if (StringUtils.isNotBlank(suffix)) {
value = value + suffix;
}
// 特殊字段:加换行
if (item.getKey().startsWith(RECORD_ITEM_KEY_TODAY_SUMMARY) || item.getKey().startsWith(RECORD_ITEM_KEY_TOMORROW_PLAN)){
value = "\n" + value;
}
} else {
value = "无";
}
......
......@@ -448,7 +448,7 @@ public class ExtractSourceService {
public void duplicateRemovalRecordResult() {
String taskId = null;
Integer id = null;
RemoveDuplicateTask duplicateTask = null;
RemoveDuplicateTask duplicateTask;
try {
RemoveDuplicateTask record = new RemoveDuplicateTask();
record.setDelFlag("N");
......@@ -640,11 +640,23 @@ public class ExtractSourceService {
} else {
scenes = Collections.emptyList();
}
List<ExtractSource> saveList = extractSourceMapper.selectDealOrderSoundRecordingTask(score);
if (saveList != null && !saveList.isEmpty() && CollectionUtils.isNotEmpty(scenes)) {
List<ExtractSource> saveList = new ArrayList<>();
if (scenes.contains(1)) {
List<ExtractSource> extractSources = extractSourceMapper.selectDealSoundRecordingTask(score);
if (extractSources != null && !extractSources.isEmpty()) {
saveList.addAll(extractSources);
}
log.info("录音萃取-轻改录音查询结果:{}", saveList.size());
}
List<ExtractSource> allList = extractSourceMapper.selectDealOrderSoundRecordingTask(score);
if (allList != null && !allList.isEmpty()) {
allList = allList.stream().filter(e -> e.getScene() != 1).collect(Collectors.toList());
saveList.addAll(allList);
}
if (!saveList.isEmpty() && CollectionUtils.isNotEmpty(scenes)) {
saveList = saveList.stream().filter(e -> e.getScene() != null && scenes.contains(e.getScene())).collect(Collectors.toList());
}
if (saveList == null || saveList.isEmpty()) return;
if (saveList.isEmpty()) return;
// 如果配置了排除品牌,则过滤
if (brandFilter && excludeSceneChildBrand != null
&& excludeSceneChildBrand.getSceneChildBrandList() != null && !excludeSceneChildBrand.getSceneChildBrandList().isEmpty()) {
......
......@@ -82,4 +82,9 @@
where deleted_flag = 'N' and record_id = #{recordId}
</select>
<select id="selectByRecordId" resultMap="BaseResultMap">
select * from digital_management_staff_record_item
where deleted_flag = 'N' and record_id = #{recordId}
</select>
</mapper>
\ No newline at end of file
......@@ -87,4 +87,30 @@
AND t2.score >= #{score}
]]>
</select>
<select id="selectDealSoundRecordingTask"
resultType="cn.com.glsx.dj.mindworkplate.model.script.ExtractSource">
<![CDATA[
SELECT t1.id AS sourceId,
t2.id AS batchId,
t2.che_taskId AS extractTaskId,
t3.staff_uuid AS UUID,
t3.merchant_id AS merchantId,
CASE
WHEN t1.check_type = 2 THEN 1
WHEN t1.check_type = 3 THEN 2
ELSE 0 END AS scene,
'1' AS extractStatus,
t2.score AS "质检分数",
t3.phone_number AS "客户手机号",
t1.recording_start_time AS "录音开始时间"
FROM inspection_badge_recordings t1
INNER JOIN inspection_conversation_batch t2 ON t2.record_id = t1.id
INNER JOIN reception_customer_info t3 ON t3.id = t1.reception_id
WHERE t1.recording_start_time >= CURRENT_DATE()
AND t1.recording_start_time < DATE_ADD(CURRENT_DATE(), INTERVAL 1 DAY)
AND t2.score >= #{score}
AND t1.check_type = 2
]]>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!