202507111736

This commit is contained in:
张潘 2025-07-11 17:37:03 +08:00
parent 3b07de8287
commit 29bce55a07
34 changed files with 3178 additions and 122 deletions

View File

@ -7,6 +7,7 @@ import com.ruoyi.system.ControllerUtil.AppletControllerUtil;
import com.ruoyi.system.ControllerUtil.AppletLoginUtil;
import com.ruoyi.system.ControllerUtil.InvoiceUtil;
import com.ruoyi.system.domain.Users;
import com.ruoyi.system.domain.UsersInvoiceInfo;
import com.ruoyi.system.service.IUsersService;
import com.ruoyi.system.service.IUsersInvoiceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -458,4 +459,47 @@ public class AppleInvoiceController extends BaseController {
return AppletControllerUtil.appletError("删除发票信息失败:" + e.getMessage());
}
}
/**
* 根据发票ID获取发票详情
* @param id 发票ID
* @param request HTTP请求对象
* @return 发票详情
*/
@GetMapping("/detail/{id}")
public Object getInvoiceDetail(@PathVariable("id") Integer id, HttpServletRequest request) {
try {
String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletUnauthorized();
}
UsersInvoiceInfo invoiceInfo = usersInvoiceInfoService.selectUsersInvoiceInfoById(id);
if (invoiceInfo == null) {
return AppletControllerUtil.appletWarning("未找到该发票信息");
}
// 只返回指定字段
Map<String, Object> data = new java.util.HashMap<>();
data.put("id", invoiceInfo.getId());
data.put("uid", invoiceInfo.getUid());
data.put("invoiceTitle", invoiceInfo.getInvoiceTitle());
data.put("taxNumber", invoiceInfo.getTaxNumber());
data.put("bankName", invoiceInfo.getBankName());
data.put("bankAccount", invoiceInfo.getBankAccount());
data.put("address", invoiceInfo.getAddress());
data.put("phone", invoiceInfo.getPhone());
data.put("email", invoiceInfo.getEmail());
data.put("wechat", invoiceInfo.getWechat());
data.put("type", invoiceInfo.getType());
data.put("category", invoiceInfo.getCategory());
data.put("invoicemoney", invoiceInfo.getInvoicemoney());
data.put("invoicetext", invoiceInfo.getInvoicetext());
data.put("orderid", invoiceInfo.getOrderid());
data.put("status", invoiceInfo.getStatus());
data.put("filedata", invoiceInfo.getFiledata());
return AppletControllerUtil.appletSuccess(data);
} catch (Exception e) {
return AppletControllerUtil.appletError("获取发票详情失败:" + e.getMessage());
}
}
}

View File

@ -726,61 +726,7 @@ public class AppleMemberController extends BaseController {
}
}
/**
* 获取次卡列表支持分页
*
* 查询用户次卡列表支持按类型筛选和分页
* 每个次卡会包含对应的服务商品详情
*
* @param params 查询参数page, limit, type
* @param request HTTP请求对象
* @return 次卡列表分页格式
*/
@PostMapping("/secondary/card/list")
public AjaxResult getSecondaryCardList(@RequestBody Map<String, Object> params, HttpServletRequest request) {
try {
// 1. 获取并验证分页参数
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 15;
Map<String, Object> pageValidation = PageUtil.validatePageParams(page, limit);
if (!(Boolean) pageValidation.get("valid")) {
return AppletControllerUtil.appletWarning((String) pageValidation.get("message"));
}
// 2. 获取type参数
Long type = params.get("type") != null ? Long.parseLong(params.get("type").toString()) : null;
// 3. 创建查询对象
UserSecondaryCard queryParams = new UserSecondaryCard();
queryParams.setStatus(1L); // 只查询状态为1的数据
if (type != null) {
queryParams.setType(type);
}
// 4. 设置分页参数
PageHelper.startPage(page, limit);
// 5. 执行查询
List<UserSecondaryCard> list = userSecondaryCardService.selectUserSecondaryCardList(queryParams);
// 6. 为每个次卡填充服务商品详情
for (UserSecondaryCard card : list) {
List<String> idsList = com.alibaba.fastjson2.JSONArray.parseArray(card.getGoodsids(), String.class);
card.setServiceDetail(serviceGoodsService.selectServiceGoodsfrocikaList(idsList));
}
// 7. 获取分页信息并构建响应
TableDataInfo tableDataInfo = getDataTable(list);
Map<String, Object> pageData = PageUtil.buildPageResponse(tableDataInfo, page, limit);
return AppletControllerUtil.appletSuccess(pageData);
} catch (Exception e) {
System.err.println("查询次卡列表异常:" + e.getMessage());
return AppletControllerUtil.appletError("获取次卡列表失败:" + e.getMessage());
}
}
// ==================== 师傅报价相关接口 ====================

View File

@ -0,0 +1,655 @@
package com.ruoyi.system.controller;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.ControllerUtil.AppletControllerUtil;
import com.ruoyi.system.ControllerUtil.AppletLoginUtil;
import com.ruoyi.system.ControllerUtil.GenerateCustomCode;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 苹果订单控制器
*
* @author ruoyi
* @date 2025-01-26
*/
@RestController
public class AppleOrderController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AppleOrderController.class);
@Autowired
private IUsersService usersService;
@Autowired
private IServiceGoodsService serviceGoodsService;
@Autowired
private IUserAddressService userAddressService;
@Autowired
private ICouponUserService couponUserService;
@Autowired
private IOrderService orderService;
@Autowired
private IUserGroupBuyingService userGroupBuyingService;
@Autowired
private IUsersPayBeforService usersPayBeforService;
@Autowired
private IOrderLogService orderLogService;
@Autowired
private IUserUseSecondaryCardService userUseSecondaryCardService;
/**
* 通用订单预支接口
*
* 创建订单但不执行支付将订单状态设置为未支付并在预支付表中记录支付信息
*
* @param params 预支付参数
* @param request HTTP请求对象
* @return 预支付结果
*
* 请求参数说明
* - id: 产品或次卡主键ID必填
* - sku: 购买的规格可选
* - ordertype: 订单类别 1=拼团 2=次卡 3=秒杀 4=报价 0=普通预约必填
* - address_id: 地址ID可选
* - num: 购买数量可选默认1
* - make_time: 预约时间可选格式yyyy-MM-dd HH:mm
* - attachments: 附件数组可选最多9个附件
*/
@PostMapping("/api/universal/order/presupport")
@Log(title = "订单预支", businessType = BusinessType.INSERT)
public AjaxResult universalOrderPresupport(@RequestBody Map<String, Object> params, HttpServletRequest request) {
try {
// 1. 验证用户登录状态
String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletWarning("用户未登录或token无效");
}
Users user = (Users) userValidation.get("user");
if (user == null) {
return AppletControllerUtil.appletWarning("用户信息获取失败");
}
// 2. 验证必填参数
if (params == null || params.isEmpty()) {
return AppletControllerUtil.appletWarning("参数不能为空");
}
if (params.get("id") == null) {
return AppletControllerUtil.appletWarning("产品ID不能为空");
}
if (params.get("ordertype") == null) {
return AppletControllerUtil.appletWarning("订单类别不能为空");
}
// 3. 解析参数
Long productId = Long.valueOf(params.get("id").toString());
Integer ordertype = Integer.valueOf(params.get("ordertype").toString());
String sku = params.get("sku") != null ? params.get("sku").toString() : "";
Long addressId = params.get("address_id") != null ? Long.valueOf(params.get("address_id").toString()) : null;
Integer num = params.get("num") != null ? Integer.valueOf(params.get("num").toString()) : 1;
String makeTime = params.get("make_time") != null ? params.get("make_time").toString() : "";
// 处理附件数组
String attachments = "";
if (params.get("attachments") != null) {
try {
@SuppressWarnings("unchecked")
List<String> attachmentList = (List<String>) params.get("attachments");
if (attachmentList != null && !attachmentList.isEmpty()) {
// 限制最多9个附件
if (attachmentList.size() > 9) {
return AppletControllerUtil.appletWarning("附件数量不能超过9个");
}
attachments = String.join(",", attachmentList);
}
} catch (Exception e) {
logger.warn("附件参数解析失败: " + e.getMessage());
attachments = "";
}
}
// 4. 验证订单类型
if (ordertype < 0 || ordertype > 4) {
return AppletControllerUtil.appletWarning("订单类别无效0=普通预约 1=拼团 2=次卡 3=秒杀 4=报价");
}
// 5. 查询商品信息
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(productId);
if (serviceGoods == null) {
return AppletControllerUtil.appletWarning("商品不存在");
}
// 6. 查询地址信息如果提供了地址ID
UserAddress userAddress = null;
if (addressId != null) {
userAddress = userAddressService.selectUserAddressById(addressId);
if (userAddress == null) {
return AppletControllerUtil.appletWarning("地址不存在");
}
}
// 7. 根据订单类型创建相应的订单
Map<String, Object> orderResult = createOrderByType(
ordertype, user, serviceGoods, userAddress, sku, num,
makeTime, null, BigDecimal.ZERO, BigDecimal.ZERO, "", "", attachments
);
if (!(Boolean) orderResult.get("success")) {
return AppletControllerUtil.appletWarning((String) orderResult.get("message"));
}
// 8. 获取订单信息
String orderId = (String) orderResult.get("orderId");
Long oid = (Long) orderResult.get("oid");
BigDecimal totalAmount = (BigDecimal) orderResult.get("totalAmount");
// 如果是报价订单直接返回结果不插入UsersPayBefor
if (ordertype == 4) {
Map<String, Object> result = new HashMap<>();
result.put("orderId", orderId);
result.put("oid", oid);
result.put("totalAmount", totalAmount);
result.put("orderType", ordertype);
result.put("attachments", attachments);
return AppletControllerUtil.appletSuccess(result);
}
// 9. 创建预支付记录
UsersPayBefor usersPayBefor = new UsersPayBefor();
usersPayBefor.setUid(user.getId());
usersPayBefor.setOrderid(orderId);
usersPayBefor.setOid(oid);
usersPayBefor.setPaycode(GenerateCustomCode.generCreateOrder("PAY"));
usersPayBefor.setAllmoney(totalAmount);
usersPayBefor.setWxmoney(totalAmount);
usersPayBefor.setYemoney(BigDecimal.ZERO);
usersPayBefor.setCouponmoney(BigDecimal.ZERO);
usersPayBefor.setMembermoney(BigDecimal.ZERO);
usersPayBefor.setType(Long.valueOf(ordertype));
usersPayBefor.setStatus(1L); // 1=待支付
usersPayBefor.setPaytype(1L); // 默认微信支付
int payBeforResult = usersPayBeforService.insertUsersPayBefor(usersPayBefor);
if (payBeforResult <= 0) {
return AppletControllerUtil.appletWarning("预支付记录创建失败");
}
// 10. 返回预支付信息
Map<String, Object> result = new HashMap<>();
result.put("orderId", orderId);
result.put("oid", oid);
result.put("payBeforId", usersPayBefor.getId());
result.put("paycode", usersPayBefor.getPaycode());
result.put("totalAmount", totalAmount);
result.put("wxMoney", totalAmount);
result.put("yeMoney", BigDecimal.ZERO);
result.put("couponMoney", BigDecimal.ZERO);
result.put("memberMoney", BigDecimal.ZERO);
result.put("orderType", ordertype);
result.put("attachments", attachments);
return AppletControllerUtil.appletSuccess(result);
} catch (Exception e) {
logger.error("订单预支付创建失败:", e);
return AppletControllerUtil.appletError("订单预支付创建失败:" + e.getMessage());
}
}
/**
* 根据订单类型创建相应的订单
*/
private Map<String, Object> createOrderByType(Integer ordertype, Users user, ServiceGoods serviceGoods,
UserAddress userAddress, String sku, Integer num, String makeTime,
CouponUser couponUser, BigDecimal couponDiscount,
BigDecimal memberMoney, String mtcode, String ptcode, String attachments) {
Map<String, Object> result = new HashMap<>();
try {
switch (ordertype) {
case 0: // 普通预约
return createNormalOrder(user, serviceGoods, userAddress, sku, num, makeTime, couponUser, couponDiscount, memberMoney, mtcode, attachments);
case 1: // 拼团
return createGroupBuyingOrder(user, serviceGoods, sku, num, couponUser, couponDiscount, memberMoney, mtcode, ptcode, attachments);
case 2: // 次卡
return createCardOrder(user, serviceGoods, userAddress, sku, num, makeTime, couponUser, couponDiscount, memberMoney, mtcode, attachments);
case 3: // 秒杀
return createSeckillOrder(user, serviceGoods, userAddress, sku, num, makeTime, couponUser, couponDiscount, memberMoney, mtcode, attachments);
case 4: // 报价
return createQuoteOrder(user, serviceGoods, userAddress, sku, num, makeTime, couponUser, couponDiscount, memberMoney, mtcode, attachments);
default:
result.put("success", false);
result.put("message", "不支持的订单类型");
return result;
}
} catch (Exception e) {
logger.error("创建订单失败:", e);
result.put("success", false);
result.put("message", "创建订单失败:" + e.getMessage());
return result;
}
}
/**
* 创建普通预约订单
* 1预约 2报价 3一口价 4拼团 5普通订单
*/
private Map<String, Object> createNormalOrder(Users user, ServiceGoods serviceGoods, UserAddress userAddress,
String sku, Integer num, String makeTime, CouponUser couponUser,
BigDecimal couponDiscount, BigDecimal memberMoney, String mtcode, String attachments) {
Map<String, Object> result = new HashMap<>();
try {
// 计算订单金额
BigDecimal itemPrice = serviceGoods.getPrice().multiply(BigDecimal.valueOf(num));
// 生成订单号
String orderId = GenerateCustomCode.generCreateOrder("N");
// 创建普通预约订单统一使用服务订单表
Order order = new Order();
order.setNum(Long.valueOf(num));
order.setType(1); // 普通预约订单
order.setCreateType(1); // 用户自主下单
order.setOrderId(orderId);
order.setUid(user.getId());
order.setUname(user.getName());
order.setProductId(serviceGoods.getId());
order.setProductName(serviceGoods.getTitle());
order.setSku(sku);
if (userAddress != null) {
order.setAddressId(userAddress.getId());
order.setName(userAddress.getName());
order.setPhone(userAddress.getPhone());
order.setAddress(userAddress.getAddressInfo());
}
// 处理预约时间
if (makeTime != null && !makeTime.isEmpty()) {
String[] makeTimeArr = makeTime.split(" ");
if (makeTimeArr.length == 2) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(makeTimeArr[0]);
order.setMakeTime(date.getTime() / 1000);
order.setMakeHour(makeTimeArr[1]);
} catch (Exception e) {
logger.warn("预约时间格式错误: " + makeTime);
}
}
}
order.setTotalPrice(itemPrice);
order.setGoodPrice(serviceGoods.getPrice());
order.setServicePrice(BigDecimal.ZERO);
order.setPayPrice(itemPrice);
order.setStatus(1L); // 待支付
order.setReceiveType(1L); // 自由抢单
order.setIsAccept(0);
order.setIsComment(0);
order.setIsPause(1);
order.setDeduction(couponDiscount.add(memberMoney));
order.setFileData(attachments); // 设置附件数据
order.setType(1);
int insertResult = orderService.insertOrder(order);
if (insertResult <= 0) {
result.put("success", false);
result.put("message", "普通预约订单创建失败");
return result;
}
// 添加订单日志
OrderLog orderLog = new OrderLog();
orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId());
orderLog.setTitle("订单生成");
orderLog.setType(BigDecimal.valueOf(1.0));
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "订单创建成功");
orderLog.setContent(jsonObject.toJSONString());
orderLog.setRemark("订单预支付创建");
orderLogService.insertOrderLog(orderLog);
result.put("success", true);
result.put("orderId", orderId);
result.put("oid", order.getId());
result.put("totalAmount", itemPrice);
return result;
} catch (Exception e) {
logger.error("创建普通预约订单失败:", e);
result.put("success", false);
result.put("message", "创建普通预约订单失败:" + e.getMessage());
return result;
}
}
/**
* 创建拼团订单
*/
private Map<String, Object> createGroupBuyingOrder(Users user, ServiceGoods serviceGoods, String sku, Integer num,
CouponUser couponUser, BigDecimal couponDiscount,
BigDecimal memberMoney, String mtcode, String ptcode, String attachments) {
Map<String, Object> result = new HashMap<>();
try {
// 验证拼团价格
if (serviceGoods.getGroupprice() == null) {
result.put("success", false);
result.put("message", "该商品不支持拼团");
return result;
}
// 计算订单金额
BigDecimal itemPrice = serviceGoods.getGroupprice().multiply(BigDecimal.valueOf(num));
// 处理拼团单号
String finalPtcode = ptcode;
if (finalPtcode == null || finalPtcode.trim().isEmpty()) {
// 如果没有提供拼团单号生成新的拼团单号
finalPtcode = GenerateCustomCode.generCreateOrder("PT");
}
// 创建拼团订单预支付状态
UserGroupBuying userGroupBuying = new UserGroupBuying();
userGroupBuying.setOrderid(finalPtcode); // 使用拼团单号作为订单号
userGroupBuying.setUid(user.getId());
userGroupBuying.setUname(user.getName());
userGroupBuying.setProductId(serviceGoods.getId());
userGroupBuying.setMoney(itemPrice);
userGroupBuying.setStatus(1L); // 待支付
userGroupBuying.setPaystatus(1L); // 待支付
userGroupBuying.setPaytype(1L); // 默认微信支付
userGroupBuying.setDeduction(couponDiscount.add(memberMoney));
int insertResult = userGroupBuyingService.insertUserGroupBuying(userGroupBuying);
if (insertResult <= 0) {
result.put("success", false);
result.put("message", "拼团订单创建失败");
return result;
}
// 预支付接口不需要检查拼团人数只需要记录预支付信息
result.put("success", true);
result.put("orderId", finalPtcode);
result.put("oid", userGroupBuying.getId());
result.put("totalAmount", itemPrice);
return result;
} catch (Exception e) {
logger.error("创建拼团订单失败:", e);
result.put("success", false);
result.put("message", "创建拼团订单失败:" + e.getMessage());
return result;
}
}
/**
* 创建次卡订单
*/
private Map<String, Object> createCardOrder(Users user, ServiceGoods serviceGoods, UserAddress userAddress,
String sku, Integer num, String makeTime, CouponUser couponUser,
BigDecimal couponDiscount, BigDecimal memberMoney, String mtcode, String attachments) {
Map<String, Object> result = new HashMap<>();
try {
// 计算订单金额
BigDecimal itemPrice = serviceGoods.getPrice().multiply(BigDecimal.valueOf(num));
// 生成订单号
String orderId = GenerateCustomCode.generCreateOrder("C");
// 创建次卡使用记录
UserUseSecondaryCard card = new UserUseSecondaryCard();
card.setUid(user.getId());
card.setCarid(String.valueOf(serviceGoods.getId())); // 假设商品ID即为次卡ID
card.setGoodsids(String.valueOf(serviceGoods.getId())); // 如有多个服务ID可调整
card.setNum(Long.valueOf(num));
card.setUsenum(0L);
card.setOrderid(orderId);
card.setTransactionId("");
card.setPaymoney(itemPrice);
card.setStatus(4L); // 1可用 2已用完 3已退款 4未支付
card.setRemark(attachments); // 附件信息存remark
int insertResult = userUseSecondaryCardService.insertUserUseSecondaryCard(card);
if (insertResult <= 0) {
result.put("success", false);
result.put("message", "次卡订单创建失败");
return result;
}
result.put("success", true);
result.put("orderId", orderId);
result.put("oid", card.getId());
result.put("totalAmount", itemPrice);
return result;
} catch (Exception e) {
logger.error("创建次卡订单失败:", e);
result.put("success", false);
result.put("message", "创建次卡订单失败:" + e.getMessage());
return result;
}
}
/**
* 创建秒杀订单
*/
private Map<String, Object> createSeckillOrder(Users user, ServiceGoods serviceGoods, UserAddress userAddress,
String sku, Integer num, String makeTime, CouponUser couponUser,
BigDecimal couponDiscount, BigDecimal memberMoney, String mtcode, String attachments) {
Map<String, Object> result = new HashMap<>();
try {
// 验证秒杀价格
if (serviceGoods.getFixedprice() == null) {
result.put("success", false);
result.put("message", "该商品不支持秒杀");
return result;
}
// 计算订单金额
BigDecimal itemPrice = serviceGoods.getFixedprice().multiply(BigDecimal.valueOf(num));
// 生成订单号
String orderId = GenerateCustomCode.generCreateOrder("S");
// 创建秒杀订单使用服务订单表
Order order = new Order();
order.setType(3); // 秒杀类型
order.setCreateType(1); // 用户自主下单
order.setOrderId(orderId);
order.setUid(user.getId());
order.setUname(user.getName());
order.setProductId(serviceGoods.getId());
order.setProductName(serviceGoods.getTitle());
order.setSku(sku);
order.setNum(Long.valueOf(num));
if (userAddress != null) {
order.setAddressId(userAddress.getId());
order.setName(userAddress.getName());
order.setPhone(userAddress.getPhone());
order.setAddress(userAddress.getAddressInfo());
}
// 处理预约时间
if (makeTime != null && !makeTime.isEmpty()) {
String[] makeTimeArr = makeTime.split(" ");
if (makeTimeArr.length == 2) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(makeTimeArr[0]);
order.setMakeTime(date.getTime() / 1000);
order.setMakeHour(makeTimeArr[1]);
} catch (Exception e) {
logger.warn("预约时间格式错误: " + makeTime);
}
}
}
order.setTotalPrice(itemPrice);
order.setGoodPrice(serviceGoods.getFixedprice());
order.setServicePrice(BigDecimal.ZERO);
order.setPayPrice(itemPrice);
order.setStatus(1L); // 待支付
order.setReceiveType(1L); // 自由抢单
order.setIsAccept(0);
order.setIsComment(0);
order.setIsPause(1);
order.setDeduction(couponDiscount.add(memberMoney));
order.setFileData(attachments); // 设置附件数据
order.setType(1);
int insertResult = orderService.insertOrder(order);
if (insertResult <= 0) {
result.put("success", false);
result.put("message", "秒杀订单创建失败");
return result;
}
// 添加订单日志
OrderLog orderLog = new OrderLog();
orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId());
orderLog.setTitle("秒杀订单生成");
orderLog.setContent("用户创建秒杀订单");
orderLog.setRemark("订单预支付创建");
orderLogService.insertOrderLog(orderLog);
result.put("success", true);
result.put("orderId", orderId);
result.put("oid", order.getId());
result.put("totalAmount", itemPrice);
return result;
} catch (Exception e) {
logger.error("创建秒杀订单失败:", e);
result.put("success", false);
result.put("message", "创建秒杀订单失败:" + e.getMessage());
return result;
}
}
/**
* 创建报价订单
*/
private Map<String, Object> createQuoteOrder(Users user, ServiceGoods serviceGoods, UserAddress userAddress,
String sku, Integer num, String makeTime, CouponUser couponUser,
BigDecimal couponDiscount, BigDecimal memberMoney, String mtcode, String attachments) {
Map<String, Object> result = new HashMap<>();
try {
// 计算订单金额
BigDecimal itemPrice = serviceGoods.getPrice().multiply(BigDecimal.valueOf(num));
// 生成订单号
String orderId = GenerateCustomCode.generCreateOrder("Q");
// 创建报价订单使用服务订单表
Order order = new Order();
order.setType(4); // 报价订单
order.setCreateType(1); // 用户自主下单
order.setOrderId(orderId);
order.setUid(user.getId());
order.setUname(user.getName());
order.setProductId(serviceGoods.getId());
order.setProductName(serviceGoods.getTitle());
order.setSku(sku);
order.setType(1);
order.setNum(Long.valueOf(num));
if (userAddress != null) {
order.setAddressId(userAddress.getId());
order.setName(userAddress.getName());
order.setPhone(userAddress.getPhone());
order.setAddress(userAddress.getAddressInfo());
}
// 处理预约时间
if (makeTime != null && !makeTime.isEmpty()) {
String[] makeTimeArr = makeTime.split(" ");
if (makeTimeArr.length == 2) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(makeTimeArr[0]);
order.setMakeTime(date.getTime() / 1000);
order.setMakeHour(makeTimeArr[1]);
} catch (Exception e) {
logger.warn("预约时间格式错误: " + makeTime);
}
}
}
//order.setNum(num);
order.setTotalPrice(itemPrice);
order.setGoodPrice(serviceGoods.getPrice());
order.setServicePrice(BigDecimal.ZERO);
order.setPayPrice(itemPrice);
order.setStatus(1L); // 待支付
order.setReceiveType(1L); // 自由抢单
order.setIsAccept(0);
order.setIsComment(0);
order.setIsPause(1);
order.setDeduction(couponDiscount.add(memberMoney));
order.setFileData(attachments); // 设置附件数据
int insertResult = orderService.insertOrder(order);
if (insertResult <= 0) {
result.put("success", false);
result.put("message", "报价订单创建失败");
return result;
}
// 添加订单日志
OrderLog orderLog = new OrderLog();
orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId());
orderLog.setTitle("报价订单生成");
orderLog.setContent("用户创建报价订单");
orderLog.setRemark("订单预支付创建");
orderLogService.insertOrderLog(orderLog);
result.put("success", true);
result.put("orderId", orderId);
result.put("oid", order.getId());
result.put("totalAmount", itemPrice);
return result;
} catch (Exception e) {
logger.error("创建报价订单失败:", e);
result.put("success", false);
result.put("message", "创建报价订单失败:" + e.getMessage());
return result;
}
}
}

