1
This commit is contained in:
@@ -30,7 +30,10 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.jarvis.domain.JDOrder;
|
import com.ruoyi.jarvis.domain.JDOrder;
|
||||||
import com.ruoyi.jarvis.domain.dto.JDOrderSimpleDTO;
|
import com.ruoyi.jarvis.domain.dto.JDOrderSimpleDTO;
|
||||||
import com.ruoyi.jarvis.domain.dto.QuickRecordModelOption;
|
import com.ruoyi.jarvis.domain.dto.QuickRecordModelOption;
|
||||||
|
import com.ruoyi.jarvis.domain.dto.QuickRecordModelShopOption;
|
||||||
|
import com.ruoyi.jarvis.util.QuickRecordModelShopOptionUtil;
|
||||||
import com.ruoyi.jarvis.service.IJDOrderProfitService;
|
import com.ruoyi.jarvis.service.IJDOrderProfitService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.jarvis.service.IJDOrderService;
|
import com.ruoyi.jarvis.service.IJDOrderService;
|
||||||
import com.ruoyi.jarvis.service.IInstructionService;
|
import com.ruoyi.jarvis.service.IInstructionService;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
@@ -54,13 +57,15 @@ public class JDOrderListController extends BaseController
|
|||||||
private final IGroupRebateExcelUploadService groupRebateExcelUploadService;
|
private final IGroupRebateExcelUploadService groupRebateExcelUploadService;
|
||||||
|
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
private final ISysConfigService sysConfigService;
|
||||||
|
|
||||||
public JDOrderListController(IJDOrderService jdOrderService, IJDOrderProfitService jdOrderProfitService,
|
public JDOrderListController(IJDOrderService jdOrderService, IJDOrderProfitService jdOrderProfitService,
|
||||||
IOrderRowsService orderRowsService,
|
IOrderRowsService orderRowsService,
|
||||||
IInstructionService instructionService,
|
IInstructionService instructionService,
|
||||||
GroupRebateExcelImportService groupRebateExcelImportService,
|
GroupRebateExcelImportService groupRebateExcelImportService,
|
||||||
IGroupRebateExcelUploadService groupRebateExcelUploadService,
|
IGroupRebateExcelUploadService groupRebateExcelUploadService,
|
||||||
ObjectMapper objectMapper) {
|
ObjectMapper objectMapper,
|
||||||
|
ISysConfigService sysConfigService) {
|
||||||
this.jdOrderService = jdOrderService;
|
this.jdOrderService = jdOrderService;
|
||||||
this.jdOrderProfitService = jdOrderProfitService;
|
this.jdOrderProfitService = jdOrderProfitService;
|
||||||
this.orderRowsService = orderRowsService;
|
this.orderRowsService = orderRowsService;
|
||||||
@@ -68,6 +73,7 @@ public class JDOrderListController extends BaseController
|
|||||||
this.groupRebateExcelImportService = groupRebateExcelImportService;
|
this.groupRebateExcelImportService = groupRebateExcelImportService;
|
||||||
this.groupRebateExcelUploadService = groupRebateExcelUploadService;
|
this.groupRebateExcelUploadService = groupRebateExcelUploadService;
|
||||||
this.objectMapper = objectMapper;
|
this.objectMapper = objectMapper;
|
||||||
|
this.sysConfigService = sysConfigService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,6 +186,16 @@ public class JDOrderListController extends BaseController
|
|||||||
return AjaxResult.success(options);
|
return AjaxResult.success(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快捷录单页:型号后缀店铺下拉(系统参数 quickRecord.modelShopOptions,每行格式:短前缀(完整店名))
|
||||||
|
*/
|
||||||
|
@GetMapping("/quickRecord/shopOptions")
|
||||||
|
public AjaxResult quickRecordShopOptions() {
|
||||||
|
String raw = sysConfigService.selectConfigByKey(QuickRecordModelShopOptionUtil.CONFIG_KEY);
|
||||||
|
List<QuickRecordModelShopOption> options = QuickRecordModelShopOptionUtil.parseOptions(raw);
|
||||||
|
return AjaxResult.success(options);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入跟团返现类 Excel:按「单号/订单号」匹配系统订单,将「是否返现」「总共返现」等写入后返备注(可多次导入累加);文件落盘并记上传记录。
|
* 导入跟团返现类 Excel:按「单号/订单号」匹配系统订单,将「是否返现」「总共返现」等写入后返备注(可多次导入累加);文件落盘并记上传记录。
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.jarvis.domain.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快捷录单:型号后缀店铺选项(前缀拼接到型号末尾,如 W5000PLUS2.0白 + 海尔厨房)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QuickRecordModelShopOption {
|
||||||
|
|
||||||
|
/** 拼接到型号末尾的短前缀,如 海尔官旗 */
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/** 括号内完整店铺名,如 海尔官方旗舰店 */
|
||||||
|
private String fullName;
|
||||||
|
|
||||||
|
/** 展示文案,如 海尔官旗(海尔官方旗舰店) */
|
||||||
|
private String label;
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.ruoyi.jarvis.util;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.jarvis.domain.dto.QuickRecordModelShopOption;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析快捷录单型号店铺配置:每行/逗号分隔,格式「短前缀(完整店名)」。
|
||||||
|
*/
|
||||||
|
public final class QuickRecordModelShopOptionUtil {
|
||||||
|
|
||||||
|
public static final String CONFIG_KEY = "quickRecord.modelShopOptions";
|
||||||
|
|
||||||
|
private static final Pattern LINE_PATTERN = Pattern.compile("^(.+?)[((](.+)[))]$");
|
||||||
|
|
||||||
|
private QuickRecordModelShopOptionUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<QuickRecordModelShopOption> parseOptions(String raw) {
|
||||||
|
if (StringUtils.isEmpty(raw)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
String[] parts = raw.split("[\\r\\n,,]+");
|
||||||
|
List<QuickRecordModelShopOption> list = new ArrayList<>();
|
||||||
|
for (String part : parts) {
|
||||||
|
if (StringUtils.isEmpty(part)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QuickRecordModelShopOption opt = parseOneLine(part.trim());
|
||||||
|
if (opt != null && StringUtils.isNotEmpty(opt.getPrefix())) {
|
||||||
|
list.add(opt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static QuickRecordModelShopOption parseOneLine(String line) {
|
||||||
|
if (StringUtils.isEmpty(line)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Matcher m = LINE_PATTERN.matcher(line);
|
||||||
|
QuickRecordModelShopOption opt = new QuickRecordModelShopOption();
|
||||||
|
if (m.matches()) {
|
||||||
|
opt.setPrefix(m.group(1).trim());
|
||||||
|
opt.setFullName(m.group(2).trim());
|
||||||
|
} else {
|
||||||
|
opt.setPrefix(line.trim());
|
||||||
|
opt.setFullName("");
|
||||||
|
}
|
||||||
|
opt.setLabel(buildLabel(opt.getPrefix(), opt.getFullName()));
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String buildLabel(String prefix, String fullName) {
|
||||||
|
if (StringUtils.isEmpty(fullName)) {
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
return prefix + "(" + fullName + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从完整型号末尾匹配已知店铺前缀(长前缀优先),用于回显拆分。
|
||||||
|
*/
|
||||||
|
public static String[] splitModelSuffix(String fullModel, List<QuickRecordModelShopOption> options) {
|
||||||
|
String full = StringUtils.trim(fullModel);
|
||||||
|
if (StringUtils.isEmpty(full) || options == null || options.isEmpty()) {
|
||||||
|
return new String[] { full, "" };
|
||||||
|
}
|
||||||
|
List<QuickRecordModelShopOption> sorted = new ArrayList<>(options);
|
||||||
|
sorted.sort((a, b) -> {
|
||||||
|
int la = a.getPrefix() != null ? a.getPrefix().length() : 0;
|
||||||
|
int lb = b.getPrefix() != null ? b.getPrefix().length() : 0;
|
||||||
|
return Integer.compare(lb, la);
|
||||||
|
});
|
||||||
|
for (QuickRecordModelShopOption opt : sorted) {
|
||||||
|
String prefix = opt.getPrefix();
|
||||||
|
if (StringUtils.isEmpty(prefix)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (full.endsWith(prefix) && full.length() > prefix.length()) {
|
||||||
|
return new String[] { full.substring(0, full.length() - prefix.length()), prefix };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new String[] { full, "" };
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user