增加打印机试打印接口,飞鹅打印模版删除了 订金字段,订单改成可配置的 35分钟
This commit is contained in:
parent
500c0c39e7
commit
dcc160e66f
@ -19,10 +19,7 @@ import com.suisung.mall.core.web.service.RedisService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
@ -82,6 +79,17 @@ public class AccountBaseConfigController {
|
||||
return CommonResult.success(accountBaseConfig);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取某个系统配置的值-远程调用系统内部使用", notes = "获取某个系统配置的值-远程调用系统内部使用")
|
||||
@PostMapping(value = "/get/value")
|
||||
public String getAccountBaseConfigValue(@RequestParam(name = "config_key") String config_key) {
|
||||
AccountBaseConfig accountBaseConfig = accountBaseConfigService.get(config_key);
|
||||
if (accountBaseConfig == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return accountBaseConfig.getConfig_value();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑更新
|
||||
*
|
||||
@ -189,7 +197,7 @@ public class AccountBaseConfigController {
|
||||
@ApiOperation(value = "消息记录-分页列表查询", notes = "消息记录-分页列表查询")
|
||||
@RequestMapping(value = "/smsRecord", method = RequestMethod.GET)
|
||||
public CommonResult smsRecord(@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||
@RequestParam(name = "rows", defaultValue = "10") Integer rows) {
|
||||
@RequestParam(name = "rows", defaultValue = "10") Integer rows) {
|
||||
String serviceUserId = accountBaseConfigService.getConfig("service_user_id", "");
|
||||
String serviceAppKey = accountBaseConfigService.getConfig("service_app_key", "");
|
||||
|
||||
|
||||
@ -81,4 +81,6 @@ public class CommonConstant {
|
||||
public static final String PUSH_MSG_CATE_MCH_ONLINE_ORDER_LIST = "mchOnLineOrderList";
|
||||
public static final String PUSH_MSG_CATE_MCH_ABNORMAL_ORDER_LIST = "mchAbnormalOrderList";
|
||||
public static final String PUSH_MSG_CATE_MCH_RETURN_ORDER_LIST = "mchRetrunOrderList";
|
||||
|
||||
public static final String CONF_KEY_SAME_CITY_ORDER_EXPIRE_SECONDS = "sameCityOrderExpireSeconds";
|
||||
}
|
||||
|
||||
@ -230,10 +230,10 @@ public interface AccountService {
|
||||
@RequestParam(name = "user_type", required = false) Integer user_type);
|
||||
|
||||
@PostMapping("/admin/account/pushTocid")
|
||||
String pushTocid(@RequestParam(name = "message") String message,@RequestParam(name = "userId") String userId);
|
||||
String pushTocid(@RequestParam(name = "message") String message, @RequestParam(name = "userId") String userId);
|
||||
|
||||
@PostMapping("/admin/account/pushNotificationTocid")
|
||||
String pushNotificationTocid(@RequestParam("userId") String userId,@RequestBody PushTemplate pushTemplate);
|
||||
String pushNotificationTocid(@RequestParam("userId") String userId, @RequestBody PushTemplate pushTemplate);
|
||||
|
||||
/**
|
||||
* 根据用户 Id 获取账号推送绑定关系列表记录
|
||||
@ -246,14 +246,16 @@ public interface AccountService {
|
||||
|
||||
/**
|
||||
* 通过手机号查找map
|
||||
*
|
||||
* @param mobiles
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/admin/account/accountController/getAccountsMapByMobile")
|
||||
Map<String,Integer> getAccountsMapByMobile(@RequestBody List<String> mobiles);
|
||||
Map<String, Integer> getAccountsMapByMobile(@RequestBody List<String> mobiles);
|
||||
|
||||
/**
|
||||
* 找出account表的最大id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/admin/account/accountController/getAccountMaxId")
|
||||
@ -262,6 +264,7 @@ public interface AccountService {
|
||||
|
||||
/**
|
||||
* 批量保存accountBase
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/admin/account/accountController/saveBatchAccountBase")
|
||||
@ -269,6 +272,7 @@ public interface AccountService {
|
||||
|
||||
/**
|
||||
* 批量保存accountInfo
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/admin/account/accountController/saveBatchAccountInfo")
|
||||
@ -276,8 +280,18 @@ public interface AccountService {
|
||||
|
||||
/**
|
||||
* 批量保存accountInfo
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/admin/account/accountController/findOneAccountUserBase")
|
||||
AccountUserBase findOneAccountUserBase(@RequestBody AccountUserBase accountUserBase);
|
||||
|
||||
/**
|
||||
* 获取某个系统配置的值-远程调用系统内部使用
|
||||
*
|
||||
* @param config_key
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/admin/account/account-base-config/get/value")
|
||||
String getAccountBaseConfigValue(@RequestParam(name = "config_key") String config_key);
|
||||
}
|
||||
|
||||
@ -41,6 +41,9 @@ public class ShopStorePrinterTemplate implements Serializable {
|
||||
@ApiModelProperty(value = "门店ID,0-门店公用的模版")
|
||||
private Integer store_id;
|
||||
|
||||
@ApiModelProperty(value = "用户自定义模版名称")
|
||||
private String cust_name;
|
||||
|
||||
@ApiModelProperty(value = "模版名称")
|
||||
private String template_name;
|
||||
|
||||
|
||||
@ -16,10 +16,12 @@ import com.suisung.mall.shop.lakala.service.LakalaApiService;
|
||||
import com.suisung.mall.shop.library.service.LibraryProductService;
|
||||
import com.suisung.mall.shop.message.service.MqMessageService;
|
||||
import com.suisung.mall.shop.message.service.PushMessageService;
|
||||
import com.suisung.mall.shop.order.service.ShopOrderBaseService;
|
||||
import com.suisung.mall.shop.order.service.ShopOrderReturnService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.Base64Utils;
|
||||
@ -36,21 +38,31 @@ import java.util.List;
|
||||
@RequestMapping("/mobile/shop/lakala")
|
||||
public class LakalaController extends BaseControllerImpl {
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private LakalaApiService lakalaPayService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private ShopOrderReturnService shopOrderReturnService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private LibraryProductService libraryProductService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private ShopStoreSameCityTransportBaseService storeSameCityTransportBaseService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private PushMessageService pushMessageService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private MqMessageService mqMessageService;
|
||||
|
||||
@ -76,15 +88,17 @@ public class LakalaController extends BaseControllerImpl {
|
||||
// List<String> clientIds = JSONUtil.toList(paramsJSON.getJSONArray("clientIds"), String.class);
|
||||
// return pushMessageService.sendMessage(clientIds, paramsJSON.getStr("title"), paramsJSON.getStr("content"), paramsJSON.getJSONObject("payload"));
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String orderId = "DD-20250725-1";
|
||||
jsonObject.put("category", 1);
|
||||
jsonObject.put("orderId", "DD-20250725-1");
|
||||
jsonObject.put("storeId", 12);
|
||||
jsonObject.put("title", "有一笔已超时的订单!");
|
||||
jsonObject.put("message", "您有一笔已超时的订单[" + orderId + "],请及时处理。");
|
||||
mqMessageService.sendDelayMessage(jsonObject.toString(), 10000);
|
||||
return jsonObject;
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// String orderId = "DD-20250725-1";
|
||||
// jsonObject.put("category", 1);
|
||||
// jsonObject.put("orderId", "DD-20250725-1");
|
||||
// jsonObject.put("storeId", 12);
|
||||
// jsonObject.put("title", "有一笔已超时的订单!");
|
||||
// jsonObject.put("message", "您有一笔已超时的订单[" + orderId + "],请及时处理。");
|
||||
// mqMessageService.sendDelayMessage(jsonObject.toString(), 10000);
|
||||
// return jsonObject;
|
||||
|
||||
return shopOrderBaseService.sameCityOrderExpireSeconds(10000L);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -42,20 +43,24 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class ShopOrderBaseController extends BaseControllerImpl {
|
||||
|
||||
private static final long mchOrderExpireSeconds = 1500; // 25分钟超时,60秒*25分钟 = 1500秒
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderItemService itemService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderDeliveryAddressService addressService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderStateLogService stateLogService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderInfoService shopOrderInfoService;
|
||||
|
||||
@ -322,6 +327,9 @@ public class ShopOrderBaseController extends BaseControllerImpl {
|
||||
return CommonResult.failed(ResultCode.FORBIDDEN);
|
||||
}
|
||||
|
||||
// 同城订单超时秒数
|
||||
long mchOrderExpireSeconds = shopOrderBaseService.sameCityOrderExpireSeconds(2100L); // 35分钟超时,60秒*35分钟 = 2100秒
|
||||
|
||||
// === 构建响应数据 ===
|
||||
Map<String, Object> respMap = new HashMap<>();
|
||||
// 订单列表数据(缓存时间25分钟)
|
||||
@ -355,6 +363,9 @@ public class ShopOrderBaseController extends BaseControllerImpl {
|
||||
return CommonResult.failed(ResultCode.VALIDATE_FAILED);
|
||||
}
|
||||
|
||||
// 同城订单超时秒数
|
||||
long mchOrderExpireSeconds = shopOrderBaseService.sameCityOrderExpireSeconds(2100L); // 35分钟超时,60秒*35分钟 = 2100秒
|
||||
|
||||
// 2. 获取订单详情
|
||||
MchOrderInfoDTO mchOrderInfoDTO = shopOrderBaseService.getMchOrderDetail(orderId, mchOrderExpireSeconds);
|
||||
if (mchOrderInfoDTO == null) {
|
||||
|
||||
@ -597,13 +597,12 @@ public interface ShopOrderBaseService extends IBaseService<ShopOrderBase> {
|
||||
*/
|
||||
WxOrderBaseInfoDTO getWxOrderBaseInfo(String orderId);
|
||||
|
||||
|
||||
/**
|
||||
* 预处理发货订单超时消息(发到 mq 里,触发超时事件,发出推送消息)
|
||||
* 获取同城配送最大有效时间(单位:秒)
|
||||
*
|
||||
* @param storeId 店铺Id
|
||||
* @param orderId 订单Id
|
||||
* @param expireSeconds 配送超时的秒数,单位秒
|
||||
* @param defaultValue 指定默认值,如果获取不到值,则返回此默认值
|
||||
* @return
|
||||
*/
|
||||
// Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds);
|
||||
Long sameCityOrderExpireSeconds(Long defaultValue);
|
||||
}
|
||||
|
||||
@ -8358,6 +8358,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
return null;
|
||||
}
|
||||
|
||||
// 订单商品列表
|
||||
List<ShopStoreOrderProductPrintVO> shopStoreOrderProductPrintVOList = shopOrderItemService.selectOrderItemPrintInfo(orderId);
|
||||
if (CollUtil.isEmpty(shopStoreOrderProductPrintVOList)) {
|
||||
return null;
|
||||
@ -8383,14 +8384,15 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
// 支付渠道处理
|
||||
m.put("payment_channel_name", m.getOrDefault("payment_channel_name", "线上支付").toString());
|
||||
|
||||
// 配送时间= 支付时间+25分钟
|
||||
m.put("delivery_time", DateUtil.offsetMinute((Date) m.get("payment_time"), 25));
|
||||
// 配送时间= 支付时间+35分钟
|
||||
Long mchOrderExpireSeconds = shopOrderBaseService.sameCityOrderExpireSeconds(2100L);
|
||||
m.put("delivery_time", DateUtil.offsetSecond((Date) m.get("payment_time"), mchOrderExpireSeconds.intValue()));
|
||||
// 配送方式
|
||||
String deliveryTypeName = StateCode.DELIVERY_TYPE_MAP.getOrDefault(m.getOrDefault("delivery_type_id", StateCode.DELIVERY_TYPE_SAME_CITY), "普通快递");
|
||||
m.put("delivery_type_name", deliveryTypeName);
|
||||
|
||||
// 预留字段
|
||||
m.put("quanyi", 0.00); // 会员权益
|
||||
m.put("quanyi", m.getOrDefault("total_discount_amount", 0.00)); // 会员权益
|
||||
m.put("miaosha", 0.00); // 秒杀
|
||||
m.put("yajin", 0.00); // 押金
|
||||
m.put("cashier", m.getOrDefault("store_name", "店长")); // 收银员
|
||||
@ -8824,6 +8826,33 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
return shopOrderBaseMapper.getWxOrderBaseInfo(orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取同城配送最大有效时间(单位:秒)
|
||||
*
|
||||
* @param defaultValue 指定默认值,如果获取不到值,则返回此默认值
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long sameCityOrderExpireSeconds(Long defaultValue) {
|
||||
try {
|
||||
String value = accountService.getAccountBaseConfigValue(CommonConstant.CONF_KEY_SAME_CITY_ORDER_EXPIRE_SECONDS);
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return defaultValue;
|
||||
}
|
||||
// 使用 Long.valueOf 替代 Long.parseLong,同时处理 NumberFormatException 异常
|
||||
return Long.valueOf(value.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
// 当配置值不是有效数字时,记录警告日志并返回默认值
|
||||
logger.warn("Same city order expire seconds config value is not a valid number, using default value: {}", defaultValue);
|
||||
return defaultValue;
|
||||
} catch (Exception e) {
|
||||
// 捕获其他可能的异常,确保方法总是返回一个有效值
|
||||
logger.error("Error getting same city order expire seconds, using default value: {}", defaultValue, e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 预处理发货订单超时消息(发到 mq 里,触发超时事件,发出推送消息)
|
||||
*
|
||||
|
||||
@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Api(tags = "门店打票机打印业务")
|
||||
@ -131,4 +130,12 @@ public class ShopStorePrinterController {
|
||||
public CommonResult clearShopPrinterQueue(@RequestParam(name = "printer_sn", required = true) String printer_sn) {
|
||||
return shopStorePrinterService.clearPrinterQueue(printer_sn);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "测试打印机打印", notes = "门店管理员测试打印机打印,确定打印机的可用性,同时观察打印实际效果。")
|
||||
@RequestMapping(value = "/tryprint", method = {RequestMethod.POST})
|
||||
public CommonResult tryPrint(@RequestParam(name = "printer_id") Long printer_id) {
|
||||
return shopStorePrinterService.tryPrint(printer_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -86,5 +86,12 @@ public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter>
|
||||
* @return
|
||||
*/
|
||||
List<ShopStorePrinter> selectPrinterList(Integer storeId);
|
||||
|
||||
/**
|
||||
* 测试打印
|
||||
*
|
||||
* @param printerId 打印机Id
|
||||
**/
|
||||
CommonResult tryPrint(Long printerId);
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ import com.suisung.mall.common.modules.store.ShopStorePrinter;
|
||||
import com.suisung.mall.common.modules.store.ShopStorePrinterLog;
|
||||
import com.suisung.mall.common.modules.store.ShopStorePrinterTemplate;
|
||||
import com.suisung.mall.common.pojo.vo.ShopStorePrinterVO;
|
||||
import com.suisung.mall.common.utils.CheckUtil;
|
||||
import com.suisung.mall.common.utils.FreeMakerUtils;
|
||||
import com.suisung.mall.common.utils.JsonUtil;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
@ -306,8 +307,8 @@ public class ShopStorePrinterServiceImpl extends BaseServiceImpl<ShopStorePrinte
|
||||
|
||||
@Override
|
||||
public Boolean printShopStoreOrder(String orderId) {
|
||||
logger.info("#### 调用飞鹅打票机的打印操作开始 ####");
|
||||
logger.info("#### 打印订单:{} ####", orderId);
|
||||
logger.debug("#### 调用飞鹅打票机的打印操作开始 ####");
|
||||
logger.debug("#### 打印订单:{} ####", orderId);
|
||||
// 获取订单,包含所有所需的字段,参考实体类:ShopStoreOrderPrintVO 和 ShopStoreOrderProductPrintVO
|
||||
|
||||
if (StrUtil.isBlank(orderId)) {
|
||||
@ -383,4 +384,60 @@ public class ShopStorePrinterServiceImpl extends BaseServiceImpl<ShopStorePrinte
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试打印
|
||||
**/
|
||||
@Override
|
||||
public CommonResult tryPrint(Long printerId) {
|
||||
logger.debug("#### 调用飞鹅打票机的打印操作开始 ####");
|
||||
|
||||
// 参数校验
|
||||
if (CheckUtil.isEmpty(printerId)) {
|
||||
return CommonResult.failed("打票机ID不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
// 获取打印机信息
|
||||
ShopStorePrinter printer = get(printerId);
|
||||
if (printer == null) {
|
||||
return CommonResult.failed("打票机信息无效");
|
||||
}
|
||||
|
||||
// 获取打印模板
|
||||
ShopStorePrinterTemplate template = shopStorePrinterTemplateService.getShopStorePrinterTemplateInner(0, StateCode.PRINTER_TEMP_CATE_ORDER);
|
||||
if (template == null) {
|
||||
return CommonResult.failed("打印模版未准备好!");
|
||||
}
|
||||
|
||||
// 检查模板必要字段
|
||||
if (StrUtil.isBlank(template.getTemplate_name()) || StrUtil.isBlank(template.getTemplate_value_def())) {
|
||||
return CommonResult.failed("打印模版内容不完整!");
|
||||
}
|
||||
|
||||
// 生成打印内容
|
||||
String printContent = FreeMakerUtils.processTemplate(template.getTemplate_name(), template.getTemplate_value_def(), null);
|
||||
if (StrUtil.isBlank(printContent)) {
|
||||
return CommonResult.failed("打印模版渲染失败!");
|
||||
}
|
||||
|
||||
// 调用打印机打印
|
||||
List<String> printerSnList = new ArrayList<>();
|
||||
printerSnList.add(printer.getPrinter_sn());
|
||||
|
||||
List<Pair<String, String>> respList = feieUtil.printContentByList(printerSnList, printContent);
|
||||
if (CollUtil.isEmpty(respList)) {
|
||||
logger.error("调用飞鹅打印机{},打印失败。", printer.getPrinter_sn());
|
||||
return CommonResult.failed("调用打印机打印失败。");
|
||||
}
|
||||
|
||||
logger.debug("#### 调用飞鹅打票机的打印操作结束 ####");
|
||||
return CommonResult.success("", "打印成功");
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("打印测试过程中发生异常,打印机ID: {}", printerId, e);
|
||||
return CommonResult.failed("打印测试失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,9 +6,11 @@ import com.suisung.mall.common.modules.store.ShopStorePrinterTemplate;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.store.mapper.ShopStorePrinterTemplateMapper;
|
||||
import com.suisung.mall.shop.store.service.ShopStorePrinterTemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ShopStorePrinterTemplateServiceImpl extends BaseServiceImpl<ShopStorePrinterTemplateMapper, ShopStorePrinterTemplate> implements ShopStorePrinterTemplateService {
|
||||
|
||||
@ -25,23 +27,37 @@ public class ShopStorePrinterTemplateServiceImpl extends BaseServiceImpl<ShopSto
|
||||
|
||||
@Override
|
||||
public ShopStorePrinterTemplate getShopStorePrinterTemplateInner(Integer storeId, Integer category) {
|
||||
if (category == null || category == 0) {
|
||||
// 参数校验
|
||||
if (category == null || category <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
QueryWrapper<ShopStorePrinterTemplate> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id", storeId);
|
||||
queryWrapper.eq("category", category);
|
||||
queryWrapper.orderByAsc("template_id");
|
||||
ShopStorePrinterTemplate shopStorePrinterTemplate = findOne(queryWrapper);
|
||||
if (shopStorePrinterTemplate == null || shopStorePrinterTemplate.getTemplate_id() <= 0) {
|
||||
queryWrapper.clear();
|
||||
queryWrapper.eq("store_id", 0);// 公共下单模版
|
||||
queryWrapper.eq("category", category);
|
||||
queryWrapper.orderByAsc("template_id");
|
||||
shopStorePrinterTemplate = findOne(queryWrapper);
|
||||
}
|
||||
try {
|
||||
// 查询店铺特定模板
|
||||
QueryWrapper<ShopStorePrinterTemplate> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id", storeId != null ? storeId : 0)
|
||||
.eq("category", category)
|
||||
.orderByAsc("template_id");
|
||||
|
||||
return shopStorePrinterTemplate;
|
||||
ShopStorePrinterTemplate shopStorePrinterTemplate = findOne(queryWrapper);
|
||||
|
||||
// 如果店铺特定模板不存在,查询公共模板
|
||||
if (shopStorePrinterTemplate == null || shopStorePrinterTemplate.getTemplate_id() <= 0) {
|
||||
queryWrapper.clear();
|
||||
queryWrapper.eq("store_id", 0)
|
||||
.eq("category", category)
|
||||
.orderByAsc("template_id");
|
||||
|
||||
shopStorePrinterTemplate = findOne(queryWrapper);
|
||||
}
|
||||
|
||||
return shopStorePrinterTemplate;
|
||||
} catch (Exception e) {
|
||||
// 记录异常日志,便于问题排查
|
||||
log.error("获取打印模板时发生异常,storeId: {}, category: {}", storeId, category, e);
|
||||
// 发生异常时返回null,确保调用方能正确处理
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -535,7 +535,8 @@
|
||||
a.order_id,a.store_id,a.store_name,a.buyer_user_id,
|
||||
a.buyer_user_name,a.order_time,a.order_payment_amount,a.order_product_amount,
|
||||
b.order_title, b.delivery_type_id, b.payment_type_id, b.payment_time, b.order_pickup_num,
|
||||
c.order_message, c.order_item_amount, c.order_shipping_fee,c.delivery_time, c.order_shipping_fee_amount,
|
||||
c.order_message, c.order_item_amount, c.order_shipping_fee, c.order_shipping_fee_amount, c.delivery_time,
|
||||
(c.order_discount_amount + c.voucher_price + c.order_points_fee + c.order_adjust_fee) as total_discount_amount,
|
||||
e.store_tel,
|
||||
f.da_province,f.da_city,f.da_address,f.da_mobile, f.order_id,
|
||||
g.payment_channel_id, h.payment_channel_name
|
||||
|
||||
@ -50,4 +50,10 @@
|
||||
|
||||
|
||||
格式化的示例:
|
||||
<CB>小发同城</CB><BR>--------------------------------<BR><CB>#00019232</CB><BR><L>买家备注:不用敲门,放在门口旁边的外卖箱,打个电话告知送达就行,谢谢!!!</L><BR><BOLD>配送时间:2024-10-25 14:00-14:30</BOLD><BR>--------------------------------<BR>订单编号:ES20231026111444527685<BR>订单来源:微信小程序<BR>支付方式:微信支付<BR>配送来源:顺丰同城<BR>付款时间:2024-10-25 14:00:23<BR>--------------------------------<BR><L>商品名称 数量 金额</L><BR>--------------------------------<BR><L>可口可乐CocaC</L> <L><BOLD> x110 </BOLD></L><L> 8100.45</L><BR><L>ola经典美味汽水1.2</L><BR><L>5L/瓶</L><BR><BOLD>6970448170051</BOLD><BR><L>排骨约350g(默 </L><L><BOLD> 1 </BOLD></L><L> 150.13 </L><BR><L>认砍小块)</L><BR><BOLD>6970448170053</BOLD><BR><L>新鲜虫草花1包约2 </L><L><BOLD> x11 </BOLD></L><L> 4.01 </L><BR><L>00g 韭菜1000g 鸡蛋</L><BR><L>2003克</L><BR><BOLD>6970448170054</BOLD><BR><L>冰红茶风味饮料 <L><BOLD> 1 </BOLD></L><L> 13.24 </L></L><BR><BOLD>6970448170055</BOLD><BR>--------------------------------<BR>商品总件数:<BOLD>3</BOLD><BR>商品总额:<BOLD>¥18.7</BOLD><BR>押金:<BOLD>¥500</BOLD><BR>运费:<BOLD>¥5.54</BOLD><BR>会员权益:<BOLD>-¥50</BOLD><BR>秒杀:<BOLD>-¥100</BOLD><BR>实付金额:<BOLD>¥428.9元</BOLD><BR>--------------------------------<BR><BOLD>商家备注:老顾客赠送一箱牛奶;玻璃瓶包装轻拿轻放!</BOLD><BR>--------------------------------<BR><BOLD>收货人:张三</BOLD><BR><BOLD>收货人手机:13128778765</BOLD><BR><BOLD>收货地址:北京市朝阳区朝阳路朝阳人民小区1号楼1栋1101</BOLD><BR>--------------------------------<BR>门店:岛内价生活超市<BR>门店电话:<BOLD>13665822542</BOLD><BR>收银员:李小璐<BR>
|
||||
<CB>小发同城</CB><BR>--------------------------------<BR><CB>#00019232</CB><BR><L>买家备注:不用敲门,放在门口旁边的外卖箱,打个电话告知送达就行,谢谢!!!</L><BR><BOLD>配送时间:2024-10-25 14:00-14:30</BOLD><BR>--------------------------------<BR>订单编号:ES20231026111444527685<BR>订单来源:微信小程序<BR>支付方式:微信支付<BR>配送来源:顺丰同城<BR>付款时间:2024-10-25 14:00:23<BR>--------------------------------<BR><L>商品名称 数量 金额</L><BR>--------------------------------<BR><L>可口可乐CocaC</L> <L><BOLD> x110 </BOLD></L><L> 8100.45</L><BR><L>ola经典美味汽水1.2</L><BR><L>5L/瓶</L><BR><BOLD>6970448170051</BOLD><BR><L>排骨约350g(默 </L><L><BOLD> 1 </BOLD></L><L> 150.13 </L><BR><L>认砍小块)</L><BR><BOLD>6970448170053</BOLD><BR><L>新鲜虫草花1包约2 </L><L><BOLD> x11 </BOLD></L><L> 4.01 </L><BR><L>00g 韭菜1000g 鸡蛋</L><BR><L>2003克</L><BR><BOLD>6970448170054</BOLD><BR><L>冰红茶风味饮料 <L><BOLD> 1 </BOLD></L><L> 13.24 </L></L><BR><BOLD>6970448170055</BOLD><BR>--------------------------------<BR>商品总件数:<BOLD>3</BOLD><BR>商品总额:<BOLD>¥18.7</BOLD><BR>押金:<BOLD>¥500</BOLD><BR>运费:<BOLD>¥5.54</BOLD><BR>会员权益:<BOLD>-¥50</BOLD><BR>秒杀:<BOLD>-¥100</BOLD><BR>实付金额:<BOLD>¥428.9元</BOLD><BR>--------------------------------<BR><BOLD>商家备注:老顾客赠送一箱牛奶;玻璃瓶包装轻拿轻放!</BOLD><BR>--------------------------------<BR><BOLD>收货人:张三</BOLD><BR><BOLD>收货人手机:13128778765</BOLD><BR><BOLD>收货地址:北京市朝阳区朝阳路朝阳人民小区1号楼1栋1101</BOLD><BR>--------------------------------<BR>门店:岛内价生活超市<BR>门店电话:<BOLD>13665822542</BOLD><BR>收银员:李小璐<BR>
|
||||
|
||||
第一版带变量的模版:
|
||||
<CB>${store_name}</CB><BR>--------------------------------<BR><CB>#${order_pickup_num_str}</CB><BR><L>买家备注:${order_message!'-'}</L><BR><BOLD>配送时间:${payment_time?string('MM-dd HH:mm')}~${delivery_time?string('HH:mm')}</BOLD><BR>--------------------------------<BR>订单编号:${order_id}<BR>订单来源:微信小程序<BR>支付方式:微信支付<BR>配送来源:顺丰同城<BR>付款时间:${payment_time?string('yyyy-MM-dd HH:mm:ss')}<BR>--------------------------------<BR><L>商品名称 数量 金额</L><BR>--------------------------------<BR><#list order_items as item><L>${item.s_name}</L><L><BOLD>${item.s_quantity}</BOLD></L><L>${item.s_amount}</L><BR><#if item.s_name_segs??><#list item.s_name_segs as seg><L>${seg}</L><BR></#list></#if><BOLD><#if item.product_sn?default("")?trim?length gt 1>${item.product_sn}</BOLD><BR></#if></#list>--------------------------------<BR>商品总件数:<BOLD>${order_items_count!0}</BOLD><BR>商品总额:<BOLD>¥${order_product_amount?string('0.00')}</BOLD><BR>押金:<BOLD>¥${(yajin!0)?string('0.00')}</BOLD><BR>运费:<BOLD>¥${order_shipping_fee?string('0.00')}</BOLD><BR>会员权益:<BOLD>-¥${(quanyi!0)?string('0.00')}</BOLD><BR>秒杀:<BOLD>-¥${(miaosha!0)?string('0.00')}</BOLD><BR>实付金额:<BOLD>¥${order_payment_amount?string('0.00')}</BOLD><BR><#if seller_message?default("")?trim?length gt 1>--------------------------------<BR><BOLD>商家备注:${seller_message!'-'}</BOLD><BR></#if>--------------------------------<BR><BOLD>收货人:${buyer_user_name!''}</BOLD><BR><BOLD>收货人手机:${da_mobile!'-'}</BOLD><BR><BOLD>收货地址:${da_province!'-'}${da_city!'-'}${da_address!'-'}</BOLD><BR>--------------------------------<BR>门店:${store_name}<BR>门店电话:<BOLD>${store_tel!'-'}</BOLD><BR>收银员:${cashier!'店长'}<BR>
|
||||
|
||||
第二版带变量的模版:
|
||||
<CB>${store_name}</CB><BR>--------------------------------<BR><CB>#${order_pickup_num_str}</CB><BR><L>买家备注:${order_message!'-'}</L><BR><BOLD>配送时间:${payment_time?string('MM-dd HH:mm')}~${delivery_time?string('HH:mm')}</BOLD><BR>--------------------------------<BR>订单编号:${order_id}<BR>订单来源:微信小程序<BR>支付方式:微信支付<BR>配送来源:顺丰同城<BR>付款时间:${payment_time?string('yyyy-MM-dd HH:mm:ss')}<BR>--------------------------------<BR><L>商品名称 数量 金额</L><BR>--------------------------------<BR><#list order_items as item><L>${item.s_name}</L><L><BOLD>${item.s_quantity}</BOLD></L><L>${item.s_amount}</L><BR><#if item.s_name_segs??><#list item.s_name_segs as seg><L>${seg}</L><BR></#list></#if><BOLD><#if item.product_sn?default("")?trim?length gt 1>${item.product_sn}</BOLD><BR></#if></#list>--------------------------------<BR>商品总件数:<BOLD>${order_items_count!0}</BOLD><BR>商品总额:<BOLD>¥${order_product_amount?string('0.00')}</BOLD><BR>运费:<BOLD>¥${order_shipping_fee?string('0.00')}</BOLD><BR>优惠金额:<BOLD>-¥${(quanyi!0)?string('0.00')}</BOLD><BR>实付金额:<BOLD>¥${order_payment_amount?string('0.00')}</BOLD><BR><#if seller_message?default("")?trim?length gt 1>--------------------------------<BR><BOLD>商家备注:${seller_message!'-'}</BOLD><BR></#if>--------------------------------<BR><BOLD>收货人:${buyer_user_name!''}</BOLD><BR><BOLD>收货人手机:${da_mobile!'-'}</BOLD><BR><BOLD>收货地址:${da_province!'-'}${da_city!'-'}${da_address!'-'}</BOLD><BR>--------------------------------<BR>门店:${store_name}<BR>门店电话:<BOLD>${store_tel!'-'}</BOLD><BR>收银员:${cashier!'店长'}<BR>
|
||||
Loading…
Reference in New Issue
Block a user