View File

@ -1281,4 +1281,894 @@ public class ApplePayController extends BaseController {
}
}
/**
* 上门费支付接口
* <p>
* 用于支付服务订单的上门费用
* <p>
* 业务逻辑
* 1. 验证用户登录状态
* 2. 根据订单日志ID获取上门费信息
* 3. 调用微信支付
* 4. 返回支付参数
*
* @param params 请求参数包含id(订单日志ID)
* @param request HTTP请求对象需要包含token
* @return 支付结果包含prepayId等微信支付参数
*/
@PostMapping("/service/activity/pay")
public AjaxResult activitypay(@RequestBody Map<String, Object> params, HttpServletRequest request) {
try {
// 1. 验证用户登录状态
String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletWarning("用户未登录或token无效");
}
// 2. 获取用户信息
Users user = (Users) userValidation.get("user");
if (user == null) {
return AppletControllerUtil.appletWarning("用户信息获取失败");
}
// 3. 验证必要参数
if (params == null || params.get("id") == null) {
return AppletControllerUtil.appletWarning("订单参数不能为空");
}
// 3. 验证必要参数
if (params.get("type") == null) {
return AppletControllerUtil.appletWarning("付款类型参数不能为空");
}
Long type = Long.valueOf(params.get("type").toString());
Long id = Long.valueOf(params.get("id").toString());
// 1查拼团 2查次卡 3查秒杀 4查报价
if (type == 1){//拼团
//没有订单ID就是创建
if (params.get("orderid") == null){
}else{
}
}
// 4. 获取订单日志信息
Long orderId = Long.valueOf(params.get("id").toString());
OrderLog orderLog = orderLogService.selectOrderLogById(orderId);
if (orderLog != null) {
logger.info("上门费支付 - 用户ID: {}, 订单日志ID: {}, 上门费: {}",
user.getId(), orderId, orderLog.getPrice());
// 5. 调用微信支付测试环境使用0.01元
Map<String, Object> payResult = wechatPayUtil.createBatchOrderAndPay(
user.getOpenid(),
String.valueOf(orderLog.getId()),
new BigDecimal("0.01"), // 测试金额
1,
WechatPayUtil.PAY_FH + "api/door/fee/pay/notify");
if (payResult != null && Boolean.TRUE.equals(payResult.get("success"))) {
// 6. 构建支付响应数据
Map<String, Object> responseData = new HashMap<>();
responseData.put("mainOrderId", String.valueOf(orderLog.getId()));
responseData.put("totalAmount", orderLog.getPrice());
responseData.put("prepayId", payResult.get("prepayId"));
// 合并所有支付参数
responseData.putAll(payResult);
return AppletControllerUtil.appletSuccess(responseData);
} else {
String errorMsg = payResult != null ? (String) payResult.get("message") : "微信支付下单失败";
return AppletControllerUtil.appletWarning("支付下单失败:" + errorMsg);
}
} else {
return AppletControllerUtil.appletWarning("订单日志不存在");
}
} catch (Exception e) {
logger.error("上门费支付异常 - 用户ID: {}, 参数: {}, 异常: {}",
request.getHeader("token"), params, e.getMessage());
return AppletControllerUtil.appletError("支付失败:" + e.getMessage());
}
}
// /**
// * 通用订单支付接口
// *
// * 支持多种订单类型和支付方式的统一支付接口
// *
// * @param params 支付参数
// * @param request HTTP请求对象
// * @return 支付结果
// *
// * 请求参数说明
// * - id: 产品或次卡主键ID必填
// * - sku: 购买的规格可选
// * - paytype: 支付类型 1=微信支付 2=余额支付 3=组合支付必填
// * - ordertype: 订单类别 1=拼团 2=次卡 3=秒杀 4=报价 0=普通预约必填
// * - coupon_id: 优惠券ID可选
// * - address_id: 地址ID可选
// * - mtcode: 美团核销码可选
// * - membermoney: 会员优惠金额可选
// * - num: 购买数量可选默认1
// * - make_time: 预约时间可选格式yyyy-MM-dd HH:mm
// * - wechat_pay_amount: 微信支付金额组合支付时必填
// * - balance_pay_amount: 余额支付金额组合支付时必填
// */
// @PostMapping("/api/universal/order/pay")
// public AjaxResult universalOrderPay(@RequestBody Map<String, Object> params, HttpServletRequest request) {
// try {
// // 1. 验证用户登录状态
// String token = request.getHeader("token");
// Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
// if (!(Boolean) userValidation.get("valid")) {
// return AppletControllerUtil.appletWarning("用户未登录或token无效");
// }
//
// // 2. 获取用户信息
// Users user = (Users) userValidation.get("user");
// if (user == null) {
// return AppletControllerUtil.appletWarning("用户信息获取失败");
// }
//
// // 3. 验证必要参数
// if (params == null || params.get("id") == null || params.get("paytype") == null || params.get("ordertype") == null) {
// return AppletControllerUtil.appletWarning("必要参数不能为空id、paytype、ordertype");
// }
//
// // 4. 解析参数
// Long productId = Long.valueOf(params.get("id").toString());
// Integer paytype = Integer.valueOf(params.get("paytype").toString());
// Integer ordertype = Integer.valueOf(params.get("ordertype").toString());
// String sku = params.get("sku") != null ? params.get("sku").toString() : "";
// Long couponId = params.get("coupon_id") != null ? Long.valueOf(params.get("coupon_id").toString()) : null;
// Long addressId = params.get("address_id") != null ? Long.valueOf(params.get("address_id").toString()) : null;
// String mtcode = params.get("mtcode") != null ? params.get("mtcode").toString() : "";
// BigDecimal memberMoney = params.get("membermoney") != null ? new BigDecimal(params.get("membermoney").toString()) : BigDecimal.ZERO;
// Integer num = params.get("num") != null ? Integer.valueOf(params.get("num").toString()) : 1;
// String makeTime = params.get("make_time") != null ? params.get("make_time").toString() : "";
//
// // 5. 验证支付类型
// if (paytype < 1 || paytype > 3) {
// return AppletControllerUtil.appletWarning("支付类型无效1=微信支付 2=余额支付 3=组合支付");
// }
//
// // 6. 验证订单类型
// if (ordertype < 0 || ordertype > 4) {
// return AppletControllerUtil.appletWarning("订单类型无效0=普通预约 1=拼团 2=次卡 3=秒杀 4=报价");
// }
//
// // 7. 根据订单类型处理不同的业务逻辑
// Map<String, Object> orderResult = null;
// switch (ordertype) {
// case 0: // 普通预约
// orderResult = handleNormalOrder(user, productId, sku, addressId, couponId, memberMoney, num, makeTime, mtcode);
// break;
// case 1: // 拼团
// orderResult = handleGroupBuyingOrder(user, productId, sku, couponId, memberMoney, num);
// break;
// case 2: // 次卡
// orderResult = handleCardOrder(user, productId, sku, couponId, memberMoney, num);
// break;
// case 3: // 秒杀
// orderResult = handleSeckillOrder(user, productId, sku, addressId, couponId, memberMoney, num);
// break;
// case 4: // 报价
// orderResult = handleQuoteOrder(user, productId, sku, addressId, couponId, memberMoney, num);
// break;
// default:
// return AppletControllerUtil.appletWarning("不支持的订单类型");
// }
//
// if (orderResult == null || !(Boolean) orderResult.get("success")) {
// String errorMsg = orderResult != null ? (String) orderResult.get("message") : "订单创建失败";
// return AppletControllerUtil.appletWarning(errorMsg);
// }
//
// // 8. 获取订单信息
// String orderId = (String) orderResult.get("orderId");
// BigDecimal totalAmount = (BigDecimal) orderResult.get("totalAmount");
// String orderDescription = (String) orderResult.get("description");
//
// // 9. 根据支付类型处理支付
// Map<String, Object> paymentResult = null;
// switch (paytype) {
// case 1: // 微信支付
// paymentResult = handleWechatPayment(user, orderId, totalAmount, orderDescription, ordertype);
// break;
// case 2: // 余额支付
// paymentResult = handleBalancePayment(user, orderId, totalAmount, orderDescription);
// break;
// case 3: // 组合支付
// paymentResult = handleCombinedPayment(user, orderId, totalAmount, orderDescription, params, ordertype);
// break;
// default:
// return AppletControllerUtil.appletWarning("不支持的支付类型");
// }
//
// if (paymentResult == null || !(Boolean) paymentResult.get("success")) {
// String errorMsg = paymentResult != null ? (String) paymentResult.get("message") : "支付处理失败";
// return AppletControllerUtil.appletWarning(errorMsg);
// }
//
// // 10. 返回支付结果
// Map<String, Object> responseData = new HashMap<>();
// responseData.put("orderId", orderId);
// responseData.put("totalAmount", totalAmount);
// responseData.put("paytype", paytype);
// responseData.put("ordertype", ordertype);
// responseData.putAll(paymentResult);
//
// return AppletControllerUtil.appletSuccess(responseData);
//
// } catch (Exception e) {
// logger.error("通用订单支付异常:", e);
// return AppletControllerUtil.appletError("订单支付失败:" + e.getMessage());
// }
// }
//
// /**
// * 处理普通预约订单
// */
// private Map<String, Object> handleNormalOrder(Users user, Long productId, String sku, Long addressId,
// Long couponId, BigDecimal memberMoney, Integer num,
// String makeTime, String mtcode) {
// Map<String, Object> result = new HashMap<>();
// try {
// // 1. 查询商品信息
// ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(productId);
// if (serviceGoods == null) {
// result.put("success", false);
// result.put("message", "商品不存在");
// return result;
// }
//
// // 2. 验证地址信息如果需要
// UserAddress userAddress = null;
// if (addressId != null) {
// userAddress = userAddressService.selectUserAddressById(addressId);
// if (userAddress == null) {
// result.put("success", false);
// result.put("message", "地址不存在");
// return result;
// }
// }
//
// // 3. 计算订单金额
// BigDecimal itemPrice = serviceGoods.getPrice().multiply(BigDecimal.valueOf(num));
// BigDecimal totalAmount = itemPrice.subtract(memberMoney);
//
// // 4. 处理优惠券
// BigDecimal couponDiscount = BigDecimal.ZERO;
// if (couponId != null) {
// CouponUser coupon = couponUserService.selectCouponUserById(couponId);
// if (coupon != null && coupon.getStatus() == 1) {
// couponDiscount = new BigDecimal(coupon.getCouponPrice());
// totalAmount = totalAmount.subtract(couponDiscount);
// // 标记优惠券为已使用
// coupon.setStatus(2L);
// couponUserService.updateCouponUser(coupon);
// }
// }
//
// // 5. 创建订单
// String orderId = GenerateCustomCode.generCreateOrder("B");
//
// if (serviceGoods.getType() == 2) {
// // 创建商品订单
// GoodsOrder goodsOrder = new GoodsOrder();
// goodsOrder.setType(1);
// goodsOrder.setOrderId(orderId);
// goodsOrder.setUid(user.getId());
// goodsOrder.setProductId(productId);
// goodsOrder.setNum(Long.valueOf(num));
// goodsOrder.setTotalPrice(itemPrice);
// goodsOrder.setGoodPrice(serviceGoods.getPrice());
// goodsOrder.setPayPrice(totalAmount);
// goodsOrder.setDeduction(couponDiscount.add(memberMoney));
// goodsOrder.setStatus(1L); // 待支付
// goodsOrder.setSku(sku);
// goodsOrder.setMtcode(mtcode);
// if (addressId != null) {
// goodsOrder.setAddressId(addressId);
// goodsOrder.setName(userAddress.getName());
// goodsOrder.setPhone(userAddress.getPhone());
// goodsOrder.setAddress(userAddress.getAddressName());
// }
// if (couponId != null) {
// goodsOrder.setCouponId(couponId);
// }
//
// int insertResult = goodsOrderService.insertGoodsOrder(goodsOrder);
// if (insertResult <= 0) {
// result.put("success", false);
// result.put("message", "订单创建失败");
// return result;
// }
// } else {
// // 创建服务订单
// Order order = new Order();
// order.setType(1);
// order.setCreateType(1);
// order.setOrderId(orderId);
// order.setUid(user.getId());
// order.setUname(user.getName());
// order.setProductId(productId);
// order.setProductName(serviceGoods.getTitle());
// order.setNum(Long.valueOf(num));
// order.setTotalPrice(itemPrice);
// order.setGoodPrice(serviceGoods.getPrice());
// order.setPayPrice(totalAmount);
// order.setDeduction(couponDiscount.add(memberMoney));
// order.setStatus(1L); // 待接单
// order.setReceiveType(1L); // 自由抢单
// order.setSku(sku);
// order.setMtcode(mtcode);
// if (addressId != null) {
// order.setAddressId(addressId);
// order.setName(userAddress.getName());
// order.setPhone(userAddress.getPhone());
// order.setAddress(userAddress.getAddressInfo());
// }
// if (couponId != null) {
// order.setCouponId(couponId);
// }
//
// // 处理预约时间
// if (makeTime != null && !makeTime.isEmpty()) {
// String[] makeTimeArr = makeTime.split(" ");
// if (makeTimeArr.length == 2) {
// try {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// Date date = sdf.parse(makeTimeArr[0]);
// order.setMakeTime(date.getTime() / 1000);
// order.setMakeHour(makeTimeArr[1]);
// } catch (Exception e) {
// logger.warn("预约时间格式错误: " + makeTime);
// }
// }
// }
//
// int insertResult = orderService.insertOrder(order);
// if (insertResult <= 0) {
// result.put("success", false);
// result.put("message", "订单创建失败");
// return result;
// }
// }
//
// result.put("success", true);
// result.put("orderId", orderId);
// result.put("totalAmount", totalAmount);
// result.put("description", "普通预约-" + serviceGoods.getTitle());
// return result;
//
// } catch (Exception e) {
// logger.error("处理普通预约订单异常:", e);
// result.put("success", false);
// result.put("message", "订单处理异常:" + e.getMessage());
// return result;
// }
// }
//
// /**
// * 处理拼团订单
// */
// private Map<String, Object> handleGroupBuyingOrder(Users user, Long productId, String sku,
// Long couponId, BigDecimal memberMoney, Integer num) {
// Map<String, Object> result = new HashMap<>();
// try {
// // 1. 查询商品信息
// ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(productId);
// if (serviceGoods == null) {
// result.put("success", false);
// result.put("message", "商品不存在");
// return result;
// }
//
// // 2. 验证拼团价格
// if (serviceGoods.getGroupprice() == null) {
// result.put("success", false);
// result.put("message", "该商品不支持拼团");
// return result;
// }
//
// // 3. 计算订单金额
// BigDecimal itemPrice = serviceGoods.getGroupprice().multiply(BigDecimal.valueOf(num));
// BigDecimal totalAmount = itemPrice.subtract(memberMoney);
//
// // 4. 处理优惠券
// if (couponId != null) {
// CouponUser coupon = couponUserService.selectCouponUserById(couponId);
// if (coupon != null && coupon.getStatus() == 1) {
// BigDecimal couponDiscount = new BigDecimal(coupon.getCouponPrice());
// totalAmount = totalAmount.subtract(couponDiscount);
// coupon.setStatus(2L);
// couponUserService.updateCouponUser(coupon);
// }
// }
//
// // 5. 创建拼团订单
// String orderId = GenerateCustomCode.generCreateOrder("G");
// UserGroupBuying userGroupBuying = new UserGroupBuying();
// userGroupBuying.setUid(user.getId());
// userGroupBuying.setStatus(4L); // 待支付
// userGroupBuying.setUname(user.getName());
// userGroupBuying.setProductId(productId);
// userGroupBuying.setPaytype(1L); // 微信支付
// userGroupBuying.setMoney(totalAmount);
// userGroupBuying.setOrderid(orderId);
// userGroupBuying.setSku(sku);
// if (couponId != null) {
// userGroupBuying.setCouponId(couponId);
// }
//
// int insertResult = userGroupBuyingService.insertUserGroupBuying(userGroupBuying);
// if (insertResult <= 0) {
// result.put("success", false);
// result.put("message", "拼团订单创建失败");
// return result;
// }
//
// result.put("success", true);
// result.put("orderId", orderId);
// result.put("totalAmount", totalAmount);
// result.put("description", "拼团-" + serviceGoods.getTitle());
// return result;
//
// } catch (Exception e) {
// logger.error("处理拼团订单异常:", e);
// result.put("success", false);
// result.put("message", "拼团订单处理异常:" + e.getMessage());
// return result;
// }
// }
//
// /**
// * 处理次卡订单
// */
// private Map<String, Object> handleCardOrder(Users user, Long productId, String sku,
// Long couponId, BigDecimal memberMoney, Integer num) {
// Map<String, Object> result = new HashMap<>();
// try {
// // 1. 查询商品信息
// ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(productId);
// if (serviceGoods == null) {
// result.put("success", false);
// result.put("message", "商品不存在");
// return result;
// }
//
// // 2. 验证次卡类型
// if (serviceGoods.getType() != 3) { // 假设type=3表示次卡
// result.put("success", false);
// result.put("message", "该商品不是次卡类型");
// return result;
// }
//
// // 3. 计算订单金额
// BigDecimal itemPrice = serviceGoods.getPrice().multiply(BigDecimal.valueOf(num));
// BigDecimal totalAmount = itemPrice.subtract(memberMoney);
//
// // 4. 处理优惠券
// if (couponId != null) {
// CouponUser coupon = couponUserService.selectCouponUserById(couponId);
// if (coupon != null && coupon.getStatus() == 1) {
// BigDecimal couponDiscount = new BigDecimal(coupon.getCouponPrice());
// totalAmount = totalAmount.subtract(couponDiscount);
// coupon.setStatus(2L);
// couponUserService.updateCouponUser(coupon);
// }
// }
//
// // 5. 创建次卡订单使用商品订单表
// String orderId = GenerateCustomCode.generCreateOrder("C");
// GoodsOrder goodsOrder = new GoodsOrder();
// goodsOrder.setType(3); // 次卡类型
// goodsOrder.setOrderId(orderId);
// goodsOrder.setUid(user.getId());
// goodsOrder.setProductId(productId);
// goodsOrder.setNum(Long.valueOf(num));
// goodsOrder.setTotalPrice(itemPrice);
// goodsOrder.setGoodPrice(serviceGoods.getPrice());
// goodsOrder.setPayPrice(totalAmount);
// goodsOrder.setDeduction(memberMoney);
// goodsOrder.setStatus(1L); // 待支付
// goodsOrder.setSku(sku);
// if (couponId != null) {
// goodsOrder.setCouponId(couponId);
// }
//
// int insertResult = goodsOrderService.insertGoodsOrder(goodsOrder);
// if (insertResult <= 0) {
// result.put("success", false);
// result.put("message", "次卡订单创建失败");
// return result;
// }
//
// result.put("success", true);
// result.put("orderId", orderId);
// result.put("totalAmount", totalAmount);
// result.put("description", "次卡-" + serviceGoods.getTitle());
// return result;
//
// } catch (Exception e) {
// logger.error("处理次卡订单异常:", e);
// result.put("success", false);
// result.put("message", "次卡订单处理异常:" + e.getMessage());
// return result;
// }
// }
//
// /**
// * 处理秒杀订单
// */
// private Map<String, Object> handleSeckillOrder(Users user, Long productId, String sku, Long addressId,
// Long couponId, BigDecimal memberMoney, Integer num) {
// Map<String, Object> result = new HashMap<>();
// try {
// // 1. 查询商品信息
// ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(productId);
// if (serviceGoods == null) {
// result.put("success", false);
// result.put("message", "商品不存在");
// return result;
// }
//
// // 2. 验证秒杀价格
// if (serviceGoods.getSeckillprice() == null) {
// result.put("success", false);
// result.put("message", "该商品不支持秒杀");
// return result;
// }
//
// // 3. 验证库存
// if (serviceGoods.getStock() != null && serviceGoods.getStock() < num) {
// result.put("success", false);
// result.put("message", "库存不足");
// return result;
// }
//
// // 4. 计算订单金额
// BigDecimal itemPrice = serviceGoods.getSeckillprice().multiply(BigDecimal.valueOf(num));
// BigDecimal totalAmount = itemPrice.subtract(memberMoney);
//
// // 5. 处理优惠券
// if (couponId != null) {
// CouponUser coupon = couponUserService.selectCouponUserById(couponId);
// if (coupon != null && coupon.getStatus() == 1) {
// BigDecimal couponDiscount = new BigDecimal(coupon.getCouponPrice());
// totalAmount = totalAmount.subtract(couponDiscount);
// coupon.setStatus(2L);
// couponUserService.updateCouponUser(coupon);
// }
// }
//
// // 6. 验证地址信息
// UserAddress userAddress = null;
// if (addressId != null) {
// userAddress = userAddressService.selectUserAddressById(addressId);
// if (userAddress == null) {
// result.put("success", false);
// result.put("message", "地址不存在");
// return result;
// }
// }
//
// // 7. 创建秒杀订单
// String orderId = GenerateCustomCode.generCreateOrder("S");
// GoodsOrder goodsOrder = new GoodsOrder();
// goodsOrder.setType(4); // 秒杀类型
// goodsOrder.setOrderId(orderId);
// goodsOrder.setUid(user.getId());
// goodsOrder.setProductId(productId);
// goodsOrder.setNum(Long.valueOf(num));
// goodsOrder.setTotalPrice(itemPrice);
// goodsOrder.setGoodPrice(serviceGoods.getSeckillprice());
// goodsOrder.setPayPrice(totalAmount);
// goodsOrder.setDeduction(memberMoney);
// goodsOrder.setStatus(1L); // 待支付
// goodsOrder.setSku(sku);
// if (addressId != null) {
// goodsOrder.setAddressId(addressId);
// goodsOrder.setName(userAddress.getName());
// goodsOrder.setPhone(userAddress.getPhone());
// goodsOrder.setAddress(userAddress.getAddressName());
// }
// if (couponId != null) {
// goodsOrder.setCouponId(couponId);
// }
//
// int insertResult = goodsOrderService.insertGoodsOrder(goodsOrder);
// if (insertResult <= 0) {
// result.put("success", false);
// result.put("message", "秒杀订单创建失败");
// return result;
// }
//
// result.put("success", true);
// result.put("orderId", orderId);
// result.put("totalAmount", totalAmount);
// result.put("description", "秒杀-" + serviceGoods.getTitle());
// return result;
//
// } catch (Exception e) {
// logger.error("处理秒杀订单异常:", e);
// result.put("success", false);
// result.put("message", "秒杀订单处理异常:" + e.getMessage());
// return result;
// }
// }
//
// /**
// * 处理报价订单
// */
// private Map<String, Object> handleQuoteOrder(Users user, Long productId, String sku, Long addressId,
// Long couponId, BigDecimal memberMoney, Integer num) {
// Map<String, Object> result = new HashMap<>();
// try {
// // 报价订单通常是先创建订单后续师傅报价后再支付
// // 这里创建一个待报价的订单
//
// // 1. 查询商品信息
// ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(productId);
// if (serviceGoods == null) {
// result.put("success", false);
// result.put("message", "商品不存在");
// return result;
// }
//
// // 2. 验证地址信息
// UserAddress userAddress = null;
// if (addressId != null) {
// userAddress = userAddressService.selectUserAddressById(addressId);
// if (userAddress == null) {
// result.put("success", false);
// result.put("message", "地址不存在");
// return result;
// }
// }
//
// // 3. 创建报价订单初始金额为0等待师傅报价
// String orderId = GenerateCustomCode.generCreateOrder("Q");
// Order order = new Order();
// order.setType(1);
// order.setCreateType(1);
// order.setOrderId(orderId);
// order.setUid(user.getId());
// order.setUname(user.getName());
// order.setProductId(productId);
// order.setProductName(serviceGoods.getTitle());
// order.setNum(Long.valueOf(num));
// order.setTotalPrice(BigDecimal.ZERO); // 待报价
// order.setGoodPrice(serviceGoods.getPrice());
// order.setPayPrice(BigDecimal.ZERO); // 待报价
// order.setDeduction(memberMoney);
// order.setStatus(1L); // 待接单
// order.setReceiveType(1L); // 自由抢单
// order.setSku(sku);
// if (addressId != null) {
// order.setAddressId(addressId);
// order.setName(userAddress.getName());
// order.setPhone(userAddress.getPhone());
// order.setAddress(userAddress.getAddressInfo());
// }
// if (couponId != null) {
// order.setCouponId(couponId);
// }
//
// int insertResult = orderService.insertOrder(order);
// if (insertResult <= 0) {
// result.put("success", false);
// result.put("message", "报价订单创建失败");
// return result;
// }
//
// result.put("success", true);
// result.put("orderId", orderId);
// result.put("totalAmount", BigDecimal.ZERO); // 报价订单暂时为0
// result.put("description", "报价订单-" + serviceGoods.getTitle());
// return result;
//
// } catch (Exception e) {
// logger.error("处理报价订单异常:", e);
// result.put("success", false);
// result.put("message", "报价订单处理异常:" + e.getMessage());
// return result;
// }
// }
//
// /**
// * 处理微信支付
// */
// private Map<String, Object> handleWechatPayment(Users user, String orderId, BigDecimal totalAmount,
// String description, Integer ordertype) {
// Map<String, Object> result = new HashMap<>();
// try {
// if (totalAmount.compareTo(BigDecimal.ZERO) <= 0) {
// result.put("success", false);
// result.put("message", "支付金额必须大于0");
// return result;
// }
//
// // 根据订单类型选择不同的回调地址
// String notifyUrl = getNotifyUrlByOrderType(ordertype);
//
// // 调用微信支付
// Map<String, Object> payResult = wechatPayUtil.createBatchOrderAndPay(
// user.getOpenid(),
// orderId,
// new BigDecimal("0.01"), // 测试环境使用0.01元
// 1,
// notifyUrl);
//
// if (payResult != null && Boolean.TRUE.equals(payResult.get("success"))) {
// result.put("success", true);
// result.put("paytype", "wechat");
// result.put("prepayId", payResult.get("prepayId"));
// result.putAll(payResult);
// } else {
// String errorMsg = payResult != null ? (String) payResult.get("message") : "微信支付下单失败";
// result.put("success", false);
// result.put("message", errorMsg);
// }
//
// return result;
//
// } catch (Exception e) {
// logger.error("处理微信支付异常:", e);
// result.put("success", false);
// result.put("message", "微信支付处理异常:" + e.getMessage());
// return result;
// }
// }
//
// /**
// * 处理余额支付
// */
// private Map<String, Object> handleBalancePayment(Users user, String orderId, BigDecimal totalAmount,
// String description) {
// Map<String, Object> result = new HashMap<>();
// try {
// if (totalAmount.compareTo(BigDecimal.ZERO) <= 0) {
// result.put("success", false);
// result.put("message", "支付金额必须大于0");
// return result;
// }
//
// // 调用余额支付工具类
// Map<String, Object> balanceResult = BalancePayUtil.processBalancePayment(
// user.getId(),
// totalAmount,
// description);
//
// if (balanceResult != null && Boolean.TRUE.equals(balanceResult.get("success"))) {
// result.put("success", true);
// result.put("paytype", "balance");
// result.put("message", "余额支付成功");
// result.put("beforeBalance", balanceResult.get("beforeBalance"));
// result.put("afterBalance", balanceResult.get("afterBalance"));
// } else {
// result.put("success", false);
// result.put("message", balanceResult != null ? (String) balanceResult.get("message") : "余额支付失败");
// if (balanceResult != null && balanceResult.containsKey("insufficientAmount")) {
// result.put("insufficientAmount", balanceResult.get("insufficientAmount"));
// }
// }
//
// return result;
//
// } catch (Exception e) {
// logger.error("处理余额支付异常:", e);
// result.put("success", false);
// result.put("message", "余额支付处理异常:" + e.getMessage());
// return result;
// }
// }
//
// /**
// * 处理组合支付
// */
// private Map<String, Object> handleCombinedPayment(Users user, String orderId, BigDecimal totalAmount,
// String description, Map<String, Object> params,
// Integer ordertype) {
// Map<String, Object> result = new HashMap<>();
// try {
// if (totalAmount.compareTo(BigDecimal.ZERO) <= 0) {
// result.put("success", false);
// result.put("message", "支付金额必须大于0");
// return result;
// }
//
// // 获取组合支付参数
// BigDecimal wechatAmount = params.get("wechat_pay_amount") != null ?
// new BigDecimal(params.get("wechat_pay_amount").toString()) : BigDecimal.ZERO;
// BigDecimal balanceAmount = params.get("balance_pay_amount") != null ?
// new BigDecimal(params.get("balance_pay_amount").toString()) : BigDecimal.ZERO;
//
// // 验证金额
// if (wechatAmount.add(balanceAmount).compareTo(totalAmount) != 0) {
// result.put("success", false);
// result.put("message", "组合支付金额不匹配");
// return result;
// }
//
// // 先处理余额支付部分
// if (balanceAmount.compareTo(BigDecimal.ZERO) > 0) {
// Map<String, Object> balanceResult = BalancePayUtil.processBalancePayment(
// user.getId(),
// balanceAmount,
// description + "-余额支付部分");
//
// if (balanceResult == null || !Boolean.TRUE.equals(balanceResult.get("success"))) {
// result.put("success", false);
// result.put("message", balanceResult != null ? (String) balanceResult.get("message") : "余额支付失败");
// return result;
// }
// }
//
// // 再处理微信支付部分
// if (wechatAmount.compareTo(BigDecimal.ZERO) > 0) {
// String notifyUrl = getNotifyUrlByOrderType(ordertype);
// Map<String, Object> wechatResult = wechatPayUtil.createBatchOrderAndPay(
// user.getOpenid(),
// orderId,
// new BigDecimal("0.01"), // 测试环境使用0.01元
// 1,
// notifyUrl);
//
// if (wechatResult == null || !Boolean.TRUE.equals(wechatResult.get("success"))) {
// result.put("success", false);
// result.put("message", wechatResult != null ? (String) wechatResult.get("message") : "微信支付失败");
// return result;
// }
//
// result.put("prepayId", wechatResult.get("prepayId"));
// result.putAll(wechatResult);
// }
//
// result.put("success", true);
// result.put("paytype", "combined");
// result.put("wechatAmount", wechatAmount);
// result.put("balanceAmount", balanceAmount);
// result.put("message", "组合支付处理成功");
//
// return result;
//
// } catch (Exception e) {
// logger.error("处理组合支付异常:", e);
// result.put("success", false);
// result.put("message", "组合支付处理异常:" + e.getMessage());
// return result;
// }
// }
//
// /**
// * 根据订单类型获取回调地址
// */
// private String getNotifyUrlByOrderType(Integer ordertype) {
// switch (ordertype) {
// case 0: // 普通预约
// return WechatPayUtil.PAY_FH + "api/goods/pay/notify";
// case 1: // 拼团
// return WechatPayUtil.PAY_FH + "api/group/pay/notify";
// case 2: // 次卡
// return WechatPayUtil.PAY_FH + "api/card/pay/notify";
// case 3: // 秒杀
// return WechatPayUtil.PAY_FH + "api/seckill/pay/notify";
// case 4: // 报价
// return WechatPayUtil.PAY_FH + "api/quote/pay/notify";
// default:
// return WechatPayUtil.PAY_FH + "api/goods/pay/notify";
// }
// }
}

View File

@ -110,6 +110,16 @@ public class AppletController extends BaseController {
private IWorkerApplyService workerApplyService;
@Autowired
private IUserMemberRechargeProgramService userMemberRechargeProgramService;
@Autowired
private IUserSecondaryCardService userSecondaryCardService;
@Autowired
private IUserGroupBuyingService userGroupBuyingService;
/**
* 获取服务分类列表
* 功能说明
@ -928,7 +938,9 @@ public class AppletController extends BaseController {
* - 包含图片基础信息等数组数据
*/
@GetMapping(value = "/api/service/info/id/{id}")
public AjaxResult serviceGoodsQuery(@PathVariable("id") long id, HttpServletRequest request) {
public AjaxResult serviceGoodsQuery(@PathVariable("id") long id,
@RequestParam(value = "type", required = false) Integer type,
HttpServletRequest request) {
try {
// 参数验证
if (id <= 0) {
@ -940,16 +952,95 @@ public class AppletController extends BaseController {
if (serviceGoodsData == null) {
return AppletControllerUtil.appletError("商品不存在或已下架");
}
if (type != null && type == 1) {
if (serviceGoodsData.getIsgroup()!=1){
return AppletControllerUtil.appletError("改服务不是拼团服务");
}
}
//次卡详情
if (type != null && type == 2) {
UserSecondaryCard goods = userSecondaryCardService.selectUserSecondaryCardById(id);
Map<String, Object> map = new HashMap<>();
map.put("id", goods.getId());
map.put("allsellnum", 10);
map.put("orderid", goods.getOrderid());
map.put("title", goods.getTitle());
map.put("goodsids", goods.getGoodsids());
map.put("show_money", goods.getShowMoney());
map.put("real_money", goods.getRealMoney());
map.put("showimage", AppletControllerUtil.buildImageUrl(goods.getShowimage()));
map.put("carouselImage", AppletControllerUtil.parseImagesStringToArray(goods.getCarouselImage()));
map.put("status", goods.getStatus());
map.put("creattime", goods.getCreattime());
map.put("type", goods.getType());
map.put("num", goods.getNum());
map.put("allnum", goods.getAllnum());
map.put("introduction", goods.getIntroduction());
List<String> idsList = JSONArray.parseArray(goods.getGoodsids(), String.class);
List<ServiceGoods> serviceGoodsList = serviceGoodsService.selectServiceGoodsfrocikaList(idsList);
List<Map<String, Object>> serviceDetail = new ArrayList<>();
if(serviceGoodsList != null && !serviceGoodsList.isEmpty()) {
for(ServiceGoods serviceGoods : serviceGoodsList) {
Map<String, Object> card = new HashMap<>();
card.put("icon", AppletControllerUtil.buildImageUrl(serviceGoods.getIcon()));
card.put("title", serviceGoods.getTitle());
card.put("price", serviceGoods.getPrice());
card.put("id", serviceGoods.getId());
serviceDetail.add( card);
}
}
map.put("serviceDetail", serviceDetail);
// card.setServiceDetail(serviceGoodsService.selectServiceGoodsfrocikaList(idsList));
return AppletControllerUtil.appletSuccess(map);
}
//拼团详情
// 根据商品类型返回不同格式的数据
// 原有逻辑普通服务详情
if (serviceGoodsData.getType() != null && serviceGoodsData.getType().intValue() == 2) {
// type=2时返回json.txt格式
Map<String, Object> goodsData = AppletControllerUtil.buildType2ServiceGoodsResponse(serviceGoodsData);
return AppletControllerUtil.appletSuccess(goodsData);
} else {
// type=1时返回ServiceGoodsResponse格式
AppletControllerUtil.ServiceGoodsResponse response = new AppletControllerUtil.ServiceGoodsResponse(serviceGoodsData);
return AppletControllerUtil.appletSuccess(response);
Map<String, Object> goodsData = AppletControllerUtil.buildType2ServiceGoodsResponse(serviceGoodsData);
//根据需求就要添加拼团相关数据
if (type != null) {
//拼团独有数据
if (type == 1) {
// 拼团服务详情
goodsData.put("allsellnum", 10);
goodsData.put("isgroup", serviceGoodsData.getIsgroup());
goodsData.put("groupprice", serviceGoodsData.getGroupprice());
List<Map<String, Object>> groupBuyingList = userGroupBuyingService.selectGroupBuyingGroupByProductAndOrder(Math.toIntExact(serviceGoodsData.getId()));
for (Map<String, Object> groupBuying : groupBuyingList) {
//还差几人成团
JSONArray groupBuyingArray = JSONArray.parseArray(groupBuying.get("name").toString());
groupBuying.put("neednum", serviceGoodsData.getGroupnum() - groupBuyingArray.size());
groupBuying.put("image", AppletControllerUtil.parseImagesStringToArray(groupBuying.get("image").toString()));
//parseImagesStringToArray(goods.getImgs())
//groupBuying.put("neednum", AppletControllerUtil.buildImageUrl(groupBuying.get("image").toString()));
}
goodsData.put("groupBuyData", groupBuyingList);
}
//秒杀独有数据
if (type == 3) {
// 秒杀服务详情
goodsData.put("allsellnum", 10);
goodsData.put("isfixed", serviceGoodsData.getIsfixed());
goodsData.put("fixedprice", serviceGoodsData.getFixedprice());
}
//报价数据下师傅的报价详情
if (type == 3) {
// 秒杀服务详情
// List<Map<String, Object>> quoteList = new List<Map<String, Object>>() ;
//
// goodsData.put("isfixed", serviceGoodsData.getIsfixed());
// goodsData.put("fixedprice", serviceGoodsData.getFixedprice());
}
}
return AppletControllerUtil.appletSuccess(goodsData);
}
} catch (Exception e) {
return AppletControllerUtil.appletError("查询商品详情失败:" + e.getMessage());
@ -1007,8 +1098,8 @@ public class AppletController extends BaseController {
* - 保持原有排序不变
* - 无需用户登录验证
*/
@GetMapping(value = "/api/mall/cate/lst")
public AjaxResult getMallCategoryList(HttpServletRequest request) {
@GetMapping(value = "/api/mall/cate/lst/{type}")
public AjaxResult getMallCategoryList(@PathVariable("type") int type, HttpServletRequest request) {
try {
// 构建查询条件
ServiceCate serviceCateQuery = new ServiceCate();
@ -1108,14 +1199,10 @@ public class AppletController extends BaseController {
int page = params.get("page") != null ? (Integer) params.get("page") : 1;
int limit = params.get("limit") != null ? (Integer) params.get("limit") : 15;
String cateId = params.get("cateId").toString();
// // 1. 参数验证
// if (cateId == null) {
// return AppletControllerUtil.appletWarning("分类ID不能为空");
// }
// 验证分页参数
// if (page < 1) page = 1;
// if (limit < 1) limit = 15;
if (page < 1) page = 1;
if (limit < 1) limit = 15;
// if (limit > 100) limit = 100; // 限制最大每页数量
// 2. 设置分页参数
@ -1425,6 +1512,7 @@ public class AppletController extends BaseController {
@GetMapping(value = "/api/user/info")
public AjaxResult apiuserinfo(HttpServletRequest request) {
try {
SimpleDateFormat sdfday = new SimpleDateFormat("yyyy-MM-dd");
Map<String, Object> order_num = new HashMap<>();
Map<String, Object> goods_order_num = new HashMap<>();
// 1. 验证用户登录状态
@ -1541,7 +1629,7 @@ public class AppletController extends BaseController {
userInfo.put("balance", user.getBalance());
userInfo.put("shop_money", user.getConsumption());
userInfo.put("service_money", user.getServicefee());
userInfo.put("birthday", user.getBirthday());
userInfo.put("birthday",user.getBirthday() != null ? sdfday.format(user.getBirthday()) : null);
// 头像处理
String avatar = user.getAvatar();
if (avatar != null && !avatar.isEmpty()) {
@ -6567,4 +6655,268 @@ public class AppletController extends BaseController {
return AppletControllerUtil.appletSuccess(responseData);
}
/**
* 首页接口汇总
*/
@GetMapping(value = "/api/public/group/catelst")
public AjaxResult groupCatelst(@RequestParam(value = "type", required = false, defaultValue = "1") int type) {
List<ServiceCate> cateList;
// 根据type调用不同的分类查询方法
if (type == 1) {
cateList = serviceCateService.selectServiceCatepintuanList(); // 拼团
} else if (type == 2) {
cateList = serviceCateService.selectServiceCateCiKaList(); // 次卡
} else if (type == 3) {
cateList = serviceCateService.selectServiceCateMiaoshaList(); // 秒杀
} else if (type == 4) {
cateList = serviceCateService.selectServiceCateBaojiaList(); // 报价
} else {
cateList = new ArrayList<>();
}
List<Map<String, Object>> cateDataList = new ArrayList<>();
for (ServiceCate cate : cateList) {
Map<String, Object> cateData = new HashMap<>();
cateData.put("id", cate.getId());
cateData.put("title", cate.getTitle());
cateData.put("icon", AppletControllerUtil.buildImageUrl(cate.getIcon()));
cateDataList.add(cateData);
}
return AppletControllerUtil.appletSuccess(cateDataList);
}
/**
* 获取拼团服务列表
* 查询status=1type=1isgroup=1的服务商品分页返回
* 只返回图标标题原价拼团价拼团人数
* @param params 请求参数包含page和limit
* @return 拼团服务分页列表
*
* 1查拼团 2查次卡 3查秒杀 4查报价
*/
@PostMapping("/api/group/service/list")
public AjaxResult getGroupServiceList(@RequestBody Map<String, Object> params) {
try {
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 15;
Long cateId = null;
if (params.get("cateid") != null && !params.get("cateid").toString().isEmpty()) {
cateId = Long.parseLong(params.get("cateid").toString());
}
int type = params.get("type") != null ? Integer.parseInt(params.get("type").toString()) : 1;
// 分页参数校验
Map<String, Object> pageValidation = PageUtil.validatePageParams(page, limit);
if (!(Boolean) pageValidation.get("valid")) {
return AppletControllerUtil.appletWarning((String) pageValidation.get("message"));
}
//拼团数据
if (type == 1) {
// 设置分页
PageHelper.startPage(page, limit);
// 构造查询条件
ServiceGoods query = new ServiceGoods();
query.setStatus("1");
query.setType(1);
query.setIsgroup(1);//1是拼团
if (cateId != null) {
query.setCateId(cateId);
}
List<ServiceGoods> goodsList = serviceGoodsService.selectServiceGoodsList(query);
// 只返回需要的字段
List<Map<String, Object>> resultList = new ArrayList<>();
for (ServiceGoods goods : goodsList) {
Map<String, Object> map = new HashMap<>();
map.put("icon", AppletControllerUtil.buildImageUrl(goods.getIcon()));
map.put("title", goods.getTitle());
map.put("price", goods.getPrice());
map.put("groupprice", goods.getGroupprice());
map.put("groupnum", goods.getGroupnum());
resultList.add(map);
}
// 分页封装
TableDataInfo tableDataInfo = getDataTable(goodsList);
tableDataInfo.setRows(resultList); // 只返回精简字段
Map<String, Object> pageData = PageUtil.buildSimplePageResponse(tableDataInfo, page, limit);
return AppletControllerUtil.appletSuccess(pageData);
}
//次卡数据
if (type == 2) {
// 设置分页
PageHelper.startPage(page, limit);
// 构造查询条件
UserSecondaryCard queryParams = new UserSecondaryCard();
queryParams.setStatus(1L);
if (cateId != null) {
queryParams.setType(cateId);
}
List<UserSecondaryCard> goodsList = userSecondaryCardService.selectUserSecondaryCardList(queryParams);
// 只返回需要的字段
List<Map<String, Object>> resultList = new ArrayList<>();
for (UserSecondaryCard goods : goodsList) {
Map<String, Object> map = new HashMap<>();
map.put("id", goods.getId());
map.put("orderid", goods.getOrderid());
map.put("title", goods.getTitle());
map.put("goodsids", goods.getGoodsids());
map.put("show_money", goods.getShowMoney());
map.put("real_money", goods.getRealMoney());
map.put("showimage", AppletControllerUtil.buildImageUrl(goods.getShowimage()));
map.put("status", goods.getStatus());
map.put("creattime", goods.getCreattime());
map.put("type", goods.getType());
map.put("num", goods.getNum());
map.put("allnum", goods.getAllnum());
map.put("introduction", goods.getIntroduction());
List<String> idsList = JSONArray.parseArray(goods.getGoodsids(), String.class);
List<ServiceGoods> serviceGoodsList = serviceGoodsService.selectServiceGoodsfrocikaList(idsList);
List<Map<String, Object>> serviceDetail = new ArrayList<>();
if(serviceGoodsList != null && !serviceGoodsList.isEmpty()) {
for(ServiceGoods serviceGoods : serviceGoodsList) {
Map<String, Object> card = new HashMap<>();
card.put("icon", AppletControllerUtil.buildImageUrl(serviceGoods.getIcon()));
card.put("title", serviceGoods.getTitle());
card.put("price", serviceGoods.getPrice());
card.put("id", serviceGoods.getId());
serviceDetail.add( card);
}
}
map.put("serviceDetail", serviceDetail);
// card.setServiceDetail(serviceGoodsService.selectServiceGoodsfrocikaList(idsList));
resultList.add(map);
}
// 分页封装
TableDataInfo tableDataInfo = getDataTable(goodsList);
tableDataInfo.setRows(resultList); // 只返回精简字段
Map<String, Object> pageData = PageUtil.buildSimplePageResponse(tableDataInfo, page, limit);
return AppletControllerUtil.appletSuccess(pageData);
}
//秒杀数据
if (type == 3) {
// 设置分页
PageHelper.startPage(page, limit);
// 构造查询条件
ServiceGoods query = new ServiceGoods();
query.setStatus("1");
query.setType(1);
query.setIsfixed(1);//秒杀
if (cateId != null) {
query.setCateId(cateId);
}
List<ServiceGoods> goodsList = serviceGoodsService.selectServiceGoodsList(query);
// 只返回需要的字段
List<Map<String, Object>> resultList = new ArrayList<>();
for (ServiceGoods goods : goodsList) {
Map<String, Object> map = new HashMap<>();
map.put("icon", AppletControllerUtil.buildImageUrl(goods.getIcon()));
map.put("title", goods.getTitle());
map.put("price", goods.getPrice());
map.put("fixedprice", goods.getFixedprice());
resultList.add(map);
}
// 分页封装
TableDataInfo tableDataInfo = getDataTable(goodsList);
tableDataInfo.setRows(resultList); // 只返回精简字段
Map<String, Object> pageData = PageUtil.buildSimplePageResponse(tableDataInfo, page, limit);
return AppletControllerUtil.appletSuccess(pageData);
}
//报价数据
if (type == 4) {
// 设置分页
PageHelper.startPage(page, limit);
// 构造查询条件
ServiceGoods query = new ServiceGoods();
query.setStatus("1");
query.setType(1);
query.setServicetype(2);//报价
if (cateId != null) {
query.setCateId(cateId);
}
List<ServiceGoods> goodsList = serviceGoodsService.selectServiceGoodsList(query);
// 只返回需要的字段
List<Map<String, Object>> resultList = new ArrayList<>();
for (ServiceGoods goods : goodsList) {
Map<String, Object> map = new HashMap<>();
map.put("icon", AppletControllerUtil.buildImageUrl(goods.getIcon()));
map.put("title", goods.getTitle());
resultList.add(map);
}
// 分页封装
TableDataInfo tableDataInfo = getDataTable(goodsList);
tableDataInfo.setRows(resultList); // 只返回精简字段
Map<String, Object> pageData = PageUtil.buildSimplePageResponse(tableDataInfo, page, limit);
return AppletControllerUtil.appletSuccess(pageData);
}
} catch (Exception e) {
return AppletControllerUtil.appletError("获取拼团服务列表失败:" + e.getMessage());
}
return null;
}
// /**
// * 获取次卡列表支持分页
// *
// * 查询用户次卡列表支持按类型筛选和分页
// * 每个次卡会包含对应的服务商品详情
// *
// * @param params 查询参数page, limit, type
// * @param request HTTP请求对象
// * @return 次卡列表分页格式
// */
// @PostMapping("/secondary/card/list")
// public AjaxResult getSecondaryCardList(@RequestBody Map<String, Object> params, HttpServletRequest request) {
// try {
// // 1. 获取并验证分页参数
// int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
// int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 15;
//
// Map<String, Object> pageValidation = PageUtil.validatePageParams(page, limit);
// if (!(Boolean) pageValidation.get("valid")) {
// return AppletControllerUtil.appletWarning((String) pageValidation.get("message"));
// }
//
// // 2. 获取type参数
// Long type = params.get("type") != null ? Long.parseLong(params.get("type").toString()) : null;
//
// // 3. 创建查询对象
// UserSecondaryCard queryParams = new UserSecondaryCard();
// queryParams.setStatus(1L); // 只查询状态为1的数据
// if (type != null) {
// queryParams.setType(type);
// }
//
// // 4. 设置分页参数
// PageHelper.startPage(page, limit);
//
// // 5. 执行查询
// List<UserSecondaryCard> list = userSecondaryCardService.selectUserSecondaryCardList(queryParams);
//
// // 6. 为每个次卡填充服务商品详情
// for (UserSecondaryCard card : list) {
// List<String> idsList = com.alibaba.fastjson2.JSONArray.parseArray(card.getGoodsids(), String.class);
// card.setServiceDetail(serviceGoodsService.selectServiceGoodsfrocikaList(idsList));
// }
//
// // 7. 获取分页信息并构建响应
// TableDataInfo tableDataInfo = getDataTable(list);
// Map<String, Object> pageData = PageUtil.buildPageResponse(tableDataInfo, page, limit);
//
// return AppletControllerUtil.appletSuccess(pageData);
//
// } catch (Exception e) {
// System.err.println("查询次卡列表异常:" + e.getMessage());
// return AppletControllerUtil.appletError("获取次卡列表失败:" + e.getMessage());
// }
// }
}

View File

@ -21,7 +21,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@ -0,0 +1,104 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.UsersPayBefor;
import com.ruoyi.system.service.IUsersPayBeforService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 预支付Controller
*
* @author ruoyi
* @date 2025-07-11
*/
@RestController
@RequestMapping("/system/UsersPayBefor")
public class UsersPayBeforController extends BaseController
{
@Autowired
private IUsersPayBeforService usersPayBeforService;
/**
* 查询预支付列表
*/
@PreAuthorize("@ss.hasPermi('system:UsersPayBefor:list')")
@GetMapping("/list")
public TableDataInfo list(UsersPayBefor usersPayBefor)
{
startPage();
List<UsersPayBefor> list = usersPayBeforService.selectUsersPayBeforList(usersPayBefor);
return getDataTable(list);
}
/**
* 导出预支付列表
*/
@PreAuthorize("@ss.hasPermi('system:UsersPayBefor:export')")
@Log(title = "预支付", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, UsersPayBefor usersPayBefor)
{
List<UsersPayBefor> list = usersPayBeforService.selectUsersPayBeforList(usersPayBefor);
ExcelUtil<UsersPayBefor> util = new ExcelUtil<UsersPayBefor>(UsersPayBefor.class);
util.exportExcel(response, list, "预支付数据");
}
/**
* 获取预支付详细信息
*/
@PreAuthorize("@ss.hasPermi('system:UsersPayBefor:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(usersPayBeforService.selectUsersPayBeforById(id));
}
/**
* 新增预支付
*/
@PreAuthorize("@ss.hasPermi('system:UsersPayBefor:add')")
@Log(title = "预支付", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody UsersPayBefor usersPayBefor)
{
return toAjax(usersPayBeforService.insertUsersPayBefor(usersPayBefor));
}
/**
* 修改预支付
*/
@PreAuthorize("@ss.hasPermi('system:UsersPayBefor:edit')")
@Log(title = "预支付", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody UsersPayBefor usersPayBefor)
{
return toAjax(usersPayBeforService.updateUsersPayBefor(usersPayBefor));
}
/**
* 删除预支付
*/
@PreAuthorize("@ss.hasPermi('system:UsersPayBefor:remove')")
@Log(title = "预支付", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(usersPayBeforService.deleteUsersPayBeforByIds(ids));
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.ControllerUtil;
import ch.qos.logback.core.util.CachingDateFormatter;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
@ -17,6 +18,7 @@ import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -42,6 +44,7 @@ public class AppletControllerUtil {
private static final IUsersService usersService = SpringUtils.getBean(IUsersService.class);
private static final IUserAddressService userAddressService = SpringUtils.getBean(IUserAddressService.class);
private static final IOrderCommentService orderCommentService = SpringUtils.getBean(IOrderCommentService.class);
// ============================== 统一响应处理方法 ==============================
@ -3132,6 +3135,7 @@ public class AppletControllerUtil {
*/
public static Map<String, Object> buildType2ServiceGoodsResponse(ServiceGoods goods) {
Map<String, Object> data = new HashMap<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 基础信息
data.put("id", goods.getId());
@ -3145,33 +3149,86 @@ public class AppletControllerUtil {
data.put("stock", goods.getStock() != null ? goods.getStock().intValue() : 0);
data.put("status", goods.getStatus() != null ? goods.getStatus() : "1");
data.put("description", goods.getDescription());
data.put("sku_type", goods.getSkuType() != null ? goods.getSkuType().intValue() : 1);
data.put("sku_type", goods.getSkuType() != null ? goods.getSkuType() : 1);
if (goods.getSkuType() == 1){
JSONObject sku = new JSONObject();
sku.put("type", "single");
data.put("sku", sku);
}else{
data.put("sku", parseSkuStringToObject(goods.getSku()));
}
// 处理SKU数据
// data.put("sku", parseSkuStringToObject(goods.getSku()));
data.put("latitude", goods.getLatitude());
data.put("longitude", goods.getLongitude());
data.put("type", goods.getType() != null ? goods.getType().intValue() : 2);
data.put("type", goods.getType() != null ? goods.getType() : 2);
data.put("cate_id", goods.getCateId());
data.put("project", goods.getProject());
data.put("sort", goods.getSort() != null ? goods.getSort().intValue() : 1);
data.put("sort", goods.getSort() != null ? goods.getSort() : 1);
data.put("material", goods.getMaterial());
data.put("postage", goods.getPostage() != null ? goods.getPostage().toString() : null);
data.put("basic", parseBasicStringToArray(goods.getBasic()));
data.put("margin", goods.getMargin() != null ? goods.getMargin().toString() : null);
data.put("skill_ids", goods.getSkillIds());
// 处理图片数组
data.put("imgs", parseImagesStringToArray(goods.getImgs()));
// 处理SKU数据
data.put("sku", parseSkuStringToObject(goods.getSku()));
// 时间字段
data.put("created_at", formatDateToString(goods.getCreatedAt()));
data.put("updated_at", formatDateToString(goods.getUpdatedAt()));
// data.put("created_at", formatDateToString(goods.getCreatedAt()));
// data.put("updated_at", formatDateToString(goods.getUpdatedAt()));
data.put("created_at", goods.getCreatedAt() != null ? formatDateToString(goods.getCreatedAt()) : null);
data.put("updated_at", goods.getUpdatedAt() != null ? formatDateToString(goods.getUpdatedAt()) : null);
data.put("deleted_at", goods.getDeletedAt() != null ? formatDateToString(goods.getDeletedAt()) : null);
//问答
if (goods.getQuestions() != null){
data.put("questions", JSONArray.parseArray(goods.getQuestions()));
}else{
data.put("questions", null);
}
// 评论对象预留
data.put("comment", null);
//获取这个产品当前的第一条好评
OrderComment orderComment =new OrderComment();
orderComment.setProductId(goods.getId());
orderComment.setStatus(1);
orderComment.setNumType(1L);
List<OrderComment> orderCommentslist = orderCommentService.selectOrderCommentList(orderComment);
if(!orderCommentslist.isEmpty()){
JSONObject comment = new JSONObject();
comment.put("content", orderCommentslist.getFirst().getContent());
comment.put("id", orderCommentslist.getFirst().getId());
comment.put("labels", JSONArray.parseArray(orderCommentslist.getFirst().getLabels()) );
comment.put("num", orderCommentslist.getFirst().getNum());
comment.put("uid", orderCommentslist.getFirst().getUid());
comment.put("images",JSONArray.parseArray(orderCommentslist.getFirst().getImages()) );
//comment.put("images",parseImagesStringToArray(orderCommentslist.getFirst().getImages()));
comment.put("commenttime", sdf.format(orderCommentslist.getFirst().getCreatedAt()));
Users u = usersService.selectUsersById(orderCommentslist.getFirst().getUid());
if (u != null){
JSONObject user = new JSONObject();
user.put("id", u.getId());
user.put("name", u.getName());
user.put("avatar", u.getAvatar());
comment.put("user", user);
}
data.put("comment", comment);
}else{
data.put("comment", null);
}
OrderComment orderComment1 =new OrderComment();
orderComment1.setProductId(goods.getId());
List<OrderComment> orderCommentslist1 = orderCommentService.selectOrderCommentList(orderComment1);
data.put("allcommentnum", orderCommentslist1.size());
// if (goods.getIsgroup() != null){
// data.put("isgroup", goods.getIsgroup());
// }else{
// goods.setIsgroup(2);
// data.put("isgroup", 2);
// }
//
// if (goods.getIsgroup() == 1){
// data.put("group_price", goods.getGroupprice());
// data.put("groupnum", goods.getGroupnum());
// }
return data;
}
@ -3190,7 +3247,12 @@ public class AppletControllerUtil {
for (int i = 0; i < jsonArray.size(); i++) {
String img = jsonArray.getString(i);
if (img != null && !img.trim().isEmpty()) {
imageList.add(buildImageUrl(img));
String trimmedImg = img.trim();
if (trimmedImg.contains("https://img.")) {
imageList.add(trimmedImg);
} else {
imageList.add(buildImageUrl(trimmedImg));
}
}
}
} catch (Exception e) {
@ -3198,7 +3260,12 @@ public class AppletControllerUtil {
String[] imgArray = imgs.split("[,]");
for (String img : imgArray) {
if (img != null && !img.trim().isEmpty()) {
imageList.add(buildImageUrl(img.trim()));
String trimmedImg = img.trim();
if (trimmedImg.contains("https://img.")) {
imageList.add(trimmedImg);
} else {
imageList.add(buildImageUrl(trimmedImg));
}
}
}
}
@ -3404,10 +3471,10 @@ public class AppletControllerUtil {
* @param userId 用户ID
* @return 用户更新对象
*/
public static Users buildUpdateUserFromdataParams(Map<String, Object> params, Long userId) {
public static Users buildUpdateUserFromdataParams(Map<String, Object> params, Long userId) throws ParseException {
Users updateUser = new Users();
updateUser.setId(userId);
SimpleDateFormat sdfday = new SimpleDateFormat("yyyy-MM-dd");
// 基本信息字段
if (params.get("name") != null) {
updateUser.setName(params.get("name").toString().trim());
@ -3460,6 +3527,12 @@ public class AppletControllerUtil {
updateUser.setJobNumber(jobNumber);
}
// 字符串和其他字段
if (params.get("birthday") != null) {
updateUser.setBirthday(sdfday.parse(params.get("birthday").toString().trim()));
}
if (params.get("level") != null && !params.get("level").toString().trim().isEmpty()) {
Integer level = parseToIntegerForEdit(params.get("level"));
updateUser.setLevel(level);

View File

@ -0,0 +1,20 @@
package com.ruoyi.system.ControllerUtil;
import java.time.LocalTime;
/**
* 考勤工具类
* 规定每天上班时间为8:00--18:00其余时间不允许打卡
*/
public class AttendanceUtil {
/**
* 判断当前时间是否允许打卡8:00-18:00
* @return true=允许打卡false=不允许
*/
public static boolean isAllowCheckIn() {
LocalTime now = LocalTime.now();
LocalTime start = LocalTime.of(8, 0);
LocalTime end = LocalTime.of(18, 0);
return !now.isBefore(start) && !now.isAfter(end);
}
}

View File

@ -92,7 +92,7 @@ public class InvoiceUtil {
orderMap.put("orderType", "service"); // 服务订单
orderMap.put("orderTypeText", "服务订单");
orderMap.put("amount", order.getTotalPrice());
orderMap.put("title", order.getOrderId()+ "服务订单");
orderMap.put("title", "服务订单"+order.getTotalPrice()+"" );
orderMap.put("createTime", order.getCreateTime());
orderMap.put("canInvoice", true);
pendingOrders.add(orderMap);
@ -113,7 +113,7 @@ public class InvoiceUtil {
orderMap.put("orderType", "goods"); // 商品订单
orderMap.put("orderTypeText", "商品订单");
orderMap.put("amount", goodsOrder.getTotalPrice());
orderMap.put("title", "商品订单");
orderMap.put("title", "购买商品"+goodsOrder.getTotalPrice()+"");
orderMap.put("createTime", goodsOrder.getCreateTime());
orderMap.put("canInvoice", true);
pendingOrders.add(orderMap);
@ -134,7 +134,7 @@ public class InvoiceUtil {
orderMap.put("orderType", "recharge"); // 充值订单
orderMap.put("orderTypeText", "充值订单");
orderMap.put("amount", recharge.getInmoney());
orderMap.put("title", recharge.getReamk() != null ? recharge.getReamk() : "会员充值");
orderMap.put("title", "会员充值"+recharge.getInmoney()+"");
orderMap.put("createTime", recharge.getCreatedAt());
orderMap.put("canInvoice", true);
pendingOrders.add(orderMap);
@ -479,6 +479,8 @@ public class InvoiceUtil {
if (invoiceData.get("category") == null) {
return "发票类别不能为空";
}
Integer category = (Integer) invoiceData.get("category");
String invoiceTitle = invoiceData.get("invoiceTitle").toString();
@ -490,17 +492,24 @@ public class InvoiceUtil {
}
// 检查是否填写了企业字段
if (StringUtils.isNotEmpty((String) invoiceData.get("taxNumber"))) {
return "个人发票不能填写纳税人识别号";
// if (StringUtils.isNotEmpty((String) invoiceData.get("taxNumber"))) {
// return "个人发票不能填写纳税人识别号";
// }
// if (StringUtils.isNotEmpty((String) invoiceData.get("address"))) {
// return "个人发票不能填写单位地址";
// }
// if (StringUtils.isNotEmpty((String) invoiceData.get("phone"))) {
// return "个人发票不能填写联系电话";
// }
// if (StringUtils.isNotEmpty((String) invoiceData.get("wechat"))) {
// return "个人发票不能填写微信号";
// }
if (StringUtils.isEmpty((String) invoiceData.get("email"))) {
return "邮箱不能为空";
}
if (StringUtils.isNotEmpty((String) invoiceData.get("address"))) {
return "个人发票不能填写单位地址";
}
if (StringUtils.isNotEmpty((String) invoiceData.get("phone"))) {
return "个人发票不能填写联系电话";
}
if (StringUtils.isNotEmpty((String) invoiceData.get("wechat"))) {
return "个人发票不能填写微信号";
if (StringUtils.isEmpty((String) invoiceData.get("wechat"))) {
return "微信号不能为空";
}
}
// 企业发票验证
@ -519,19 +528,34 @@ public class InvoiceUtil {
if (StringUtils.isEmpty((String) invoiceData.get("phone"))) {
return "企业发票的联系电话不能为空";
}
if (StringUtils.isEmpty((String) invoiceData.get("bankName"))) {
return "企业发票的开户银行不能为空";
}
if (StringUtils.isEmpty((String) invoiceData.get("bankAccount"))) {
return "企业发票的银行账号不能为空";
}
// 格式验证
String taxNumber = (String) invoiceData.get("taxNumber");
if (!taxNumber.matches("^[A-Z0-9]{15,20}$")) {
return "纳税人识别号格式不正确";
return "税号格式不正确";
}
String phone = (String) invoiceData.get("phone");
if (!phone.matches("^1[3-9]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$|^400-?\\d{3}-?\\d{4}$")) {
return "联系电话格式不正确";
}
if (StringUtils.isEmpty((String) invoiceData.get("email"))) {
return "邮箱不能为空";
}
if (StringUtils.isEmpty((String) invoiceData.get("wechat"))) {
return "微信号不能为空";
}
}
return null; // 验证通过
}

View File

@ -53,6 +53,14 @@ public class UserGroupBuying extends BaseEntity
@Excel(name = "支付订单号")
private String transactionId;
/** 支付订单号 */
@Excel(name = "头像")
private String image;
/** 支付类别 */
@Excel(name = "支付状态 1成功 2不成功")
private Long paystatus;
/** 支付类别 */
@Excel(name = "支付类别")
private Long paytype;
@ -196,6 +204,22 @@ public class UserGroupBuying extends BaseEntity
return updatedAt;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public Long getPaystatus() {
return paystatus;
}
public void setPaystatus(Long paystatus) {
this.paystatus = paystatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -40,6 +40,10 @@ public class UserSecondaryCard extends BaseEntity
@Excel(name = "服务名称")
private String goodsname;
/** 服务id */
@Excel(name = "轮播图")
private String carouselImage;
/** 服务id */
@Excel(name = "简介")
@ -270,6 +274,14 @@ public class UserSecondaryCard extends BaseEntity
ServiceDetail = serviceDetail;
}
public String getCarouselImage() {
return carouselImage;
}
public void setCarouselImage(String carouselImage) {
this.carouselImage = carouselImage;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,309 @@
package com.ruoyi.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 预支付对象 users_pay_befor
*
* @author ruoyi
* @date 2025-07-11
*/
public class UsersPayBefor extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 用户id */
@Excel(name = "用户id")
private Long uid;
/** 支付类别1=微信支付 2=余额支付 3=组合支付 */
@Excel(name = "支付类别1=微信支付 2=余额支付 3=组合支付")
private Long paytype;
/** 微信支付金额 */
@Excel(name = "微信支付金额")
private BigDecimal wxmoney;
/** 余额支付金额 */
@Excel(name = "余额支付金额")
private BigDecimal yemoney;
/** 会员优惠金额 */
@Excel(name = "会员优惠金额")
private BigDecimal membermoney;
/** 购物金抵扣金额 */
@Excel(name = "购物金抵扣金额")
private BigDecimal shopmoney;
/** 服务金抵扣金额 */
@Excel(name = "服务金抵扣金额")
private BigDecimal servicemoney;
/** 服务金抵扣金额 */
@Excel(name = "总金额")
private BigDecimal allmoney;
/** 优惠券id */
@Excel(name = "优惠券id")
private Long couponid;
/** 优惠券金额 */
@Excel(name = "优惠券金额")
private BigDecimal couponmoney;
/** 美团号 */
@Excel(name = "美团号")
private String mtcode;
/** 美团抵扣金额 */
@Excel(name = "美团抵扣金额")
private BigDecimal mtmoney;
/** 订类别 1=拼团 2=次卡 3=秒杀 4=报价 0=普通预约(必填) */
@Excel(name = "订类别 1=拼团 2=次卡 3=秒杀 4=报价 0=普通预约", readConverterExp = "必=填")
private Long type;
/** 订单号码 */
@Excel(name = "订单号码")
private String orderid;
/** 订单id */
@Excel(name = "订单id")
private Long oid;
/** 状态 1待支付 2支付成功 */
@Excel(name = "状态 1待支付 2支付成功")
private Long status;
/** 支付时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date paytime;
/** 支付订单号 */
@Excel(name = "支付订单号")
private String paycode;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUid(Long uid)
{
this.uid = uid;
}
public Long getUid()
{
return uid;
}
public void setPaytype(Long paytype)
{
this.paytype = paytype;
}
public Long getPaytype()
{
return paytype;
}
public void setWxmoney(BigDecimal wxmoney)
{
this.wxmoney = wxmoney;
}
public BigDecimal getWxmoney()
{
return wxmoney;
}
public void setYemoney(BigDecimal yemoney)
{
this.yemoney = yemoney;
}
public BigDecimal getYemoney()
{
return yemoney;
}
public void setMembermoney(BigDecimal membermoney)
{
this.membermoney = membermoney;
}
public BigDecimal getMembermoney()
{
return membermoney;
}
public void setShopmoney(BigDecimal shopmoney)
{
this.shopmoney = shopmoney;
}
public BigDecimal getShopmoney()
{
return shopmoney;
}
public void setServicemoney(BigDecimal servicemoney)
{
this.servicemoney = servicemoney;
}
public BigDecimal getServicemoney()
{
return servicemoney;
}
public void setCouponid(Long couponid)
{
this.couponid = couponid;
}
public Long getCouponid()
{
return couponid;
}
public void setCouponmoney(BigDecimal couponmoney)
{
this.couponmoney = couponmoney;
}
public BigDecimal getCouponmoney()
{
return couponmoney;
}
public void setMtcode(String mtcode)
{
this.mtcode = mtcode;
}
public String getMtcode()
{
return mtcode;
}
public void setMtmoney(BigDecimal mtmoney)
{
this.mtmoney = mtmoney;
}
public BigDecimal getMtmoney()
{
return mtmoney;
}
public void setType(Long type)
{
this.type = type;
}
public Long getType()
{
return type;
}
public void setOrderid(String orderid)
{
this.orderid = orderid;
}
public String getOrderid()
{
return orderid;
}
public void setOid(Long oid)
{
this.oid = oid;
}
public Long getOid()
{
return oid;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public void setPaytime(Date paytime)
{
this.paytime = paytime;
}
public Date getPaytime()
{
return paytime;
}
public void setPaycode(String paycode)
{
this.paycode = paycode;
}
public String getPaycode()
{
return paycode;
}
public BigDecimal getAllmoney() {
return allmoney;
}
public void setAllmoney(BigDecimal allmoney) {
this.allmoney = allmoney;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("uid", getUid())
.append("paytype", getPaytype())
.append("wxmoney", getWxmoney())
.append("yemoney", getYemoney())
.append("membermoney", getMembermoney())
.append("shopmoney", getShopmoney())
.append("servicemoney", getServicemoney())
.append("couponid", getCouponid())
.append("couponmoney", getCouponmoney())
.append("mtcode", getMtcode())
.append("mtmoney", getMtmoney())
.append("type", getType())
.append("orderid", getOrderid())
.append("oid", getOid())
.append("status", getStatus())
.append("paytime", getPaytime())
.append("paycode", getPaycode())
.toString();
}
}

View File

@ -31,6 +31,17 @@ public interface ServiceCateMapper
public List<ServiceCate> selectServiceCateCiKaList();
public List<ServiceCate> selectServiceCatepintuanList();
public List<ServiceCate> selectServiceCateMiaoshaList();
public List<ServiceCate> selectServiceCateBaojiaList();
/**
* 新增服务分类
*

View File

@ -1,7 +1,10 @@
package com.ruoyi.system.mapper;
import java.util.List;
import java.util.Map;
import com.ruoyi.system.domain.UserGroupBuying;
import org.apache.ibatis.annotations.Param;
/**
* 拼团专区管理Mapper接口
@ -58,4 +61,11 @@ public interface UserGroupBuyingMapper
* @return 结果
*/
public int deleteUserGroupBuyingByIds(Long[] ids);
/**
* 分组查询返回name和image为字符串数组按product_id和orderid分组
* @param productId 产品ID可为null
* @return List<Map<String, Object>>
*/
List<Map<String, Object>> selectGroupBuyingGroupByProductAndOrder(@Param("productId") Integer productId);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.UsersPayBefor;
/**
* 预支付Mapper接口
*
* @author ruoyi
* @date 2025-07-11
*/
public interface UsersPayBeforMapper
{
/**
* 查询预支付
*
* @param id 预支付主键
* @return 预支付
*/
public UsersPayBefor selectUsersPayBeforById(Long id);
/**
* 查询预支付列表
*
* @param usersPayBefor 预支付
* @return 预支付集合
*/
public List<UsersPayBefor> selectUsersPayBeforList(UsersPayBefor usersPayBefor);
/**
* 新增预支付
*
* @param usersPayBefor 预支付
* @return 结果
*/
public int insertUsersPayBefor(UsersPayBefor usersPayBefor);
/**
* 修改预支付
*
* @param usersPayBefor 预支付
* @return 结果
*/
public int updateUsersPayBefor(UsersPayBefor usersPayBefor);
/**
* 删除预支付
*
* @param id 预支付主键
* @return 结果
*/
public int deleteUsersPayBeforById(Long id);
/**
* 批量删除预支付
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteUsersPayBeforByIds(Long[] ids);
}

View File

@ -30,6 +30,17 @@ public interface IServiceCateService
*/
public List<ServiceCate> selectServiceCateList(ServiceCate serviceCate);
public List<ServiceCate> selectServiceCatepintuanList();
public List<ServiceCate> selectServiceCateMiaoshaList();
public List<ServiceCate> selectServiceCateBaojiaList();
/**
* 新增服务分类
*

View File

@ -1,6 +1,8 @@
package com.ruoyi.system.service;
import java.util.List;
import java.util.Map;
import com.ruoyi.system.domain.UserGroupBuying;
/**
@ -58,4 +60,11 @@ public interface IUserGroupBuyingService
* @return 结果
*/
public int deleteUserGroupBuyingById(Long id);
/**
* 分组查询返回name和image为字符串数组按product_id和orderid分组
* @param productId 产品ID可为null
* @return List<Map<String, Object>>
*/
List<Map<String, Object>> selectGroupBuyingGroupByProductAndOrder(Integer productId);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.UsersPayBefor;
/**
* 预支付Service接口
*
* @author ruoyi
* @date 2025-07-11
*/
public interface IUsersPayBeforService
{
/**
* 查询预支付
*
* @param id 预支付主键
* @return 预支付
*/
public UsersPayBefor selectUsersPayBeforById(Long id);
/**
* 查询预支付列表
*
* @param usersPayBefor 预支付
* @return 预支付集合
*/
public List<UsersPayBefor> selectUsersPayBeforList(UsersPayBefor usersPayBefor);
/**
* 新增预支付
*
* @param usersPayBefor 预支付
* @return 结果
*/
public int insertUsersPayBefor(UsersPayBefor usersPayBefor);
/**
* 修改预支付
*
* @param usersPayBefor 预支付
* @return 结果
*/
public int updateUsersPayBefor(UsersPayBefor usersPayBefor);
/**
* 批量删除预支付
*
* @param ids 需要删除的预支付主键集合
* @return 结果
*/
public int deleteUsersPayBeforByIds(Long[] ids);
/**
* 删除预支付信息
*
* @param id 预支付主键
* @return 结果
*/
public int deleteUsersPayBeforById(Long id);
}

View File

@ -35,6 +35,26 @@ public class ServiceCateServiceImpl implements IServiceCateService
public List<ServiceCate> selectServiceCateCiKaList(){
return serviceCateMapper.selectServiceCateCiKaList();
}
public List<ServiceCate> selectServiceCatepintuanList(){
return serviceCateMapper.selectServiceCatepintuanList();
}
public List<ServiceCate> selectServiceCateMiaoshaList(){
return serviceCateMapper.selectServiceCateMiaoshaList();
}
public List<ServiceCate> selectServiceCateBaojiaList(){
return serviceCateMapper.selectServiceCateBaojiaList();
}
/**
* 查询服务分类列表
*

View File

@ -1,6 +1,8 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.UserGroupBuyingMapper;
@ -90,4 +92,14 @@ public class UserGroupBuyingServiceImpl implements IUserGroupBuyingService
{
return userGroupBuyingMapper.deleteUserGroupBuyingById(id);
}
/**
* 分组查询返回name和image为字符串数组按product_id和orderid分组
* @param productId 产品ID可为null
* @return List<Map<String, Object>>
*/
@Override
public List<Map<String, Object>> selectGroupBuyingGroupByProductAndOrder(Integer productId) {
return userGroupBuyingMapper.selectGroupBuyingGroupByProductAndOrder(productId);
}
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.UsersPayBeforMapper;
import com.ruoyi.system.domain.UsersPayBefor;
import com.ruoyi.system.service.IUsersPayBeforService;
/**
* 预支付Service业务层处理
*
* @author ruoyi
* @date 2025-07-11
*/
@Service
public class UsersPayBeforServiceImpl implements IUsersPayBeforService
{
@Autowired
private UsersPayBeforMapper usersPayBeforMapper;
/**
* 查询预支付
*
* @param id 预支付主键
* @return 预支付
*/
@Override
public UsersPayBefor selectUsersPayBeforById(Long id)
{
return usersPayBeforMapper.selectUsersPayBeforById(id);
}
/**
* 查询预支付列表
*
* @param usersPayBefor 预支付
* @return 预支付
*/
@Override
public List<UsersPayBefor> selectUsersPayBeforList(UsersPayBefor usersPayBefor)
{
return usersPayBeforMapper.selectUsersPayBeforList(usersPayBefor);
}
/**
* 新增预支付
*
* @param usersPayBefor 预支付
* @return 结果
*/
@Override
public int insertUsersPayBefor(UsersPayBefor usersPayBefor)
{
return usersPayBeforMapper.insertUsersPayBefor(usersPayBefor);
}
/**
* 修改预支付
*
* @param usersPayBefor 预支付
* @return 结果
*/
@Override
public int updateUsersPayBefor(UsersPayBefor usersPayBefor)
{
return usersPayBeforMapper.updateUsersPayBefor(usersPayBefor);
}
/**
* 批量删除预支付
*
* @param ids 需要删除的预支付主键
* @return 结果
*/
@Override
public int deleteUsersPayBeforByIds(Long[] ids)
{
return usersPayBeforMapper.deleteUsersPayBeforByIds(ids);
}
/**
* 删除预支付信息
*
* @param id 预支付主键
* @return 结果
*/
@Override
public int deleteUsersPayBeforById(Long id)
{
return usersPayBeforMapper.deleteUsersPayBeforById(id);
}
}

View File

@ -342,7 +342,7 @@
deleted_at,
</if>
<if test="fileData != null">
file_data = #{fileData},
file_data,
</if>
created_at,
updated_at

View File

@ -39,6 +39,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by parent_id ASC, sort ASC
</select>
<select id="selectServiceCatepintuanList" resultMap="ServiceCateResult">
<include refid="selectServiceCateVo"/>
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.isgroup='1' )
order by parent_id ASC, sort ASC
</select>
<select id="selectServiceCateMiaoshaList" resultMap="ServiceCateResult">
<include refid="selectServiceCateVo"/>
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.isfixed='1' )
order by parent_id ASC, sort ASC
</select>
<select id="selectServiceCateBaojiaList" resultMap="ServiceCateResult">
<include refid="selectServiceCateVo"/>
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.servicetype='2' )
order by parent_id ASC, sort ASC
</select>
<select id="selectServiceCateById" parameterType="Long" resultMap="ServiceCateResult">
<include refid="selectServiceCateVo"/>
where id = #{id}

View File

@ -68,6 +68,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdStart != null and createdEnd != null">
and created_at BETWEEN #{createdStart} AND #{createdEnd}
</if>
<if test="isfixed != null "> and isfixed = #{isfixed}</if>
<if test="servicetype != null "> and servicetype = #{servicetype}</if>
<if test="cateId != null "> and cate_id = #{cateId}</if>
<if test="firstCateId != null "> and first_cate_id = #{firstCateId}</if>
<if test="secondCateId != null "> and second_cate_id = #{secondCateId}</if>

View File

@ -15,13 +15,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="paytime" column="paytime" />
<result property="transactionId" column="transaction_id" />
<result property="paytype" column="paytype" />
<result property="image" column="image" />
<result property="paystatus" column="paystatus" />
<result property="productId" column="product_id" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectUserGroupBuyingVo">
select id, orderid, uid, money, status, deduction, uname, paytime, transaction_id, paytype, product_id, created_at, updated_at from user_group_buying
select id, orderid, uid, money, status, deduction, paystatus,image,uname, paytime, transaction_id, paytype, product_id, created_at, updated_at from user_group_buying
</sql>
<select id="selectUserGroupBuyingList" parameterType="UserGroupBuying" resultMap="UserGroupBuyingResult">
@ -53,6 +55,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="transactionId != null">transaction_id,</if>
<if test="paytype != null">paytype,</if>
<if test="productId != null">product_id,</if>
<if test="image != null">image,</if>
<if test="paystatus != null">paystatus,</if>
created_at,
updated_at
</trim>
@ -68,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="transactionId != null">#{transactionId},</if>
<if test="paytype != null">#{paytype},</if>
<if test="productId != null">#{productId},</if>
<if test="image != null">#{image},</if>
<if test="paystatus != null">#{paystatus},</if>
NOW(),
NOW()
</trim>
@ -78,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="orderid != null">orderid = #{orderid},</if>
<if test="uid != null">uid = #{uid},</if>
<if test="image != null">image = #{image},</if>
<if test="money != null">money = #{money},</if>
<if test="status != null">status = #{status},</if>
<if test="deduction != null">deduction = #{deduction},</if>
@ -86,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="transactionId != null">transaction_id = #{transactionId},</if>
<if test="paytype != null">paytype = #{paytype},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="paystatus != null">paystatus = #{paystatus},</if>
updated_at = NOW(),
</trim>
where id = #{id}
@ -101,4 +110,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<!-- 新增分组查询返回name和image为字符串数组 -->
<select id="selectGroupBuyingGroupByProductAndOrder" resultType="map">
SELECT
CONCAT('[', GROUP_CONCAT('"', uname, '"'), ']') AS name,
CONCAT('[', GROUP_CONCAT('"', image, '"'), ']') AS image,
product_id,
orderid
FROM
user_group_buying
WHERE
status = 1 and paystatus=1
<if test="productId != null">AND product_id = #{productId}</if>
GROUP BY
product_id, orderid
</select>
</mapper>

View File

@ -18,12 +18,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updatedAt" column="updated_at" />
<result property="type" column="type" />
<result property="num" column="num" />
<result property="carouselImage" column="carouselImage" />
<result property="introduction" column="introduction" />
<result property="allnum" column="allnum" />
</resultMap>
<sql id="selectUserSecondaryCardVo">
select id, orderid, title, goodsids, show_money, real_money, introduction,showimage, status, creattime, created_at, updated_at, type, num, allnum from user_secondary_card
select id, orderid, title, goodsids, show_money, real_money, carouselImage,introduction,showimage, status, creattime, created_at, updated_at, type, num, allnum from user_secondary_card
</sql>
<select id="selectUserSecondaryCardList" parameterType="UserSecondaryCard" resultMap="UserSecondaryCardResult">
@ -63,6 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="num != null">num,</if>
<if test="allnum != null">allnum,</if>
<if test="introduction != null">introduction,</if>
<if test="carouselImage != null">carouselImage,</if>
created_at,
updated_at
@ -80,6 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="num != null">#{num},</if>
<if test="allnum != null">#{allnum},</if>
<if test="introduction != null">#{introduction},</if>
<if test="carouselImage != null">#{carouselImage},</if>
NOW(),
NOW()
@ -101,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="num != null">num = #{num},</if>
<if test="allnum != null">allnum = #{allnum},</if>
<if test="introduction != null">introduction = #{introduction},</if>
<if test="carouselImage != null">carouselImage = #{carouselImage},</if>
updated_at = NOW(),
</trim>
where id = #{id}

View File

@ -55,7 +55,7 @@
order by created_at desc
</select>
<select id="selectUsersInvoiceInfoById" parameterType="Long" resultMap="UsersInvoiceInfoResult">
<select id="selectUsersInvoiceInfoById" parameterType="Integer" resultMap="UsersInvoiceInfoResult">
<include refid="selectUsersInvoiceInfoVo"/>
where id = #{id}
</select>

View File

@ -40,7 +40,6 @@
<result property="ismember" column="ismember"/>
<result property="memberBegin" column="member_begin"/>
<result property="memberEnd" column="member_end"/>
<result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at"/>
</resultMap>

View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.UsersPayBeforMapper">
<resultMap type="UsersPayBefor" id="UsersPayBeforResult">
<result property="id" column="id" />
<result property="uid" column="uid" />
<result property="paytype" column="paytype" />
<result property="wxmoney" column="wxmoney" />
<result property="yemoney" column="yemoney" />
<result property="membermoney" column="membermoney" />
<result property="shopmoney" column="shopmoney" />
<result property="servicemoney" column="servicemoney" />
<result property="couponid" column="couponid" />
<result property="couponmoney" column="couponmoney" />
<result property="mtcode" column="mtcode" />
<result property="mtmoney" column="mtmoney" />
<result property="allmoney" column="allmoney" />
<result property="type" column="type" />
<result property="orderid" column="orderid" />
<result property="oid" column="oid" />
<result property="status" column="status" />
<result property="paytime" column="paytime" />
<result property="paycode" column="paycode" />
</resultMap>
<sql id="selectUsersPayBeforVo">
select id, uid, paytype, wxmoney, yemoney, allmoney,membermoney, shopmoney, servicemoney, couponid, couponmoney, mtcode, mtmoney, type, orderid, oid, status, paytime, paycode from users_pay_befor
</sql>
<select id="selectUsersPayBeforList" parameterType="UsersPayBefor" resultMap="UsersPayBeforResult">
<include refid="selectUsersPayBeforVo"/>
<where>
<if test="uid != null "> and uid = #{uid}</if>
<if test="paytype != null "> and paytype = #{paytype}</if>
<if test="wxmoney != null "> and wxmoney = #{wxmoney}</if>
<if test="yemoney != null "> and yemoney = #{yemoney}</if>
<if test="membermoney != null "> and membermoney = #{membermoney}</if>
<if test="shopmoney != null "> and shopmoney = #{shopmoney}</if>
<if test="servicemoney != null "> and servicemoney = #{servicemoney}</if>
<if test="couponid != null "> and couponid = #{couponid}</if>
<if test="couponmoney != null "> and couponmoney = #{couponmoney}</if>
<if test="mtcode != null and mtcode != ''"> and mtcode = #{mtcode}</if>
<if test="mtmoney != null "> and mtmoney = #{mtmoney}</if>
<if test="type != null "> and type = #{type}</if>
<if test="orderid != null and orderid != ''"> and orderid = #{orderid}</if>
<if test="oid != null "> and oid = #{oid}</if>
<if test="status != null "> and status = #{status}</if>
<if test="paytime != null "> and paytime = #{paytime}</if>
<if test="paycode != null and paycode != ''"> and paycode = #{paycode}</if>
</where>
</select>
<select id="selectUsersPayBeforById" parameterType="Long" resultMap="UsersPayBeforResult">
<include refid="selectUsersPayBeforVo"/>
where id = #{id}
</select>
<insert id="insertUsersPayBefor" parameterType="UsersPayBefor" useGeneratedKeys="true" keyProperty="id">
insert into users_pay_befor
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">uid,</if>
<if test="paytype != null">paytype,</if>
<if test="wxmoney != null">wxmoney,</if>
<if test="yemoney != null">yemoney,</if>
<if test="membermoney != null">membermoney,</if>
<if test="shopmoney != null">shopmoney,</if>
<if test="servicemoney != null">servicemoney,</if>
<if test="couponid != null">couponid,</if>
<if test="couponmoney != null">couponmoney,</if>
<if test="mtcode != null">mtcode,</if>
<if test="mtmoney != null">mtmoney,</if>
<if test="type != null">type,</if>
<if test="orderid != null">orderid,</if>
<if test="oid != null">oid,</if>
<if test="status != null">status,</if>
<if test="paytime != null">paytime,</if>
<if test="paycode != null">paycode,</if>
<if test="allmoney != null">allmoney,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">#{uid},</if>
<if test="paytype != null">#{paytype},</if>
<if test="wxmoney != null">#{wxmoney},</if>
<if test="yemoney != null">#{yemoney},</if>
<if test="membermoney != null">#{membermoney},</if>
<if test="shopmoney != null">#{shopmoney},</if>
<if test="servicemoney != null">#{servicemoney},</if>
<if test="couponid != null">#{couponid},</if>
<if test="couponmoney != null">#{couponmoney},</if>
<if test="mtcode != null">#{mtcode},</if>
<if test="mtmoney != null">#{mtmoney},</if>
<if test="type != null">#{type},</if>
<if test="orderid != null">#{orderid},</if>
<if test="oid != null">#{oid},</if>
<if test="status != null">#{status},</if>
<if test="paytime != null">#{paytime},</if>
<if test="paycode != null">#{paycode},</if>
<if test="allmoney != null">#{allmoney},</if>
</trim>
</insert>
<update id="updateUsersPayBefor" parameterType="UsersPayBefor">
update users_pay_befor
<trim prefix="SET" suffixOverrides=",">
<if test="uid != null">uid = #{uid},</if>
<if test="paytype != null">paytype = #{paytype},</if>
<if test="wxmoney != null">wxmoney = #{wxmoney},</if>
<if test="yemoney != null">yemoney = #{yemoney},</if>
<if test="membermoney != null">membermoney = #{membermoney},</if>
<if test="shopmoney != null">shopmoney = #{shopmoney},</if>
<if test="servicemoney != null">servicemoney = #{servicemoney},</if>
<if test="couponid != null">couponid = #{couponid},</if>
<if test="couponmoney != null">couponmoney = #{couponmoney},</if>
<if test="mtcode != null">mtcode = #{mtcode},</if>
<if test="mtmoney != null">mtmoney = #{mtmoney},</if>
<if test="type != null">type = #{type},</if>
<if test="orderid != null">orderid = #{orderid},</if>
<if test="oid != null">oid = #{oid},</if>
<if test="status != null">status = #{status},</if>
<if test="paytime != null">paytime = #{paytime},</if>
<if test="paycode != null">paycode = #{paycode},</if>
<if test="allmoney != null">allmoney = #{allmoney},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteUsersPayBeforById" parameterType="Long">
delete from users_pay_befor where id = #{id}
</delete>
<delete id="deleteUsersPayBeforByIds" parameterType="String">
delete from users_pay_befor where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -115,7 +115,7 @@ export default {
onEnd: (evt) => {
const movedItem = this.fileList.splice(evt.oldIndex, 1)[0]
this.fileList.splice(evt.newIndex, 0, movedItem)
this.$emit("input", this.listToString(this.fileList))
this.$emit("input", this.fileList.map(f => this.getPureUrl(f.url)))
}
})
})
@ -226,7 +226,7 @@ export default {
const findex = this.fileList.map(f => f.name).indexOf(file.name)
if (findex > -1) {
this.fileList.splice(findex, 1)
this.$emit("input", this.listToString(this.fileList))
this.$emit("input", this.fileList.map(f => this.getPureUrl(f.url)))
}
},
//
@ -240,7 +240,7 @@ export default {
this.fileList = this.fileList.concat(this.uploadList)
this.uploadList = []
this.number = 0
this.$emit("input", this.listToString(this.fileList))
this.$emit("input", this.fileList.map(f => this.getPureUrl(f.url)))
this.$modal.closeLoading()
}
},
@ -265,6 +265,17 @@ export default {
}
}
return strs != '' ? strs.substr(0, strs.length - 1) : ''
},
// baseUrl/dev-api
getPureUrl(url) {
if (!url) return '';
if (url.startsWith(this.baseUrl)) {
return url.replace(this.baseUrl, "");
}
if (url.startsWith("/dev-api")) {
return url.replace("/dev-api", "");
}
return url;
}
}
}

View File

@ -149,6 +149,9 @@
<el-radio :label="2">首页宣传</el-radio>
<el-radio :label="3">积分商城</el-radio>
<el-radio :label="4">商城轮播</el-radio>
<el-radio :label="5">次卡</el-radio>
<el-radio :label="6">秒杀</el-radio>
<el-radio :label="7">拼团</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="图片" prop="image" required>

View File

@ -237,12 +237,12 @@
</template>
</el-table-column>
<el-table-column label="是否为一口价" align="center" prop="isfixed">
<el-table-column label="是否为秒杀" align="center" prop="isfixed">
<template slot-scope="scope">
<dict-tag :options="dict.type.fixed" :value="scope.row.isfixed"/>
</template>
</el-table-column>
<el-table-column label="一口价价格" align="center" prop="fixedprice" />
<el-table-column label="秒杀价格" align="center" prop="fixedprice" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -530,7 +530,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="是否为一口价" prop="isfixed">
<el-form-item label="是否为秒杀" prop="isfixed">
<el-radio-group v-model="form.isfixed">
<el-radio
v-for="dict in dict.type.fixed"
@ -539,8 +539,8 @@
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="一口价价格" prop="fixedprice" v-if="form.isfixed === 1">
<el-input-number v-model="form.fixedprice" :min="0" :step="0.01" :precision="2" placeholder="请输入一口价价格" style="width: 200px"/>
<el-form-item label="秒杀价格" prop="fixedprice" v-if="form.isfixed === 1">
<el-input-number v-model="form.fixedprice" :min="0" :step="0.01" :precision="2" placeholder="请输入秒杀价格" style="width: 200px"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-switch

View File

@ -116,9 +116,18 @@
<span class="price-text price-highlight">¥ {{ scope.row.realMoney !== undefined && scope.row.realMoney !== null ? parseFloat(scope.row.realMoney).toFixed(2) : '0.00' }}</span>
</template>
</el-table-column>
<el-table-column label="展示图片" align="center" prop="showimage" width="100">
<el-table-column label="展示图片" align="center" prop="showimage" width="180">
<template slot-scope="scope">
<image-preview v-if="scope.row.showimage" :src="scope.row.showimage" :width="50" :height="50"/>
<div v-if="parseImageArray(scope.row.showimage).length">
<image-preview
v-for="(img, idx) in parseImageArray(scope.row.showimage)"
:key="idx"
:src="img"
:width="50"
:height="50"
style="margin-right: 4px"
/>
</div>
<span v-else>-</span>
</template>
</el-table-column>
@ -188,7 +197,7 @@
<el-form-item label="简介" prop="introduction">
<el-input v-model="form.introduction" placeholder="请输入简介" />
</el-form-item>
<el-form-item label="服务项目" prop="goodsids">
<el-select
v-model="form.goodsids"
@ -234,9 +243,13 @@
style="width: 100%"
/>
</el-form-item>
<el-form-item label="展示图片" prop="showimage">
<image-upload v-model="form.showimage"/>
<el-form-item label="主图" prop="showimage">
<image-upload v-model="form.showimage" :multiple="false" />
</el-form-item>
<el-form-item label="轮播图" prop="carouselImage">
<image-upload v-model="form.carouselImage" :multiple="true" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
@ -393,7 +406,7 @@ export default {
goodsids: null,
showMoney: null,
realMoney: null,
showimage: null,
showimage: '',
status: null,
creattime: null,
createdAt: null,
@ -401,7 +414,8 @@ export default {
introduction: null,
type: null,
num: null,
allnum: null
allnum: null,
carouselImage: []
}
this.resetForm("form")
},
@ -444,6 +458,16 @@ export default {
})
},
parseImageArray(val) {
if (!val) return [];
if (Array.isArray(val)) return val;
try {
const arr = JSON.parse(val);
if (Array.isArray(arr)) return arr;
} catch (e) {}
return [];
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -452,6 +476,56 @@ export default {
const id = row.id || this.ids
getUserSecondaryCard(id).then(response => {
this.form = response.data
// showimage
if (this.form.showimage) {
if (Array.isArray(this.form.showimage)) {
this.form.showimage = this.form.showimage.length > 0 ? this.form.showimage[0] : '';
} else if (typeof this.form.showimage === 'string') {
//
} else if (this.form.showimage && this.form.showimage.url) {
this.form.showimage = this.form.showimage.url;
}
} else {
this.form.showimage = '';
}
//
if (this.form.carouselImage) {
try {
const arr = JSON.parse(this.form.carouselImage)
if (Array.isArray(arr)) {
this.form.carouselImage = arr.map(item => {
if (typeof item === 'string') return item;
if (item && item.url) return item.url;
return '';
}).filter(Boolean);
} else {
this.form.carouselImage = []
}
} catch (e) {
this.form.carouselImage = []
}
} else {
this.form.carouselImage = []
}
//
if (this.form.showimage) {
try {
const arr = JSON.parse(this.form.showimage)
if (Array.isArray(arr)) {
this.form.showimage = arr.map(item => {
if (typeof item === 'string') return item;
if (item && item.url) return item.url;
return '';
}).filter(Boolean);
} else {
this.form.showimage = []
}
} catch (e) {
this.form.showimage = []
}
} else {
this.form.showimage = []
}
// goodsidsJSON
if (this.form.goodsids) {
if (typeof this.form.goodsids === 'string') {
@ -480,8 +554,31 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
// goodsidsJSON
const submitForm = { ...this.form, goodsids: Array.isArray(this.form.goodsids) ? JSON.stringify(this.form.goodsids.map(String)) : this.form.goodsids }
// showimage
let showimageVal = '';
if (Array.isArray(this.form.showimage)) {
showimageVal = this.form.showimage.length > 0 ? this.form.showimage[0] : '';
} else if (typeof this.form.showimage === 'string') {
showimageVal = this.form.showimage;
} else if (this.form.showimage && this.form.showimage.url) {
showimageVal = this.form.showimage.url;
}
// URL
let carouselArr = [];
if (Array.isArray(this.form.carouselImage)) {
carouselArr = this.form.carouselImage.map(item => {
if (typeof item === 'string') return item;
if (item && item.url) return item.url;
return '';
}).filter(Boolean);
}
const submitForm = {
...this.form,
showimage: showimageVal,
carouselImage: JSON.stringify(carouselArr),
goodsids: Array.isArray(this.form.goodsids) ? JSON.stringify(this.form.goodsids.map(String)) : this.form.goodsids
}
if (this.form.id != null) {
updateUserSecondaryCard(submitForm).then(response => {
this.$modal.msgSuccess("修改成功")