Compare commits

..

No commits in common. "862d245b4e9af4e8f37c1c5704d5b70980a45b2b" and "ad786a8b0dbd720adfdc446056bfcd37dda04405" have entirely different histories.

54 changed files with 1433 additions and 6199 deletions

View File

@ -100,7 +100,7 @@ public class CommonController
String fileUrl = QiniuUploadUtil.uploadFile(file); String fileUrl = QiniuUploadUtil.uploadFile(file);
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("url", fileUrl); ajax.put("url", fileUrl);
ajax.put("EditorURL",fileUrl); ajax.put("EditorURL", "https://" + getQiniuConfig().getDomain() + "/" +fileUrl);
ajax.put("fileName", fileUrl); ajax.put("fileName", fileUrl);
ajax.put("newFileName", FileUtils.getName(file.getOriginalFilename())); ajax.put("newFileName", FileUtils.getName(file.getOriginalFilename()));
ajax.put("originalFilename", file.getOriginalFilename()); ajax.put("originalFilename", file.getOriginalFilename());

View File

@ -61,13 +61,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 获取分页参数 // 3. 获取分页参数
@ -98,13 +98,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 获取分页参数 // 3. 获取分页参数
@ -135,13 +135,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 获取分页参数 // 3. 获取分页参数
@ -175,13 +175,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
@ -256,13 +256,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 获取用户发票信息列表 // 3. 获取用户发票信息列表
@ -288,13 +288,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 获取统计数据 // 3. 获取统计数据
@ -321,13 +321,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
@ -410,13 +410,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 获取用户发票信息列表 // 3. 获取用户发票信息列表
@ -443,13 +443,13 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 删除发票信息简化实现 // 3. 删除发票信息简化实现
@ -472,7 +472,7 @@ public class AppleInvoiceController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning(""); return AppletControllerUtil.appletUnauthorized();
} }
UsersInvoiceInfo invoiceInfo = usersInvoiceInfoService.selectUsersInvoiceInfoById(id); UsersInvoiceInfo invoiceInfo = usersInvoiceInfoService.selectUsersInvoiceInfoById(id);
if (invoiceInfo == null) { if (invoiceInfo == null) {

View File

@ -1,7 +1,6 @@
package com.ruoyi.system.controller; package com.ruoyi.system.controller;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
@ -88,12 +87,6 @@ public class AppleMemberController extends BaseController {
@Autowired @Autowired
private IUserBenefitPointsService userBenefitPointsService; private IUserBenefitPointsService userBenefitPointsService;
@Autowired
private IGoodsOrderService goodsOrderService;
@Autowired @Autowired
private WechatPayUtil wechatPayUtil; private WechatPayUtil wechatPayUtil;
@ -573,13 +566,13 @@ public class AppleMemberController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 参数验证 // 3. 参数验证
@ -588,13 +581,11 @@ public class AppleMemberController extends BaseController {
} }
String orderId = params.get("order_id").toString(); String orderId = params.get("order_id").toString();
String type = params.get("type").toString();
String content = params.get("content").toString(); String content = params.get("content").toString();
Integer num = Integer.parseInt(params.get("num").toString()); Integer num = Integer.parseInt(params.get("num").toString());
if (type.equals("service")){
// 4. 获取订单信息并验证 // 4. 获取订单信息并验证
Order order = orderService.selectOrderById(Long.valueOf(orderId)); Order order = orderService.selectOrderByOrderId(orderId);
if (order == null) { if (order == null) {
return AppletControllerUtil.appletWarning("订单不存在"); return AppletControllerUtil.appletWarning("订单不存在");
} }
@ -618,33 +609,30 @@ public class AppleMemberController extends BaseController {
// 7. 构建评价数据 // 7. 构建评价数据
OrderComment comment = new OrderComment(); OrderComment comment = new OrderComment();
comment.setOid(order.getId()); comment.setOid(order.getId());
comment.setOrderId(order.getOrderId()); comment.setOrderId(orderId);
comment.setProductId(order.getProductId()); comment.setProductId(order.getProductId());
comment.setContent(content); comment.setContent(content);
comment.setNum(Long.valueOf(num)); comment.setNum(Long.valueOf(num));
comment.setNumType(Long.valueOf(numType)); comment.setNumType(Long.valueOf(numType));
comment.setUid(user.getId()); comment.setUid(user.getId());
comment.setWorkerId(order.getWorkerId()); comment.setWorkerId(order.getWorkerId());
comment.setStatus(1);
//JSONArray jsonArrayimg=new JSONArray();
// 8. 处理图片附件 // 8. 处理图片附件
if (params.containsKey("images") && params.get("images") != null) { if (params.containsKey("images") && params.get("images") != null) {
String images = JSON.toJSONString(params.get("images")); String images = JSON.toJSONString(params.get("images"));
comment.setImages(images); comment.setImages(images);
//jsonArrayimg
} }
JSONArray jsonArray=new JSONArray();
// 9. 处理评价标签 // 9. 处理评价标签
if (params.containsKey("labels") && params.get("labels") != null) { if (params.containsKey("labels") && params.get("labels") != null) {
String labels = JSON.toJSONString(params.get("labels")); String labels = JSON.toJSONString(params.get("labels"));
comment.setLabels(labels); comment.setLabels(labels);
// jsonArray = JSON.parseArray(labels);
} }
// 10. 保存评价并更新订单状态 // 10. 保存评价并更新订单状态
// 保存评价 // 保存评价
orderCommentService.insertOrderComment(comment); orderCommentService.insertOrderComment(comment);
// 添加订单日志 // 添加订单日志
OrderLog orderLog = new OrderLog(); OrderLog orderLog = new OrderLog();
orderLog.setOid(order.getId()); orderLog.setOid(order.getId());
@ -655,7 +643,6 @@ public class AppleMemberController extends BaseController {
Map<String, Object> logContent = new HashMap<>(); Map<String, Object> logContent = new HashMap<>();
logContent.put("text", content); logContent.put("text", content);
logContent.put("image", params.get("images")); logContent.put("image", params.get("images"));
logContent.put("labels", params.get("labels"));
logContent.put("num", num); logContent.put("num", num);
orderLog.setContent(JSON.toJSONString(logContent)); orderLog.setContent(JSON.toJSONString(logContent));
@ -665,67 +652,6 @@ public class AppleMemberController extends BaseController {
order.setStatus(4L); // 4=完成状态 order.setStatus(4L); // 4=完成状态
order.setIsComment(1); // 1=已评价 order.setIsComment(1); // 1=已评价
orderService.updateOrder(order); orderService.updateOrder(order);
}
if (type.equals("goods")){{
GoodsOrder goodsOrder = goodsOrderService.selectGoodsOrderById(Long.valueOf(orderId));
// 4. 获取订单信息并验证
if (goodsOrder == null) {
return AppletControllerUtil.appletWarning("订单不存在");
}
// 5. 检查是否已经评价过
int count = orderCommentService.selectCountOrderCommentByOid(goodsOrder.getId());
if (count > 0) {
return AppletControllerUtil.appletWarning("请勿重复提交");
}
// 6. 计算评分类型
Integer numType;
if (num == 1) {
numType = 3; // 差评
} else if (num == 2 || num == 3) {
numType = 2; // 中评
} else {
numType = 1; // 好评
}
// 7. 构建评价数据
OrderComment comment = new OrderComment();
comment.setOid(goodsOrder.getId());
comment.setOrderId(goodsOrder.getOrderId());
comment.setProductId(goodsOrder.getProductId());
comment.setContent(content);
comment.setNum(Long.valueOf(num));
comment.setNumType(Long.valueOf(numType));
comment.setUid(user.getId());
comment.setStatus(1);
// 8. 处理图片附件
if (params.containsKey("images") && params.get("images") != null) {
String images = JSON.toJSONString(params.get("images"));
comment.setImages(images);
}
// 9. 处理评价标签
if (params.containsKey("labels") && params.get("labels") != null) {
String labels = JSON.toJSONString(params.get("labels"));
comment.setLabels(labels);
}
// 10. 保存评价并更新订单状态
// 保存评价
int result= orderCommentService.insertOrderComment(comment);
if (result > 0) {
goodsOrder.setStatus(5L); // 订单状态改为已收货
goodsOrderService.updateGoodsOrder(goodsOrder);
return AjaxResult.success();
} else {
return AppletControllerUtil.appletWarning("操作失败");
}
}
}
return AjaxResult.success("评价提交成功"); return AjaxResult.success("评价提交成功");
@ -753,13 +679,13 @@ public class AppleMemberController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletUnauthorized();
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证图像和昵称是否为系统默认 // 3. 验证图像和昵称是否为系统默认
@ -827,13 +753,13 @@ public class AppleMemberController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
@ -860,7 +786,7 @@ public class AppleMemberController extends BaseController {
// 7. 处理报价 // 7. 处理报价
UserDemandQuotation quoteRecord; UserDemandQuotation quoteRecord;
//boolean isFirstQuote = false; boolean isFirstQuote = false;
if (existingQuotes != null && !existingQuotes.isEmpty()) { if (existingQuotes != null && !existingQuotes.isEmpty()) {
// 已有报价更新 // 已有报价更新
quoteRecord = existingQuotes.getFirst(); quoteRecord = existingQuotes.getFirst();
@ -873,7 +799,6 @@ public class AppleMemberController extends BaseController {
quoteRecord = new UserDemandQuotation(); quoteRecord = new UserDemandQuotation();
quoteRecord.setWorkerid(user.getId()); quoteRecord.setWorkerid(user.getId());
quoteRecord.setOrderid(orderId); quoteRecord.setOrderid(orderId);
quoteRecord.setOid(order.getId());
quoteRecord.setMoney(quoteMoney); quoteRecord.setMoney(quoteMoney);
quoteRecord.setQuotationTime(new Date()); quoteRecord.setQuotationTime(new Date());
quoteRecord.setStatus(1L); // 设置状态为有效 quoteRecord.setStatus(1L); // 设置状态为有效
@ -881,14 +806,14 @@ public class AppleMemberController extends BaseController {
quoteRecord.setWorkerimage(user.getAvatar()); quoteRecord.setWorkerimage(user.getAvatar());
quoteRecord.setCreateTime(new Date()); quoteRecord.setCreateTime(new Date());
userDemandQuotationService.insertUserDemandQuotation(quoteRecord); userDemandQuotationService.insertUserDemandQuotation(quoteRecord);
// isFirstQuote = true; isFirstQuote = true;
} }
// // 8. 如果是第一次报价更新订单状态为待选择12 // 8. 如果是第一次报价更新订单状态为待选择12
// if (isFirstQuote) { if (isFirstQuote) {
// order.setStatus(12L); order.setStatus(12L);
// orderService.updateOrder(order); orderService.updateOrder(order);
// } }
return AppletControllerUtil.appletSuccess("报价成功"); return AppletControllerUtil.appletSuccess("报价成功");
@ -933,13 +858,13 @@ public class AppleMemberController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletUnauthorized();
} }
// 3. 获取用户信息 // 3. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 4. 设置分页参数 // 4. 设置分页参数

View File

@ -151,7 +151,7 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 验证必要参数 // 2. 验证必要参数
@ -214,7 +214,7 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 验证必要参数 // 2. 验证必要参数
@ -345,13 +345,13 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 验证必要参数 // 2. 验证必要参数
if (params == null || params.get("orderNo") == null || params.get("refundNo") == null if (params == null || params.get("orderNo") == null || params.get("refundNo") == null
|| params.get("totalFee") == null || params.get("refundFee") == null) { || params.get("totalFee") == null || params.get("refundFee") == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("退款参数不完整");
} }
// 3. 验证退款金额 // 3. 验证退款金额
@ -405,12 +405,12 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 验证必要参数 // 2. 验证必要参数
if (params == null || params.get("orderNo") == null) { if (params == null || params.get("orderNo") == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("订单号不能为空");
} }
// 3. 查询支付结果 // 3. 查询支付结果
@ -461,13 +461,13 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 参数验证逻辑id和money必须有一个有值如果都有值则优先使用id // 3. 参数验证逻辑id和money必须有一个有值如果都有值则优先使用id
Object idObj = params.get("id"); Object idObj = params.get("id");
@ -569,12 +569,12 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
if (params == null || params.get("order_id") == null || params.get("worker_id") == null) { if (params == null || params.get("order_id") == null || params.get("worker_id") == null) {
@ -665,13 +665,13 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
@ -754,13 +754,13 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
@ -830,13 +830,13 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
@ -909,13 +909,13 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
@ -995,7 +995,7 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 验证必要参数 // 2. 验证必要参数
@ -1050,13 +1050,13 @@ public class ApplePayController extends BaseController {
String token = request.getHeader("token"); String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService); Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
if (!(Boolean) userValidation.get("valid")) { if (!(Boolean) userValidation.get("valid")) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户未登录或token无效");
} }
// 2. 获取用户信息 // 2. 获取用户信息
Users user = (Users) userValidation.get("user"); Users user = (Users) userValidation.get("user");
if (user == null) { if (user == null) {
return AppletControllerUtil.appletdengluWarning("用户信息获取失败"); return AppletControllerUtil.appletWarning("用户信息获取失败");
} }
// 3. 验证必要参数 // 3. 验证必要参数
@ -1077,7 +1077,12 @@ public class ApplePayController extends BaseController {
}else{ }else{
} }
} }
// 4. 获取订单日志信息 // 4. 获取订单日志信息
Long orderId = Long.valueOf(params.get("id").toString()); Long orderId = Long.valueOf(params.get("id").toString());
OrderLog orderLog = orderLogService.selectOrderLogById(orderId); OrderLog orderLog = orderLogService.selectOrderLogById(orderId);
@ -1117,6 +1122,7 @@ public class ApplePayController extends BaseController {
return AppletControllerUtil.appletError("支付失败:" + e.getMessage()); return AppletControllerUtil.appletError("支付失败:" + e.getMessage());
} }
} }
/** /**
* 订单支付接口 * 订单支付接口
* 根据订单号查询预支付信息并根据预支付信息中的支付方式和金额进行支付 * 根据订单号查询预支付信息并根据预支付信息中的支付方式和金额进行支付
@ -1168,13 +1174,7 @@ public class ApplePayController extends BaseController {
if (paytype == 1) { if (paytype == 1) {
// 微信支付 // 微信支付
if (wxMoney.compareTo(BigDecimal.ZERO) <= 0) { if (wxMoney.compareTo(BigDecimal.ZERO) <= 0) {
// 金额为0直接走后续逻辑 return AppletControllerUtil.appletWarning("微信支付金额不能为0");
payBefor.setStatus(2L); // 已支付
payBefor.setPaytime(new Date());
usersPayBeforService.updateUsersPayBefor(payBefor);
OrderUtil.prepayCallback(payBefor, user);
payResult.put("istowx", 1);
return AppletControllerUtil.appletSuccess("支付成功");
} }
payResult = wechatPayUtil.createBatchOrderAndPay( payResult = wechatPayUtil.createBatchOrderAndPay(
user.getOpenid(), user.getOpenid(),
@ -1193,13 +1193,7 @@ public class ApplePayController extends BaseController {
} else if (paytype == 2) { } else if (paytype == 2) {
// 余额支付 // 余额支付
if (yeMoney.compareTo(BigDecimal.ZERO) <= 0) { if (yeMoney.compareTo(BigDecimal.ZERO) <= 0) {
// 金额为0直接走后续逻辑 return AppletControllerUtil.appletWarning("余额支付金额不能为0");
payBefor.setStatus(2L); // 已支付
payBefor.setPaytime(new Date());
usersPayBeforService.updateUsersPayBefor(payBefor);
OrderUtil.prepayCallback(payBefor, user);
payResult.put("istowx", 2);
return AppletControllerUtil.appletSuccess("支付成功");
} }
Map<String, Object> balanceResult = BalancePayUtil.processBalancePayment( Map<String, Object> balanceResult = BalancePayUtil.processBalancePayment(
user.getId(), user.getId(),
@ -1221,15 +1215,6 @@ public class ApplePayController extends BaseController {
} }
} else if (paytype == 3) { } else if (paytype == 3) {
// 组合支付 // 组合支付
if (wxMoney.compareTo(BigDecimal.ZERO) <= 0 && yeMoney.compareTo(BigDecimal.ZERO) <= 0) {
// 两项都为0直接走后续逻辑
payBefor.setStatus(2L); // 已支付
payBefor.setPaytime(new Date());
usersPayBeforService.updateUsersPayBefor(payBefor);
OrderUtil.prepayCallback(payBefor, user);
payResult.put("istowx", 1);
return AppletControllerUtil.appletSuccess("支付成功");
}
if (wxMoney.compareTo(BigDecimal.ZERO) > 0 && yeMoney.compareTo(BigDecimal.ZERO) > 0) { if (wxMoney.compareTo(BigDecimal.ZERO) > 0 && yeMoney.compareTo(BigDecimal.ZERO) > 0) {
// // 先扣余额 // // 先扣余额
// Map<String, Object> balanceResult = BalancePayUtil.processBalancePayment( // Map<String, Object> balanceResult = BalancePayUtil.processBalancePayment(
@ -1381,82 +1366,4 @@ public class ApplePayController extends BaseController {
} }
} }
/**
* 好友代付接口
* @param params {orderid, code}
* @param request
* @return 支付参数
*/
@PostMapping("/friend/pay")
public AjaxResult friendPay(@RequestBody Map<String, Object> params, HttpServletRequest request) {
try {
// 1. 校验参数
if (params == null || params.get("orderid") == null || params.get("code") == null) {
return AppletControllerUtil.appletWarning("参数orderid和code不能为空");
}
String orderid = params.get("orderid").toString();
String code = params.get("code").toString();
Map<String, Object> openidResult = WechatApiUtil.getWechatUserOpenidInfo(code);
if (!(Boolean) openidResult.get("success")) {
System.err.println("获取openid失败" + openidResult.get("errorMsg"));
return null;
}
String openid = (String) openidResult.get("openid");
if (openid == null || openid.trim().isEmpty()) {
System.err.println("微信API返回的openid为空");
return null;
}
// // 2. 用code获取openid
// String openid = WechatApiUtil.getWechatUserOpenidInfo(code);
// if (openid == null || openid.isEmpty()) {
// return AppletControllerUtil.appletWarning("获取openid失败");
// }
// 3. 查询预支付数据
UsersPayBefor payBefor = usersPayBeforService.selectUsersPayBeforByOrderId(orderid);
if (payBefor == null) {
return AppletControllerUtil.appletWarning("预支付订单不存在");
}
if (payBefor.getAllmoney() == null || payBefor.getAllmoney().compareTo(BigDecimal.ZERO) <= 0) {
return AppletControllerUtil.appletWarning("支付金额无效");
}
// 4. 调用微信支付接口
Map<String, Object> payResult = wechatPayUtil.createBatchOrderAndPay(
openid,
payBefor.getOrderid(),
new BigDecimal("0.01"),
1,
WechatPayUtil.PAY_FH + "api/order/friend/paydata/notify"
);
if (payResult != null && Boolean.TRUE.equals(payResult.get("success"))) {
Map<String, Object> responseData = new HashMap<>();
responseData.put("orderid", orderid);
responseData.put("totalAmount", payBefor.getAllmoney());
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);
}
// if (payResult != null && Boolean.TRUE.equals(payResult.get("success"))) {
// payResult.put("istowx", 1);
// return AppletControllerUtil.appletSuccess(payResult);
// } else {
// String errorMsg = payResult != null ? (String) payResult.get("message") : "微信支付下单失败";
// return AppletControllerUtil.appletWarning("支付下单失败:" + errorMsg);
// }
} catch (Exception e) {
logger.error("好友代付异常:", e);
return AppletControllerUtil.appletError("好友代付失败:" + e.getMessage());
}
}
} }

View File

@ -340,79 +340,7 @@ public class PayNotifyController extends BaseController {
} }
} }
/**
* 拼团支付的回调接口
*
* @param request HTTP请求对象
* @return XML格式响应给微信服务器
*IUserGroupBuyingService userGroupBuyingService;
* 处理商品订单的支付成功回调
* 1. 验证支付签名
* 2. 更新商品订单支付状态
* 3. 更新订单支付时间和交易号
* 4. 处理库存扣减等业务逻辑
*/
@PostMapping(value = "/api/order/friend/paydata/notify")
public String apiorderfriendpaydatanotify(HttpServletRequest request) {
try {
logger.info("收到商品支付回调通知,开始处理...");
// 1. 使用WechatPayUtil处理支付回调
Map<String, Object> notifyResult = wechatPayUtil.handlePayNotify(request);
// 2. 检查处理结果
boolean success = (Boolean) notifyResult.get("success");
String message = (String) notifyResult.get("message");
if (!success) {
logger.error("商品支付回调处理失败:{}", message);
return buildFailResponse("商品支付回调处理失败");
}
// 3. 获取支付信息
Map<String, Object> paymentInfo = (Map<String, Object>) notifyResult.get("paymentInfo");
String outTradeNo = (String) paymentInfo.get("outTradeNo");
String transactionId = (String) paymentInfo.get("transactionId");
String totalFee = (String) paymentInfo.get("totalFee");
UsersPayBefor usersPayBefor = usersPayBeforService.selectUsersPayBeforByOrderId(outTradeNo);
if (usersPayBefor!=null){
usersPayBefor.setStatus(2L);
usersPayBefor.setPaytype(4L);
usersPayBefor.setPaytime(new Date());
usersPayBefor.setPaycode(transactionId);
usersPayBeforService.updateUsersPayBefor(usersPayBefor);
}
Users users = null;
if (usersPayBefor != null) {
users = usersService.selectUsersById(usersPayBefor.getUid());
}
//订单回调处理拼团创建订单其他订单修改状态
OrderUtil.prepayCallback(usersPayBefor, users);
// //最后无论如何平台流水需要添加让平台看到流水和账目
PayMoneyLog payMoneyLog = new PayMoneyLog();
if (usersPayBefor != null) {
payMoneyLog.setOid(usersPayBefor.getId());
}
payMoneyLog.setOrderId(usersPayBefor.getOrderid());
payMoneyLog.setUid(usersPayBefor.getUid());
if (users != null) {
payMoneyLog.setUname(users.getName());
}
payMoneyLog.setPrice(usersPayBefor.getWxmoney());
payMoneyLog.setMark("订单支付");
payMoneyLog.setPayTime(new Date());
payMoneyLogService.insertPayMoneyLog(payMoneyLog);
//sendWechatMessage(users,outTradeNo);
logger.info("商品支付回调处理成功,订单号:{}", outTradeNo);
return buildSuccessResponse();
} catch (Exception e) {
logger.error("商品支付回调处理异常:", e);
return buildFailResponse("商品支付回调处理异常");
}
}
/** /**

View File

@ -6,7 +6,6 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.ruoyi.system.ControllerUtil.AppletControllerUtil;
import com.ruoyi.system.domain.QuoteCraft; import com.ruoyi.system.domain.QuoteCraft;
import com.ruoyi.system.domain.QuoteType; import com.ruoyi.system.domain.QuoteType;
import com.ruoyi.system.service.IQuoteMaterialTypeService; import com.ruoyi.system.service.IQuoteMaterialTypeService;
@ -60,7 +59,6 @@ public class QuoteMaterialController extends BaseController
} }
List<QuoteMaterial> list = quoteMaterialService.selectQuoteMaterialList(quoteMaterial); List<QuoteMaterial> list = quoteMaterialService.selectQuoteMaterialList(quoteMaterial);
for(QuoteMaterial QuoteMaterialData:list){ for(QuoteMaterial QuoteMaterialData:list){
QuoteMaterialData.setImage(AppletControllerUtil.buildImageUrl(QuoteMaterialData.getImage()));
List<String> idslist = Arrays.asList( List<String> idslist = Arrays.asList(
QuoteMaterialData.getGoodId().replaceAll("[\\[\\]\"]", "").split(", ")); QuoteMaterialData.getGoodId().replaceAll("[\\[\\]\"]", "").split(", "));
QuoteMaterialData.setServiceName(serviceGoodsService.selectTitlesByIds(idslist)); QuoteMaterialData.setServiceName(serviceGoodsService.selectTitlesByIds(idslist));

View File

@ -49,47 +49,7 @@ public class UserSecondaryCardController extends BaseController
@Autowired @Autowired
private IServiceCateService serviceCateService; private IServiceCateService serviceCateService;
/**
* 数字转中文工具方法
*/
private String numberToChinese(Long num) {
if (num == null || num <= 0) {
return "";
}
String[] chineseNumbers = {"", "", "", "", "", "", "", "", "", "", ""};
if (num <= 10) {
return chineseNumbers[num.intValue()];
} else if (num < 20) {
return "" + (num > 10 ? chineseNumbers[Math.toIntExact((num - 10))] : "");
} else if (num < 100) {
long tens = num / 10;
long ones = num % 10;
String result = chineseNumbers[(int)tens] + "";
if (ones > 0) {
result += chineseNumbers[(int)ones];
}
return result;
} else {
// 对于大于100的数字直接返回阿拉伯数字
return num.toString();
}
}
/**
* 生成introduction字段
*/
private String generateIntroduction(Long allnum, Long num) {
if (allnum == null || num == null) {
return "";
}
String allnumChinese = numberToChinese(allnum);
String numChinese = numberToChinese(num);
return allnumChinese + "" + numChinese;
}
/** /**
* 查询次卡管理列表 * 查询次卡管理列表
@ -147,11 +107,6 @@ public class UserSecondaryCardController extends BaseController
{ {
userSecondaryCard.setOrderid(GenerateCustomCode.generCreateOrder("CIKA")); userSecondaryCard.setOrderid(GenerateCustomCode.generCreateOrder("CIKA"));
userSecondaryCard.setCreattime(new Date()); userSecondaryCard.setCreattime(new Date());
// 自动生成introduction字段
String introduction = generateIntroduction(userSecondaryCard.getAllnum(), userSecondaryCard.getNum());
userSecondaryCard.setIntroduction(introduction);
return toAjax(userSecondaryCardService.insertUserSecondaryCard(userSecondaryCard)); return toAjax(userSecondaryCardService.insertUserSecondaryCard(userSecondaryCard));
} }
@ -163,10 +118,6 @@ public class UserSecondaryCardController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody UserSecondaryCard userSecondaryCard) public AjaxResult edit(@RequestBody UserSecondaryCard userSecondaryCard)
{ {
// 自动生成introduction字段
String introduction = generateIntroduction(userSecondaryCard.getAllnum(), userSecondaryCard.getNum());
userSecondaryCard.setIntroduction(introduction);
return toAjax(userSecondaryCardService.updateUserSecondaryCard(userSecondaryCard)); return toAjax(userSecondaryCardService.updateUserSecondaryCard(userSecondaryCard));
} }

View File

@ -1,92 +1,53 @@
// 个人中心 // 评价订单
public function index(Request $request) public function comment(Request $request)
{ {
$validator = Validator::make($request->all(),$this->comment_rule()['rules'],$this->comment_rule()['messages']);
if($validator->fails()){
return $this->error($validator->errors()->all()[0]);
}
$param = $request->post(); $param = $request->post();
$limit = isset($param['limit']) && $param['limit'] ? $param['limit'] : env('PAGE_LIMIT'); // 是否已经评价过
$info = Comment::where(['uid'=>$this->user_info['id'],'order_id'=>$param['order_id']])->first();
if($this->user_info['level']) if($info){
{ return $this->error('请勿重复提交');
$this->user_info['level_info'] = WorkerLevel::select('id','image')->find($this->user_info['level']);
} }
// 个人基本信息 $num_type = $param['num'] == 1 ? 3 : (in_array($param['num'],[2,3]) ? 2 : 1);
$data['user'] = $this->user_info; // 商品id
// 质保金 $order_info = Order::select('product_id','id','worker_id')->where(['order_id'=>$param['order_id']])->first();
if(!$this->user_info['margin']){ $data = [
$data['user']['margin'] = 0; 'oid' => $order_info['id'],
'order_id' => $param['order_id'],
'product_id' => $order_info['product_id'],
'content' => $param['content'],
'num' => $param['num'],
'uid' => $this->user_info['id'],
'images' => $param['images'] ? json_encode($param['images']) : null,
'num_type' => $num_type,
'worker_id' => $order_info['worker_id'],
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
];
DB::beginTransaction();
try{
Comment::insert($data);
// 订单评价记录
$log_data = [
'oid' => $order_info['id'],
'order_id' => $param['order_id'],
'title' => '订单评价',
'type' => 8,
'content' => json_encode(['text'=>$param['content'],'image'=>$param['images'],'num'=>$data['num']]),
'created_at'=> date('Y-m-d H:i:s'),
'updated_at'=> date('Y-m-d H:i:s'),
];
Log::insert($log_data);
// 更改订单状态为完成--评价状态改为已评价
Order::where(['order_id'=>$param['order_id']])->update(['status'=>4,'is_comment'=>1]);
DB::commit();
return $this->success();
}catch(\Exception $e){
DB::rollBack();
return $this->error('操作失败'.$e->getMessage());
} }
// 累计佣金
if(!$this->user_info['total_comm'])
{
$data['user']['total_comm'] = 0;
}
// 佣金
if(!$this->user_info['commission'])
{
$data['user']['commission'] = 0;
}
// 师傅技能
if($this->user_info['skill_ids'])
{
$skill_ids = array_filter(json_decode($this->user_info['skill_ids'],true));
$this->user_info['skill_arr'] = skill::whereIn('id',$skill_ids)->select('id','title')->get();
}
// 师傅服务地区
if($this->user_info['service_city_ids'])
{
$this->user_info['service_city_arr'] = DiyCity::whereIn('id',json_decode($this->user_info['service_city_ids'],true))->select('id','title')->get();
}
// 等级信息
if($this->user_info['level'])
{
$level = WorkerLevel::select('image')->find($this->user_info['level']);
if($level) $data['user']['level_img'] = $level['image'];
}
// 是否禁止接单
if(strtotime($this->user_info['prohibit_time']) < time() && strtotime($this->user_info['prohibit_time']) + $this->user_info['prohibit_time_num']*3600 > time()){
// 禁止剩余是啊金
$residue_time = strtotime($this->user_info['prohibit_time']) + $this->user_info['prohibit_time_num']*3600 - time();
$hours = intval($residue_time / 3600);
$minutes = intval(($residue_time % 3600) / 60);
$seconds = $residue_time % 60;
$str = '';
if($hours > 0) $str .= $hours.'小时';
if($minutes > 0) $str .= $minutes.'分钟';
if($seconds > 0) $str .= $seconds.'秒';
$this->user_info['prohibit'] = '因违反平台规定,'.$this->user_info['prohibit_time_num'].'小时内禁止接单,剩余'.$str;
}
// 我的服务订单
// $oids = Log::where(['worker_id'=>$this->user_info['id'],'type'=>8])->pluck('oid')->toArray();
$oids = Log::where(['worker_id'=>$this->user_info['id']])->pluck('oid')->toArray();
// 我的评价
if($oids){
$model = new Comment();
if(isset($param['type']) && $param['type'])
{
$model = $model->where(['num_type'=>$param['type']]);
}
$data['data'] = $model->whereIn('oid',$oids)
->with(['user'=>function($query){
$query->select('id','name','avatar');
}])
->select('id','uid','images','content','num','created_at')
->paginate($limit);
// 总评分
$total_num = 0;
foreach($data['data'] as &$val)
{
// 时间转换
$val['time'] = $this->mdate($val['created_at']);
$total_num += $val['num'];
}
// 评价数量
$data['comment']['one'] = Comment::where(['num_type'=>1])->whereIn('oid',$oids)->count();
$data['comment']['two'] = Comment::where(['num_type'=>2])->whereIn('oid',$oids)->count();
$data['comment']['three'] = Comment::where(['num_type'=>3])->whereIn('oid',$oids)->count();
if(count($data['data']) < 1) $data['comment']['total'] = 0;
else $data['comment']['total'] = round($total_num/count($data['data']),1);
}
return $this->success($data);
} }

View File

@ -42,12 +42,8 @@ public class AppletControllerUtil {
private static final IUsersService usersService = SpringUtils.getBean(IUsersService.class); private static final IUsersService usersService = SpringUtils.getBean(IUsersService.class);
private static final IOrderService orderService = SpringUtils.getBean(IOrderService.class);
private static final IUserAddressService userAddressService = SpringUtils.getBean(IUserAddressService.class); private static final IUserAddressService userAddressService = SpringUtils.getBean(IUserAddressService.class);
private static final IOrderCommentService orderCommentService = SpringUtils.getBean(IOrderCommentService.class); private static final IOrderCommentService orderCommentService = SpringUtils.getBean(IOrderCommentService.class);
private static final IOrderLogService orderLogService = SpringUtils.getBean(IOrderLogService.class);
// ============================== 统一响应处理方法 ============================== // ============================== 统一响应处理方法 ==============================
@ -98,19 +94,7 @@ public class AppletControllerUtil {
return result; return result;
} }
/**
* 业务提示响应 - code: 422
*
* @param message 提示消息
* @return AjaxResult
*/
public static AjaxResult appletdengluWarning(String message) {
AjaxResult result = new AjaxResult();
result.put("code", 422);
result.put("msg", message);
result.put("data", new ArrayList<>());
return result;
}
/** /**
* 业务提示响应 - code:500 * 业务提示响应 - code:500
@ -142,28 +126,28 @@ public class AppletControllerUtil {
return result; return result;
} }
// /** /**
// * Token验证失败响应 - code: 332 * Token验证失败响应 - code: 332
// * *
// * @return AjaxResult * @return AjaxResult
// */ */
// public static AjaxResult appletUnauthorized() { public static AjaxResult appletUnauthorized() {
// return appletUnauthorized("用户未登录或token无效请重新登录"); return appletUnauthorized("用户未登录或token无效请重新登录");
// } }
// /** /**
// * Token验证失败响应 - code: 332自定义消息 * Token验证失败响应 - code: 332自定义消息
// * *
// * @param message 提示消息 * @param message 提示消息
// * @return AjaxResult * @return AjaxResult
// */ */
// public static AjaxResult appletUnauthorized(String message) { public static AjaxResult appletUnauthorized(String message) {
// AjaxResult result = new AjaxResult(); AjaxResult result = new AjaxResult();
// result.put("code", 422); result.put("code", 332);
// result.put("msg", message); result.put("msg", message);
// result.put("data", new ArrayList<>()); result.put("data", new ArrayList<>());
// return result; return result;
// } }
/** /**
* 系统错误响应 - code: 500 * 系统错误响应 - code: 500
@ -2641,74 +2625,22 @@ public class AppletControllerUtil {
* @param order 订单主键 * @param order 订单主键
* @return 是否可用 * @return 是否可用
*/ */
public static Users creatWorkerForOrder(Order order,Users worker) { public static Users creatWorkerForOrder(Order order) {
GaoDeMapUtil gaoDeMapUtil = new GaoDeMapUtil();
order.setWorkerId(worker.getId());
order.setStatus(1L);
order.setIsPause(1);
order.setReceiveTime(new Date());
order.setWorkerPhone(worker.getPhone());
UserAddress userAddress = userAddressService.selectUserAddressById(order.getAddressId()); UserAddress userAddress = userAddressService.selectUserAddressById(order.getAddressId());
if (userAddress != null){ // if (userAddress != null){
order.setUserPhone(userAddress.getPhone()); // String city = gaoDeMapUtil.getCityByLocation(userAddress.getLongitude(), userAddress.getLatitude());
} // if (city != null){
order.setMiddlePhone("18339212639"); //
order.setReceiveType(3l); // }else{
order.setLogStatus(9); //
JSONObject jSONObject = new JSONObject(); // }
jSONObject.put("type", 9); // }
order.setLogJson(jSONObject.toJSONString()); Users worker = usersService.selectUsersById(2l);
orderService.updateOrder(order);
OrderLog orderLognew = new OrderLog();
orderLognew.setOid(order.getId());
orderLognew.setOrderId(order.getOrderId());
orderLognew.setTitle("系统派单");
orderLognew.setType(new BigDecimal(1.1));
JSONObject jSONObject1 = new JSONObject();
jSONObject1.put("name", "师傅收到派单信息");
orderLognew.setContent(jSONObject1.toJSONString());
orderLognew.setWorkerId(worker.getId());
orderLognew.setWorkerLogId(worker.getId());
orderLogService.insertOrderLog(orderLognew);
// GaoDeMapUtil gaoDeMapUtil = new GaoDeMapUtil();
// UserAddress userAddress = userAddressService.selectUserAddressById(order.getAddressId());
//// if (userAddress != null){
//// String city = gaoDeMapUtil.getCityByLocation(userAddress.getLongitude(), userAddress.getLatitude());
//// if (city != null){
////
//// }else{
////
//// }
//// }
// // Users worker = usersService.selectUsersById(2l);
return worker; return worker;
} }
// Users worker = AppletControllerUtil.creatWorkerForOrder(orderNewData);
//
// if (worker != null) {
// // 更新订单状态为已派单
// // 添加派单日志
// // 发送通知
// WXsendMsgUtil.sendMsgForWorkerInfo(worker.getOpenid(), orderNewData, serviceGoods);
// YunXinPhoneUtilAPI.httpsAxbTransfer(worker.getPhone());
// }
/** /**
* 判断时间段是否可用 * 判断时间段是否可用
* *
@ -4560,7 +4492,7 @@ public class AppletControllerUtil {
// 1. 验证用户token // 1. 验证用户token
Map<String, Object> tokenValidation = validateUserToken(token, usersService); Map<String, Object> tokenValidation = validateUserToken(token, usersService);
if (!(Boolean) tokenValidation.get("valid")) { if (!(Boolean) tokenValidation.get("valid")) {
return appletdengluWarning((String) tokenValidation.get("message")); return appletUnauthorized((String) tokenValidation.get("message"));
} }
// 从tokenValidation中获取用户信息Map然后提取userId // 从tokenValidation中获取用户信息Map然后提取userId
@ -4962,225 +4894,4 @@ public class AppletControllerUtil {
* - data字段可能为null或空数组 * - data字段可能为null或空数组
* - 金额字段可能为null需要默认值处理 * - 金额字段可能为null需要默认值处理
*/ */
/**
* 将字符串格式化为JSON支持数组类型字符串的处理
* <p>
* 该方法可以将各种格式的字符串转换为标准JSON格式
* 1. 普通字符串 -> JSON字符串
* 2. 数组字符串"1,2,3" -> JSON数组字符串
* 3. 对象字符串 -> JSON对象字符串
* 4. 已经是JSON格式的字符串 -> 格式化后的JSON字符串
*
* @param inputString 输入字符串
* @return 格式化后的JSON字符串如果输入为空或处理失败返回null
*/
public static String formatStringToJson(String inputString) {
if (inputString == null || inputString.trim().isEmpty()) {
return null;
}
String trimmedString = inputString.trim();
try {
// 如果已经是有效的JSON格式直接格式化返回
if (isValidJson(trimmedString)) {
return formatJsonString(trimmedString);
}
// 检查是否是数组格式的字符串用逗号分隔
if (isArrayFormatString(trimmedString)) {
return formatArrayStringToJson(trimmedString);
}
// 检查是否是对象格式的字符串key=value格式
if (isObjectFormatString(trimmedString)) {
return formatObjectStringToJson(trimmedString);
}
// 普通字符串包装为JSON字符串
return JSON.toJSONString(trimmedString);
} catch (Exception e) {
System.err.println("字符串格式化JSON失败原始字符串: [" + inputString + "], 错误: " + e.getMessage());
return null;
}
}
/**
* 检查字符串是否是有效的JSON格式
*
* @param jsonString JSON字符串
* @return 是否是有效JSON
*/
private static boolean isValidJson(String jsonString) {
try {
// 尝试解析为JSON对象或数组
if (jsonString.startsWith("{") && jsonString.endsWith("}")) {
JSONObject.parseObject(jsonString);
return true;
} else if (jsonString.startsWith("[") && jsonString.endsWith("]")) {
JSONArray.parseArray(jsonString);
return true;
}
return false;
} catch (Exception e) {
return false;
}
}
/**
* 格式化JSON字符串使其更易读
*
* @param jsonString JSON字符串
* @return 格式化后的JSON字符串
*/
private static String formatJsonString(String jsonString) {
try {
if (jsonString.startsWith("{")) {
JSONObject jsonObject = JSONObject.parseObject(jsonString);
return JSON.toJSONString(jsonObject, String.valueOf(true)); // true表示格式化输出
} else if (jsonString.startsWith("[")) {
JSONArray jsonArray = JSONArray.parseArray(jsonString);
return JSON.toJSONString(jsonArray, String.valueOf(true)); // true表示格式化输出
}
return jsonString;
} catch (Exception e) {
return jsonString;
}
}
/**
* 检查字符串是否是数组格式用逗号分隔
*
* @param inputString 输入字符串
* @return 是否是数组格式
*/
private static boolean isArrayFormatString(String inputString) {
// 检查是否包含逗号分隔符且不是JSON对象格式
return inputString.contains(",") && !inputString.startsWith("{") && !inputString.startsWith("[");
}
/**
* 将数组格式的字符串转换为JSON数组字符串
*
* @param arrayString 数组格式字符串"1,2,3""a,b,c"
* @return JSON数组字符串
*/
private static String formatArrayStringToJson(String arrayString) {
String[] items = arrayString.split(",");
List<Object> result = new ArrayList<>();
for (String item : items) {
String trimmedItem = item.trim();
if (trimmedItem.isEmpty()) {
continue;
}
// 尝试转换为数字
if (isNumeric(trimmedItem)) {
if (trimmedItem.contains(".")) {
result.add(Double.parseDouble(trimmedItem));
} else {
result.add(Long.parseLong(trimmedItem));
}
} else {
// 字符串类型
result.add(trimmedItem);
}
}
return JSON.toJSONString(result, String.valueOf(true));
}
/**
* 检查字符串是否是对象格式key=value格式
*
* @param inputString 输入字符串
* @return 是否是对象格式
*/
private static boolean isObjectFormatString(String inputString) {
// 检查是否包含等号分隔符且不是JSON格式
return inputString.contains("=") && !inputString.startsWith("{") && !inputString.startsWith("[");
}
/**
* 将对象格式的字符串转换为JSON对象字符串
*
* @param objectString 对象格式字符串"key1=value1,key2=value2"
* @return JSON对象字符串
*/
private static String formatObjectStringToJson(String objectString) {
Map<String, Object> result = new HashMap<>();
// 先按逗号分割再按等号分割
String[] pairs = objectString.split(",");
for (String pair : pairs) {
String trimmedPair = pair.trim();
if (trimmedPair.isEmpty()) {
continue;
}
String[] keyValue = trimmedPair.split("=", 2); // 最多分割2次避免值中包含等号
if (keyValue.length == 2) {
String key = keyValue[0].trim();
String value = keyValue[1].trim();
if (!key.isEmpty()) {
// 尝试转换值的类型
if (isNumeric(value)) {
if (value.contains(".")) {
result.put(key, Double.parseDouble(value));
} else {
result.put(key, Long.parseLong(value));
}
} else if ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) {
result.put(key, Boolean.parseBoolean(value));
} else {
result.put(key, value);
}
}
}
}
return JSON.toJSONString(result, String.valueOf(true));
}
/**
* 检查字符串是否是数字
*
* @param str 字符串
* @return 是否是数字
*/
private static boolean isNumeric(String str) {
if (str == null || str.trim().isEmpty()) {
return false;
}
try {
Double.parseDouble(str.trim());
return true;
} catch (NumberFormatException e) {
return false;
}
}
/**
* 将字符串格式化为JSON带默认值
* <p>
* 如果格式化失败返回提供的默认值
*
* @param inputString 输入字符串
* @param defaultValue 格式化失败时的默认值
* @return 格式化后的JSON字符串失败返回默认值
*/
public static String formatStringToJson(String inputString, String defaultValue) {
String result = formatStringToJson(inputString);
return result != null ? result : defaultValue;
}
public static void main(String[] args) {
System.out.println(formatStringToJson("{\"image\":\"['https:img.huafurenjia.cn/images/2024-10-13/dKriAtS3HHsM0JAm6DdQEPQvAFnnuPcnOxau6SSy.jpg']\",\"num\":1,\"text\":\"你很好我爱你\" ,\"labels\":[\"技术专业\",\"作业规范\",\"价格合理\"] }"));
}
} }

View File

@ -118,13 +118,6 @@ public class CartOrderUtil {
result.put("orderId", order.getOrderId()); result.put("orderId", order.getOrderId());
result.put("productName", serviceGoods.getTitle()); result.put("productName", serviceGoods.getTitle());
result.put("allprice", itemPrice.toString()); result.put("allprice", itemPrice.toString());
PayBeforeUtil payBeforeUtil = new PayBeforeUtil();
//一口价金额大于0的时候进行支付
if (order.getTotalPrice().compareTo(BigDecimal.ZERO)>0){
String payBeforeId = payBeforeUtil.createPayBefore(user, itemPrice, order.getOrderId(), null, order.getProductId(), cart.getOrdertype(), order.getSku(), null, null, null, null,1L, null, null);
}
return result; return result;
} catch (Exception e) { } catch (Exception e) {
logger.error("服务类购物车下单异常:", e); logger.error("服务类购物车下单异常:", e);
@ -133,76 +126,7 @@ public class CartOrderUtil {
return result; return result;
} }
} }
/**
* 商品类购物车下单
* @param user 用户
* @param serviceGoods 商品
* @param userAddress 地址
* @param goodsOrderService 商品订单service
* @return 下单结果Map
*/
public static Map<String, Object> createGoodsOrderFromOnes(Users user, String sku,int num, String reamk,ServiceGoods serviceGoods, UserAddress userAddress, IGoodsOrderService goodsOrderService,String maincorid) {
Map<String, Object> result = new HashMap<>();
try {
BigDecimal itemPrice=BigDecimal.ZERO;
String skuStr = sku;
if (skuStr != null && !skuStr.trim().isEmpty()) {
try {
JSONObject skuJson = JSONObject.parseObject(skuStr);
if (skuJson.containsKey("price")) {
BigDecimal skuPrice = new BigDecimal(skuJson.getString("price"));
itemPrice = skuPrice.multiply(BigDecimal.valueOf(num));
} else {
// 没有price字段回退用商品price
itemPrice = serviceGoods.getPrice().multiply(BigDecimal.valueOf(num));
}
} catch (Exception e) {
// 解析失败回退用商品price
itemPrice = serviceGoods.getPrice().multiply(BigDecimal.valueOf(num));
}
} else {
// sku为空直接用商品price
itemPrice = serviceGoods.getPrice().multiply(BigDecimal.valueOf(num));
}
GoodsOrder goodsOrder = new GoodsOrder();
goodsOrder.setType(2);
goodsOrder.setOrderId(GenerateCustomCode.generCreateOrder("B"));
goodsOrder.setUid(user.getId());
goodsOrder.setUname(user.getName());
goodsOrder.setProductId(serviceGoods.getId());
goodsOrder.setProductName(serviceGoods.getTitle());
goodsOrder.setNum((long) num);
goodsOrder.setSku(sku);
goodsOrder.setIsforservice(serviceGoods.getIsforservice());
goodsOrder.setForserviceid(serviceGoods.getForserviceid());
goodsOrder.setMark(reamk);
goodsOrder.setAddressId(userAddress.getId());
goodsOrder.setName(userAddress.getName());
goodsOrder.setPhone(userAddress.getPhone());
goodsOrder.setAddress(userAddress.getAddressInfo());
goodsOrder.setTotalPrice(itemPrice);
goodsOrder.setGoodPrice(serviceGoods.getPrice());
goodsOrder.setPayPrice(itemPrice);
goodsOrder.setStatus(1L); // 待支付
goodsOrder.setMainOrderId(maincorid);
int insertResult = goodsOrderService.insertGoodsOrder(goodsOrder);
if (insertResult <= 0) {
result.put("success", false);
result.put("msg", "商品订单创建失败");
return result;
}
result.put("success", true);
result.put("orderId", goodsOrder.getOrderId());
result.put("productName", serviceGoods.getTitle());
result.put("allprice", itemPrice.toString());
return result;
} catch (Exception e) {
logger.error("商品类购物车下单异常:", e);
result.put("success", false);
result.put("msg", "商品类购物车下单异常:" + e.getMessage());
return result;
}
}
/** /**
* 商品类购物车下单 * 商品类购物车下单
* @param user 用户 * @param user 用户
@ -266,9 +190,6 @@ public class CartOrderUtil {
result.put("orderId", goodsOrder.getOrderId()); result.put("orderId", goodsOrder.getOrderId());
result.put("productName", serviceGoods.getTitle()); result.put("productName", serviceGoods.getTitle());
result.put("allprice", itemPrice.toString()); result.put("allprice", itemPrice.toString());
PayBeforeUtil payBeforeUtil = new PayBeforeUtil();
String payBeforeId = payBeforeUtil.createPayBefore(user, itemPrice, goodsOrder.getOrderId(), null, goodsOrder.getProductId(), 11L, goodsOrder.getSku(), null, null, null, null,2L, null, null);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
logger.error("商品类购物车下单异常:", e); logger.error("商品类购物车下单异常:", e);

View File

@ -1,165 +0,0 @@
package com.ruoyi.system.ControllerUtil;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.Signature;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
/**
* 美团工具类
* 主要用于美团码的核销抵扣等相关操作
*
* @author ruoyi
*/
public class MeituanUtil {
// ====== 美团API配置请补充实际值 ======
public static String appId = "你的美团appId";
public static String appKey = "你的美团appKey";
public static String meituanApiUrl = "https://api-open-cater.meituan.com"; // 示例
public static String privateKeyPem = "-----BEGIN PRIVATE KEY-----\n你的私钥内容\n-----END PRIVATE KEY-----";
public static String publicKeyPem = "-----BEGIN PUBLIC KEY-----\n你的公钥内容\n-----END PUBLIC KEY-----";
// ========== 通用签名生成 =============
/**
* 生成签名示例具体算法请参考美团开放平台文档
* @param data 待签名数据
* @param privateKey 私钥对象
* @return 签名字符串
*/
public static String sign(String data, PrivateKey privateKey) throws Exception {
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initSign(privateKey);
signature.update(data.getBytes(StandardCharsets.UTF_8));
byte[] signBytes = signature.sign();
return Base64.getEncoder().encodeToString(signBytes);
}
// ========== HTTP请求工具 =============
/**
* 发送POST请求
* @param apiUrl 接口地址
* @param jsonBody 请求体
* @return 响应字符串
*/
public static String doPost(String apiUrl, String jsonBody) throws Exception {
URL url = new URL(apiUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
conn.setDoOutput(true);
try (OutputStream os = conn.getOutputStream()) {
os.write(jsonBody.getBytes(StandardCharsets.UTF_8));
}
StringBuilder response = new StringBuilder();
try (BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = br.readLine()) != null) {
response.append(line);
}
}
return response.toString();
}
// ========== 美团业务API实现 =============
/**
* 美团码核销
* @param code 美团券码
* @param orderId 订单号
* @return 核销结果
*/
public static Map<String, Object> verifyMeituanCode(String code, String orderId) {
Map<String, Object> result = new HashMap<>();
try {
// 1. 构造请求参数
Map<String, Object> param = new HashMap<>();
param.put("app_id", appId);
param.put("order_id", orderId);
param.put("code", code);
// TODO: 其他必需参数
// 2. 生成签名具体字段顺序和内容请参考美团文档
// String sign = sign(待签名字符串, 私钥对象);
// param.put("sign", sign);
// 3. 转为JSON
String jsonBody = com.alibaba.fastjson2.JSON.toJSONString(param);
// 4. 发送请求
String apiUrl = meituanApiUrl + "/your/verify/api/path"; // TODO: 替换为实际核销接口路径
String response = doPost(apiUrl, jsonBody);
// 5. 解析响应
// TODO: 按美团返回格式解析
result.put("success", true);
result.put("msg", "核销成功");
result.put("response", response);
} catch (Exception e) {
result.put("success", false);
result.put("msg", "核销失败: " + e.getMessage());
}
return result;
}
/**
* 美团码抵扣
* @param code 美团券码
* @param amount 抵扣金额
* @return 抵扣结果
*/
public static Map<String, Object> deductMeituanCode(String code, double amount) {
Map<String, Object> result = new HashMap<>();
try {
Map<String, Object> param = new HashMap<>();
param.put("app_id", appId);
param.put("code", code);
param.put("amount", amount);
// TODO: 其他必需参数和签名
String jsonBody = com.alibaba.fastjson2.JSON.toJSONString(param);
String apiUrl = meituanApiUrl + "/your/deduct/api/path"; // TODO: 替换为实际抵扣接口路径
String response = doPost(apiUrl, jsonBody);
result.put("success", true);
result.put("msg", "抵扣成功");
result.put("response", response);
} catch (Exception e) {
result.put("success", false);
result.put("msg", "抵扣失败: " + e.getMessage());
}
return result;
}
/**
* 查询美团码状态
* @param code 美团券码
* @return 状态结果
*/
public static Map<String, Object> queryMeituanCodeStatus(String code) {
Map<String, Object> result = new HashMap<>();
try {
Map<String, Object> param = new HashMap<>();
param.put("app_id", appId);
param.put("code", code);
// TODO: 其他必需参数和签名
String jsonBody = com.alibaba.fastjson2.JSON.toJSONString(param);
String apiUrl = meituanApiUrl + "/your/query/api/path"; // TODO: 替换为实际查询接口路径
String response = doPost(apiUrl, jsonBody);
result.put("success", true);
result.put("msg", "查询成功");
result.put("response", response);
} catch (Exception e) {
result.put("success", false);
result.put("msg", "查询失败: " + e.getMessage());
}
return result;
}
// ========== 私钥公钥加载工具可选 =============
// 可根据需要实现PEM字符串转PrivateKey/公钥对象的方法
// ...
// 可根据实际美团API文档继续扩展更多方法
}

View File

@ -6,7 +6,6 @@ import com.ruoyi.common.utils.AmapUtils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -25,9 +24,6 @@ public class OrderUtil {
private static IUsersService usersService = SpringUtils.getBean(IUsersService.class); private static IUsersService usersService = SpringUtils.getBean(IUsersService.class);
private static IOrderLogService orderLogService = SpringUtils.getBean(IOrderLogService.class); private static IOrderLogService orderLogService = SpringUtils.getBean(IOrderLogService.class);
private static IGoodsOrderService goodsOrderService = SpringUtils.getBean(IGoodsOrderService.class); private static IGoodsOrderService goodsOrderService = SpringUtils.getBean(IGoodsOrderService.class);
private static IUserDemandQuotationService userDemandQuotationService = SpringUtils.getBean(IUserDemandQuotationService.class);
private static IUsersPayBeforService usersPayBeforService = SpringUtils.getBean(IUsersPayBeforService.class);
private static IQuoteMaterialService quoteMaterialService = SpringUtils.getBean(IQuoteMaterialService.class);
private static OrderLogHandler orderLogHandler = SpringUtils.getBean(OrderLogHandler.class); private static OrderLogHandler orderLogHandler = SpringUtils.getBean(OrderLogHandler.class);
@ -35,43 +31,6 @@ public class OrderUtil {
private static final String PREFIX = "C"; private static final String PREFIX = "C";
private static final int FIXED_LENGTH = 15; // 总长度为15 private static final int FIXED_LENGTH = 15; // 总长度为15
/**
* 创建新用户对象
*
* @return 新用户对象
*/
public static JSONObject getbaojiajson(String json) {
if (StringUtils.isNotBlank(json)) {
JSONObject jsonObject = JSONObject.parseObject(json);
JSONArray material = jsonObject.getJSONArray("material");
if (material != null) {
for (int i = 0; i < material.size(); i++) {
JSONObject jsonObjectmaterial = material.getJSONObject(i);
String id = jsonObjectmaterial.getString("id");
if (StringUtils.isNotBlank(id)) {
QuoteMaterial quoteMaterial = quoteMaterialService.selectQuoteMaterialById(Long.parseLong(id));
if (quoteMaterial != null) {
jsonObjectmaterial.put("manyimages", JSONArray.parseArray(quoteMaterial.getManyimages()));
jsonObjectmaterial.put("image", AppletControllerUtil.buildImageUrl(quoteMaterial.getImage()));
if (StringUtils.isNotBlank(quoteMaterial.getContent()) && StringUtils.isNotBlank(quoteMaterial.getManyimages())) {
jsonObjectmaterial.put("showtype", 1);
} else {
jsonObjectmaterial.put("showtype", 2);
}
jsonObjectmaterial.put("content", quoteMaterial.getContent());
}
}
}
}
// 直接返回原始jsonObject其他字段都保留
return jsonObject;
}
return new JSONObject();
}
/** /**
* 生成订单编码的工具 * 生成订单编码的工具
* *
@ -626,215 +585,50 @@ public class OrderUtil {
* @return 新建的订单对象仅拼团或处理结果Map * @return 新建的订单对象仅拼团或处理结果Map
*/ */
public static Object prepayCallback(UsersPayBefor payBefor, Users user) { public static Object prepayCallback(UsersPayBefor payBefor, Users user) {
System.out.println("=== prepayCallback 方法开始 ===");
System.out.println("输入参数 - payBefor: " + (payBefor != null ? payBefor.toString() : "null"));
System.out.println("输入参数 - user: " + (user != null ? user.toString() : "null"));
if (payBefor == null || user == null) { if (payBefor == null || user == null) {
System.out.println("参数验证失败 - payBefor或user为空");
return null; return null;
} }
int type = payBefor.getType() != null ? payBefor.getType().intValue() : 0; int type = payBefor.getType() != null ? payBefor.getType().intValue() : 0;
System.out.println("支付类型 - type: " + type);
System.out.println("服务类型 - servicetype: " + payBefor.getServicetype());
IOrderService orderService = SpringUtils.getBean(IOrderService.class); IOrderService orderService = SpringUtils.getBean(IOrderService.class);
// 拼团 // 拼团
if (type == 6){ if (payBefor.getServicetype()==2){
GoodsOrder gorder = new GoodsOrder(); GoodsOrder gorder = new GoodsOrder();
gorder.setMainOrderId(payBefor.getOrderid()); gorder.setMainOrderId(payBefor.getOrderid());
System.out.println("查询拼团商品订单 - orderid: " + payBefor.getOrderid());
List<GoodsOrder> orderslist =goodsOrderService.selectGoodsOrderList(gorder); List<GoodsOrder> orderslist =goodsOrderService.selectGoodsOrderList(gorder);
System.out.println("查询到的商品订单数量: " + (orderslist != null ? orderslist.size() : 0));
if (!orderslist.isEmpty()){ if (!orderslist.isEmpty()){
System.out.println("开始更新商品订单状态");
for (GoodsOrder goodsOrder : orderslist){ for (GoodsOrder goodsOrder : orderslist){
System.out.println("更新商品订单 - ID: " + goodsOrder.getId() + ", 原状态: " + goodsOrder.getStatus());
goodsOrder.setStatus(2L); goodsOrder.setStatus(2L);
goodsOrder.setTransactionId(payBefor.getPaycode()); goodsOrder.setTransactionId(payBefor.getPaycode());
int updateResult = goodsOrderService.updateGoodsOrder(goodsOrder); goodsOrderService.updateGoodsOrder(goodsOrder);
System.out.println("商品订单更新结果: " + updateResult);
} }
} else {
System.out.println("未找到相关商品订单");
} }
System.out.println("拼团商品订单处理完成返回orderid: " + payBefor.getOrderid());
return payBefor.getOrderid(); return payBefor.getOrderid();
} }
// 7上门费 8定金 9尾款 10差价
if (type == 11) {
GoodsOrder order = goodsOrderService.selectGoodsOrderByorderId(payBefor.getOrderid());
if (order != null) {
order.setStatus(2L);
order.setTransactionId(payBefor.getPaycode());
int updateResult = goodsOrderService.updateGoodsOrder(order);
}
return null;
}
if (type == 7) {
// 4. 查询对应的订单日志上门费记录
OrderLog orderLog = orderLogService.selectOrderLogById(payBefor.getOid());
if (orderLog != null) {
// 6. 更新上门费支付状态
orderLog.setPaid(2L); // 1已支付
//orderLog.setWorkerCost(new BigDecimal(totalFee));
orderLog.setPayTime(System.currentTimeMillis()/1000);
//orderLog.setUpdateTime(new Date());
int updateResult = orderLogService.updateOrderLog(orderLog);
if (updateResult > 0){
ISTOPAYSIZE(payBefor.getLastorderid());
}
// int paynum=usersPayBeforService.countByLastOrderIdAndStatus(order.getOrderId(), 1);
// Order order = orderService.selectOrderByOrderId(payBefor.getLastorderid());
// if (order != null) {
// if (order.getStatus() == 6){
//
// }
// }
}
return 1;
}
if (type == 8) {
// 4. 查询对应的订单日志定金记录
OrderLog orderLog = orderLogService.selectOrderLogById(payBefor.getOid());
if (orderLog != null) {
// 6. 更新定金支付状态
orderLog.setDepPaid(2); // 1已支付
orderLog.setDepPayTime(System.currentTimeMillis()/1000);
int updateResult = orderLogService.updateOrderLog(orderLog);
if (updateResult > 0){
ISTOPAYSIZE(payBefor.getLastorderid());
}
}
return 1;
}
if (type == 9) {
// 4. 查询对应的服务订单
Order order = orderService.selectOrderByOrderId(payBefor.getOrderid());
if (order != null) {
//更新最新的一条日志信息
OrderLog orderLog = orderLogService.selectDataTheFirstNew(order.getId());
orderLog.setPayTime(System.currentTimeMillis()/1000);
orderLog.setPaid(2L);
int updateResult = orderLogService.updateOrderLog(orderLog);
// OrderLog orderLog1 = orderLogService.selectOrderLogById(payBefor.getOid());
// 6. 更新订单支付状态
// order.setStatus(4L); // 2已支付
// // order.setTransactionId(transactionId);
// order.setPayTime(new Date());
// //order.setUpdateTime(new Date());
// // 计算实际支付金额分转换为元
// BigDecimal paidAmount = orderLog1.getPrice();
// order.setPayPrice(paidAmount);
// int updateResult = orderService.updateOrder(order);
if (updateResult > 0){
ISTOPAYSIZE(payBefor.getLastorderid());
}
}
return 1;
}
if (type == 10) {
OrderLog orderLog = orderLogService.selectOrderLogById(payBefor.getOid());
if (orderLog != null) {
// 6. 更新定金支付状态
orderLog.setCjPaid(2L);
orderLog.setDepPayTime(System.currentTimeMillis()/1000);
int updateResult = orderLogService.updateOrderLog(orderLog);
if (updateResult > 0){
ISTOPAYSIZE(payBefor.getLastorderid());
}
}
return 1;
}
//需求报价 //需求报价
if (type == 4) { if (type == 4) {
System.out.println("=== 处理需求报价订单 ===");
System.out.println("查询订单 - orderid: " + payBefor.getOrderid());
// 查询订单 // 查询订单
Order order = orderService.selectOrderByOrderId(payBefor.getOrderid()); Order order = orderService.selectOrderByOrderId(payBefor.getOrderid());
System.out.println("查询到的订单: " + (order != null ? order.toString() : "null"));
if (order != null) { if (order != null) {
// 更新订单状态为待服务2
UserDemandQuotation userDemandQuotation=userDemandQuotationService.selectUserDemandQuotationById(payBefor.getBaojiaid());
if (userDemandQuotation!=null) {
System.out.println("找到报价记录,开始处理");
//UserDemandQuotation userDemandQuotation=userDemandQuotationList.getFirst();
System.out.println("报价记录详情: " + userDemandQuotation.toString());
System.out.println("更新报价状态为被选中");
userDemandQuotation.setStatus(2L);//被选中状态
int quotationUpdateResult = userDemandQuotationService.updateUserDemandQuotation(userDemandQuotation);
System.out.println("报价状态更新结果: " + quotationUpdateResult);
System.out.println("查询师傅信息 - workerId: " + userDemandQuotation.getWorkerid());
Users users = usersService.selectUsersById(userDemandQuotation.getWorkerid());
System.out.println("查询到的师傅信息: " + (users != null ? users.toString() : "null"));
if (users != null){
order.setStatus(2L); order.setStatus(2L);
order.setJsonStatus(2); orderService.updateOrder(order);
order.setFirstWorkerId(users.getId());
order.setIsAccept(1);
order.setWorkerPhone(users.getPhone());
order.setWorkerId(users.getId());
int orderUpdateResult = orderService.updateOrder(order);
System.out.println("订单更新结果: " + orderUpdateResult);
// 添加订单日志 // 添加订单日志
System.out.println("添加订单日志");
OrderLog orderLog = new OrderLog(); OrderLog orderLog = new OrderLog();
orderLog.setOid(order.getId()); orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId()); orderLog.setOrderId(order.getOrderId());
orderLog.setTitle("报价订单支付成功"); orderLog.setTitle("报价订单支付成功");
orderLog.setType(new BigDecimal("2.0")); orderLog.setType(new BigDecimal("1.1"));
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "报价订单支付成功,待服务,师傅"+users.getName()); jsonObject.put("name", "报价订单支付成功,待服务");
orderLog.setContent(jsonObject.toJSONString()); orderLog.setContent(jsonObject.toJSONString());
int logInsertResult = orderLogService.insertOrderLog(orderLog); orderLogService.insertOrderLog(orderLog);
System.out.println("订单日志插入结果: " + logInsertResult);
System.out.println("需求报价订单处理完成");
} else {
System.out.println("未找到师傅信息,处理失败");
}
} else {
System.out.println("未找到报价记录,处理失败");
}
System.out.println("需求报价订单处理完成返回order: " + (order != null ? order.getOrderId() : "null"));
//dispatchOrderCheck(order);
return order; return order;
} else {
System.out.println("未找到订单,处理失败");
}
System.out.println("需求报价订单处理失败返回null");
return null;
}
if (type == 2) {
System.out.println("处理次卡订单");
IUserUseSecondaryCardService userUseSecondaryCardService = SpringUtils.getBean(IUserUseSecondaryCardService.class);
UserUseSecondaryCard userUseSecondaryCard = userUseSecondaryCardService.selectUserUseSecondaryCardByorderId(payBefor.getOrderid());
System.out.println("查询到的次卡记录: " + (userUseSecondaryCard != null ? userUseSecondaryCard.toString() : "null"));
if (userUseSecondaryCard != null) {
System.out.println("更新次卡状态");
userUseSecondaryCard.setStatus(1L);
int cardUpdateResult = userUseSecondaryCardService.updateUserUseSecondaryCard(userUseSecondaryCard);
System.out.println("次卡状态更新结果: " + cardUpdateResult);
} }
return null; return null;
} }
if (type == 1) { if (type == 1) {
System.out.println("=== 处理拼团订单 ===");
String ptorderid= payBefor.getOrderid(); String ptorderid= payBefor.getOrderid();
System.out.println("拼团订单ID: " + ptorderid);
//第一步创建订单状态为待成团 //第一步创建订单状态为待成团
Order order = new Order(); Order order = new Order();
order.setOdertype(1); // 拼团 order.setOdertype(1); // 拼团
@ -844,32 +638,23 @@ public class OrderUtil {
order.setNum(1L); // 默认1可根据业务调整 order.setNum(1L); // 默认1可根据业务调整
//order.setProductId(payBefor.getSku() != null ? Long.valueOf(payBefor.getSku()) : null); // 假设sku字段存储商品ID //order.setProductId(payBefor.getSku() != null ? Long.valueOf(payBefor.getSku()) : null); // 假设sku字段存储商品ID
order.setProductId(payBefor.getServiceid()); // 假设sku字段存储商品ID order.setProductId(payBefor.getServiceid()); // 假设sku字段存储商品ID
System.out.println("商品ID: " + payBefor.getServiceid());
IServiceGoodsService serviceGoodsService = SpringUtils.getBean(IServiceGoodsService.class); IServiceGoodsService serviceGoodsService = SpringUtils.getBean(IServiceGoodsService.class);
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(payBefor.getServiceid()); ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(payBefor.getServiceid());
System.out.println("查询到的商品信息: " + (serviceGoods != null ? serviceGoods.toString() : "null"));
// 商品名图片类型价格等 // 商品名图片类型价格等
String productName = ""; String productName = "";
if (serviceGoods != null) { if (serviceGoods != null) {
productName = serviceGoods.getTitle(); productName = serviceGoods.getTitle();
System.out.println("商品名称: " + productName);
} }
order.setProductName(productName); order.setProductName(productName);
order.setSku(payBefor.getSku()); order.setSku(payBefor.getSku());
order.setTotalPrice(payBefor.getAllmoney()); order.setTotalPrice(payBefor.getAllmoney());
order.setBigtype(3);
order.setPayPrice(payBefor.getWxmoney()); order.setPayPrice(payBefor.getWxmoney());
order.setCreateTime(new Date()); order.setCreateTime(new Date());
order.setType(1); // 服务订单 order.setType(1); // 服务订单
order.setCreateType(1); // 用户自主下单 order.setCreateType(1); // 用户自主下单
order.setUname(user.getName()); order.setUname(user.getName());
System.out.println("订单基本信息设置完成");
// 预约时间 // 预约时间
System.out.println("预约时间: " + payBefor.getMaketime());
if (payBefor.getMaketime() != null && !payBefor.getMaketime().isEmpty()) { if (payBefor.getMaketime() != null && !payBefor.getMaketime().isEmpty()) {
String[] makeTimeArr = payBefor.getMaketime().split(" "); String[] makeTimeArr = payBefor.getMaketime().split(" ");
if (makeTimeArr.length == 2) { if (makeTimeArr.length == 2) {
@ -883,26 +668,19 @@ public class OrderUtil {
} }
} }
} }
System.out.println("地址ID: " + payBefor.getAddressid());
if (payBefor.getAddressid() != null) { if (payBefor.getAddressid() != null) {
IUserAddressService userAddressService = SpringUtils.getBean(IUserAddressService.class); IUserAddressService userAddressService = SpringUtils.getBean(IUserAddressService.class);
UserAddress userAddress = userAddressService.selectUserAddressById(payBefor.getAddressid()); UserAddress userAddress = userAddressService.selectUserAddressById(payBefor.getAddressid());
System.out.println("查询到的地址信息: " + (userAddress != null ? userAddress.toString() : "null"));
if (userAddress != null) { if (userAddress != null) {
order.setAddressId(userAddress.getId()); order.setAddressId(userAddress.getId());
order.setName(userAddress.getName()); order.setName(userAddress.getName());
order.setPhone(userAddress.getPhone()); order.setPhone(userAddress.getPhone());
order.setAddress(userAddress.getAddressInfo()); order.setAddress(userAddress.getAddressInfo());
System.out.println("地址信息设置完成");
} }
} }
// 可补充其它字段如拼团价优惠券备注等 // 可补充其它字段如拼团价优惠券备注等
System.out.println("开始插入订单"); orderService.insertOrder(order);
int orderInsertResult = orderService.insertOrder(order);
System.out.println("订单插入结果: " + orderInsertResult + ", 订单ID: " + order.getId());
// 添加订单日志 // 添加订单日志
System.out.println("添加订单日志");
IOrderLogService orderLogService = SpringUtils.getBean(IOrderLogService.class); IOrderLogService orderLogService = SpringUtils.getBean(IOrderLogService.class);
//IOrderService orderService = SpringUtils.getBean(IOrderService.class); //IOrderService orderService = SpringUtils.getBean(IOrderService.class);
OrderLog orderLog = new OrderLog(); OrderLog orderLog = new OrderLog();
@ -913,100 +691,49 @@ public class OrderUtil {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "订单创建成功,待成团"); jsonObject.put("name", "订单创建成功,待成团");
orderLog.setContent(jsonObject.toJSONString()); orderLog.setContent(jsonObject.toJSONString());
int logInsertResult = orderLogService.insertOrderLog(orderLog); orderLogService.insertOrderLog(orderLog);
System.out.println("订单日志插入结果: " + logInsertResult);
//第二步修改拼团时候的状态 //第二步修改拼团时候的状态
System.out.println("=== 第二步:修改拼团状态 ===");
IUserGroupBuyingService userGroupBuyingService = SpringUtils.getBean(IUserGroupBuyingService.class); IUserGroupBuyingService userGroupBuyingService = SpringUtils.getBean(IUserGroupBuyingService.class);
UserGroupBuying userGroupBuying = userGroupBuyingService.selectUserGroupBuyingByptorderid(ptorderid); UserGroupBuying userGroupBuying = userGroupBuyingService.selectUserGroupBuyingByptorderid(ptorderid);
System.out.println("查询到的拼团记录: " + (userGroupBuying != null ? userGroupBuying.toString() : "null"));
if (userGroupBuying != null){ if (userGroupBuying != null){
System.out.println("更新拼团状态");
userGroupBuying.setStatus(1L); userGroupBuying.setStatus(1L);
userGroupBuying.setPaystatus(1L); userGroupBuying.setPaystatus(1L);
int groupUpdateResult = userGroupBuyingService.updateUserGroupBuying(userGroupBuying); userGroupBuyingService.updateUserGroupBuying(userGroupBuying);
System.out.println("拼团状态更新结果: " + groupUpdateResult);
} else {
System.out.println("未找到拼团记录");
} }
//第三步核验团数据如果满足条件都修改为待预约 //第三步核验团数据如果满足条件都修改为待预约
System.out.println("=== 第三步:核验团数据 ===");
System.out.println("团订单ID: " + payBefor.getGrouporderid());
System.out.println("商品拼团人数要求: " + (serviceGoods != null ? serviceGoods.getGroupnum() : "null"));
UserGroupBuying userGroupBuyingData = new UserGroupBuying(); UserGroupBuying userGroupBuyingData = new UserGroupBuying();
userGroupBuyingData.setOrderid(payBefor.getGrouporderid()); userGroupBuyingData.setOrderid(payBefor.getGrouporderid());
userGroupBuyingData.setPaystatus(1L); userGroupBuyingData.setPaystatus(1L);
userGroupBuyingData.setStatus(1L);
List<UserGroupBuying> userGroupBuyingList = userGroupBuyingService.selectUserGroupBuyingList(userGroupBuyingData); List<UserGroupBuying> userGroupBuyingList = userGroupBuyingService.selectUserGroupBuyingList(userGroupBuyingData);
System.out.println("已支付的拼团人数: " + (userGroupBuyingList != null ? userGroupBuyingList.size() : 0)); if (userGroupBuyingList.size() >= serviceGoods.getGroupnum()) {
if (userGroupBuyingList != null && serviceGoods != null && userGroupBuyingList.size() >= serviceGoods.getGroupnum()) {
System.out.println("拼团人数已满足要求,开始更新所有拼团订单状态");
for (UserGroupBuying groupBuying1 : userGroupBuyingList){ for (UserGroupBuying groupBuying1 : userGroupBuyingList){
System.out.println("更新拼团记录 - ID: " + groupBuying1.getId() + ", 订单ID: " + groupBuying1.getPtorderid()); groupBuying1.setStatus(1L);
groupBuying1.setStatus(2L);
groupBuying1.setPaystatus(1L); groupBuying1.setPaystatus(1L);
int groupUpdateResult = userGroupBuyingService.updateUserGroupBuying(groupBuying1); userGroupBuyingService.updateUserGroupBuying(groupBuying1);
System.out.println("拼团记录更新结果: " + groupUpdateResult);
Order orderdata = orderService.selectOrderByOrderId(groupBuying1.getPtorderid()); Order orderdata = orderService.selectOrderByOrderId(groupBuying1.getPtorderid());
System.out.println("查询到的订单: " + (orderdata != null ? orderdata.getOrderId() : "null"));
if (orderdata != null){ if (orderdata != null){
System.out.println("更新订单状态为已成团待预约");
orderdata.setStatus(10L);//已成团待预约 orderdata.setStatus(10L);//已成团待预约
int orderUpdateResult = orderService.updateOrder(orderdata); orderService.updateOrder(orderdata);
System.out.println("订单状态更新结果: " + orderUpdateResult);
} }
} }
System.out.println("拼团成功,所有订单状态已更新");
} }
System.out.println("拼团订单处理完成返回order: " + order.getOrderId());
dispatchOrderCheck(order);
return order; return order;
} else { // 其他类型 } else { // 其他类型
System.out.println("=== 处理其他类型订单 ===");
System.out.println("订单ID: " + payBefor.getOrderid());
// 只更新订单状态为待预约假设为1 // 只更新订单状态为待预约假设为1
if (payBefor.getOrderid() != null) { if (payBefor.getOrderid() != null) {
if (type == 2){ if (type == 2){
System.out.println("处理次卡订单");
IUserUseSecondaryCardService userUseSecondaryCardService = SpringUtils.getBean(IUserUseSecondaryCardService.class); IUserUseSecondaryCardService userUseSecondaryCardService = SpringUtils.getBean(IUserUseSecondaryCardService.class);
UserUseSecondaryCard userUseSecondaryCard = userUseSecondaryCardService.selectUserUseSecondaryCardByorderId(payBefor.getOrderid()); UserUseSecondaryCard userUseSecondaryCard = userUseSecondaryCardService.selectUserUseSecondaryCardByorderId(payBefor.getOrderid());
System.out.println("查询到的次卡记录: " + (userUseSecondaryCard != null ? userUseSecondaryCard.toString() : "null"));
if (userUseSecondaryCard != null){ if (userUseSecondaryCard != null){
System.out.println("更新次卡状态");
userUseSecondaryCard.setStatus(1L); userUseSecondaryCard.setStatus(1L);
int cardUpdateResult = userUseSecondaryCardService.updateUserUseSecondaryCard(userUseSecondaryCard); userUseSecondaryCardService.updateUserUseSecondaryCard(userUseSecondaryCard);
System.out.println("次卡状态更新结果: " + cardUpdateResult);
} else {
Order order = orderService.selectOrderByOrderId(payBefor.getOrderid());
System.out.println("添加订单日志");
OrderLog orderLog = new OrderLog();
orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId());
orderLog.setTitle("订单支付");
orderLog.setType(new BigDecimal("1.1"));
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "一口价订单支付成功,待派单");
orderLog.setContent(jsonObject.toJSONString());
int logInsertResult = orderLogService.insertOrderLog(orderLog);
order.setStatus(1L); // 1=待预约
int orderUpdateResult = orderService.updateOrder(order);
dispatchOrderCheck(order);
return order;
} }
System.out.println("次卡订单处理完成,返回: " + (userUseSecondaryCard != null ? userUseSecondaryCard.getId() : "null"));
return userUseSecondaryCard; return userUseSecondaryCard;
}else{ }else{
System.out.println("处理普通订单");
Order order = orderService.selectOrderByOrderId(payBefor.getOrderid()); Order order = orderService.selectOrderByOrderId(payBefor.getOrderid());
System.out.println("查询到的订单: " + (order != null ? order.toString() : "null"));
if (order != null) { if (order != null) {
System.out.println("添加订单日志");
OrderLog orderLog = new OrderLog(); OrderLog orderLog = new OrderLog();
orderLog.setOid(order.getId()); orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId()); orderLog.setOrderId(order.getOrderId());
@ -1015,24 +742,14 @@ public class OrderUtil {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "订单支付成功,待派单"); jsonObject.put("name", "订单支付成功,待派单");
orderLog.setContent(jsonObject.toJSONString()); orderLog.setContent(jsonObject.toJSONString());
int logInsertResult = orderLogService.insertOrderLog(orderLog); orderLogService.insertOrderLog(orderLog);
System.out.println("订单日志插入结果: " + logInsertResult);
System.out.println("更新订单状态为待派单");
order.setStatus(1L); // 1=待预约 order.setStatus(1L); // 1=待预约
int orderUpdateResult = orderService.updateOrder(order); orderService.updateOrder(order);
System.out.println("订单状态更新结果: " + orderUpdateResult);
System.out.println("普通订单处理完成返回order: " + order.getOrderId());
dispatchOrderCheck(order);
return order; return order;
} else { }
System.out.println("未找到订单");
} }
} }
} else {
System.out.println("订单ID为空无法处理");
}
System.out.println("其他类型订单处理失败返回null");
return null; return null;
} }
} }
@ -1090,172 +807,4 @@ public class OrderUtil {
} }
return false; return false;
} }
public static int ISTOPAYSIZE(String orderid) {
IUsersPayBeforService usersPayBeforService = SpringUtils.getBean(IUsersPayBeforService.class);
IOrderService orderService = SpringUtils.getBean(IOrderService.class);
int count = usersPayBeforService.countByLastOrderIdAndStatus(orderid);
System.out.println("count订单日志: " +count);
if(count <= 0){
Order order = orderService.selectOrderByOrderId(orderid);
if(order != null){
OrderLog orderLog = orderLogService.selectDataTheFirstNew(order.getId());
System.out.println("订单日志: " + (orderLog != null ? orderLog.toString() : "null"));
System.out.println("orderLog.getType()订单日志: " + orderLog.getType());
if(orderLog.getType().compareTo(new BigDecimal("6")) > 0){
// 修改订单状态为6
order.setStatus(6L);
orderService.updateOrder(order);
}
}
}
return count;
}
/**
* 派单效验方法
* @param order 订单对象需包含 productId
* @return 处理结果Map包含派单方式绑定工人等信息
*/
public static Map<String, Object> dispatchOrderCheck(Order order) {
IOrderService orderService = SpringUtils.getBean(IOrderService.class);
Map<String, Object> result = new HashMap<>();
if (order == null || order.getProductId() == null) {
result.put("success", false);
result.put("msg", "订单或商品ID为空");
return result;
}
IServiceGoodsService serviceGoodsService = SpringUtils.getBean(IServiceGoodsService.class);
IOrderLogService orderLogService = SpringUtils.getBean(IOrderLogService.class);
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(order.getProductId());
if (serviceGoods == null) {
result.put("success", false);
result.put("msg", "未找到对应服务商品");
return result;
}
if(order.getOdertype()==4){
return result;
}
Integer dispatchType = serviceGoods.getDispatchtype();
result.put("dispatchtype", dispatchType);
if (dispatchType != null && dispatchType == 3) {
// 指定工人派单
String workerIdsStr = serviceGoods.getWorkerids();
result.put("workerids", workerIdsStr);
if (workerIdsStr != null) {
Users users = usersService.selectUsersById(Long.valueOf(workerIdsStr));
order.setStatus(1L);
order.setFirstWorkerId(users.getId());
order.setIsAccept(1);
order.setWorkerPhone(users.getPhone());
order.setWorkerId(users.getId());
int orderUpdateResult = orderService.updateOrder(order);
// 添加订单日志
OrderLog orderLog = new OrderLog();
orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId());
orderLog.setTitle("订单支付成功");
orderLog.setType(new BigDecimal("1.0"));
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "一口价订单支付成功,待服务,师傅"+users.getName());
orderLog.setContent(jsonObject.toJSONString());
int logInsertResult = orderLogService.insertOrderLog(orderLog);
return result;
} else {
result.put("success", false);
result.put("msg", "服务未配置指定工人");
return result;
}
}
// 其他派单类型可扩展
result.put("success", true);
result.put("msg", "无需指定工人派单");
return result;
}
/**
* 获取维修订单派单师傅列表
* @param orderId 订单id
* @return 符合条件的师傅列表
*/
public static List<Users> getDispatchWorkerList(Long orderId) {
IUsersService usersService = SpringUtils.getBean(IUsersService.class);
IOrderService orderService = SpringUtils.getBean(IOrderService.class);
IServiceGoodsService serviceGoodsService = SpringUtils.getBean(IServiceGoodsService.class);
IUserAddressService userAddressService = SpringUtils.getBean(IUserAddressService.class);
List<Users> result = new ArrayList<>();
// 2. 查询订单服务地址
Order order = orderService.selectOrderById(orderId);
if (order == null) return result;
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(order.getProductId());
if (serviceGoods == null) return result;
UserAddress address = userAddressService.selectUserAddressById(order.getAddressId());
if (address == null) return result;
// 服务技能要求
List<String> requiredSkills = new ArrayList<>();
if (serviceGoods.getSkillIds() != null && !serviceGoods.getSkillIds().trim().isEmpty()) {
requiredSkills = JSONArray.parseArray(serviceGoods.getSkillIds(), String.class);
}
// 1. 查找当日签到过的师傅type=2is_stop=0worker_time为当天
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
Users query = new Users();
query.setType("2");
query.setWorkerTimeStr(today);
query.setSkillArr(requiredSkills);
query.setIsStop(0);
List<Users> signedWorkers = usersService.selectUsersList(query);
if (signedWorkers.isEmpty()) return result;
// 3. 逐个师傅筛选技能和服务区域
for (Users worker : signedWorkers) {
// // 技能匹配
// boolean skillMatch = false;
// if (worker.getSkillIds() != null && !worker.getSkillIds().trim().isEmpty() && !requiredSkills.isEmpty()) {
// List<String> workerSkills = com.alibaba.fastjson.JSONArray.parseArray(worker.getSkillIds(), String.class);
// for (String s : requiredSkills) {
// if (workerSkills.contains(s)) {
// skillMatch = true;
// break;
// }
// }
// }
// if (!skillMatch) continue;
// // 区域匹配
// boolean areaMatch = false;
// // 假设addressInfo字段中包含城市ID如有cityId字段请替换
// String addressCityId = null;
// if (address.getAddressInfo() != null) {
// addressCityId = address.getAddressInfo(); // 这里请根据实际情况提取城市ID
// }
// if (worker.getServiceCityIds() != null && !worker.getServiceCityIds().trim().isEmpty() && addressCityId != null) {
// List<String> workerAreas = com.alibaba.fastjson.JSONArray.parseArray(worker.getServiceCityIds(), String.class);
// if (workerAreas.contains(addressCityId)) {
// areaMatch = true;
// }
// }
// if (!areaMatch) continue;
result.add(worker);
}
// 排序先按等级降序再按质保金降序
result.sort((a, b) -> {
int levelA = a.getLevel() != null ? a.getLevel() : 0;
int levelB = b.getLevel() != null ? b.getLevel() : 0;
int cmp = Integer.compare(levelB, levelA);
if (cmp != 0) return cmp;
BigDecimal marginA = a.getMargin() != null ? a.getMargin() : BigDecimal.ZERO;
BigDecimal marginB = b.getMargin() != null ? b.getMargin() : BigDecimal.ZERO;
return marginB.compareTo(marginA);
});
return result;
}
public static void main(String[] args) {
// 构造一个测试用的json字符串
String testJson = "{\"project\":{\"name\":\"项目费用\",\"price\":1132.00},\"reduction\":{\"name\":\"优惠金额\",\"price\":\"1\"},\"deposit\":{\"name\":\"定金\",\"price\":\"10\"},\"basic\":[{\"name\":\"测试基建2\",\"select\":true},{\"name\":\"测试基建5\",\"select\":true},{\"name\":\"测试基建8\",\"select\":true}],\"craft\":[{\"name\":\"三挂一方柜\",\"price\":\"336.00\",\"pid\":192,\"id\":1889,\"count\":3}],\"material\":[{\"name\":\"其他辅料面议项\",\"price\":\"1.00\",\"id\":1241,\"pid\":93,\"count\":1},{\"name\":\"除味剂\",\"price\":\"28.00\",\"id\":1240,\"pid\":93,\"count\":1},{\"name\":\"除味剂\",\"price\":\"28.00\",\"id\":1196,\"pid\":93,\"count\":1},{\"name\":\"其他辅料面议项\",\"price\":\"1.00\",\"id\":1197,\"pid\":93,\"count\":1},{\"name\":\"其他辅料面议项\",\"price\":\"1.00\",\"id\":1197,\"pid\":92,\"count\":1},{\"name\":\"111\",\"price\":\"10.00\",\"id\":1250,\"pid\":92,\"count\":1},{\"name\":\"除味剂\",\"price\":\"28.00\",\"id\":1196,\"pid\":92,\"count\":2}]}";
OrderUtil util = new OrderUtil();
JSONObject result = util.getbaojiajson(testJson);
System.out.println("处理后的结果: " + result.toJSONString());
}
} }

View File

@ -1,6 +1,5 @@
package com.ruoyi.system.ControllerUtil; package com.ruoyi.system.ControllerUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SiteConfig; import com.ruoyi.system.domain.SiteConfig;
import com.ruoyi.system.domain.Users; import com.ruoyi.system.domain.Users;
@ -14,7 +13,6 @@ import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.OrderLog;
/** /**
* 预支付工具类 * 预支付工具类
@ -50,7 +48,7 @@ public class PayBeforeUtil {
*/ */
public String createPayBefore(Users user, BigDecimal amount, String orderId, Long oid, public String createPayBefore(Users user, BigDecimal amount, String orderId, Long oid,
Long serviceId, Long orderType, String sku, String grouporderid, Long serviceId, Long orderType, String sku, String grouporderid,
Long addressid, String maketime, String attachments,Long servicetype,Long baojiaid,String lastorderid) { Long addressid, String maketime, String attachments,Long servicetype) {
try { try {
// 计算会员优惠和服务金抵扣 // 计算会员优惠和服务金抵扣
BigDecimal memberMoney = BigDecimal.ZERO; BigDecimal memberMoney = BigDecimal.ZERO;
@ -85,6 +83,7 @@ public class PayBeforeUtil {
} }
// 购物金抵扣当servicetype=2时 // 购物金抵扣当servicetype=2时
if (servicetype != null && servicetype == 2) { if (servicetype != null && servicetype == 2) {
orderType= 5L;
Integer consumption = configJson.getInteger("consumption"); Integer consumption = configJson.getInteger("consumption");
if (consumption != null && consumption > 0) { if (consumption != null && consumption > 0) {
Users userDb = usersService.selectUsersById(user.getId()); Users userDb = usersService.selectUsersById(user.getId());
@ -124,10 +123,8 @@ public class PayBeforeUtil {
payBefore.setAddressid(addressid); payBefore.setAddressid(addressid);
payBefore.setMaketime(maketime != null ? maketime : ""); payBefore.setMaketime(maketime != null ? maketime : "");
payBefore.setAttachments(attachments != null ? attachments : ""); payBefore.setAttachments(attachments != null ? attachments : "");
payBefore.setBaojiaid(baojiaid);
payBefore.setStatus(1L); // 1待支付 payBefore.setStatus(1L); // 1待支付
payBefore.setPaytype(1L); // 默认微信支付 payBefore.setPaytype(1L); // 默认微信支付
payBefore.setLastorderid(lastorderid != null ? lastorderid : "");
int result = usersPayBeforService.insertUsersPayBefor(payBefore); int result = usersPayBeforService.insertUsersPayBefor(payBefore);
if (result > 0) { if (result > 0) {
return payBefore.getOrderid(); return payBefore.getOrderid();
@ -239,7 +236,7 @@ public class PayBeforeUtil {
* @return 预支付记录ID失败返回null * @return 预支付记录ID失败返回null
*/ */
public String createPayBefore(Users user, BigDecimal amount) { public String createPayBefore(Users user, BigDecimal amount) {
return createPayBefore(user, amount, null, null, 0L, 0L, null, null, null, null, null,null, null,null); return createPayBefore(user, amount, null, null, 0L, 0L, null, null, null, null, null,null);
} }
/** /**
@ -255,7 +252,7 @@ public class PayBeforeUtil {
*/ */
public String createPayBefore(Users user, BigDecimal amount, String orderId, Long oid, public String createPayBefore(Users user, BigDecimal amount, String orderId, Long oid,
Long serviceId, Long orderType) { Long serviceId, Long orderType) {
return createPayBefore(user, amount, orderId, oid, serviceId, orderType, null, null, null, null, null,null, null, null); return createPayBefore(user, amount, orderId, oid, serviceId, orderType, null, null, null, null, null,null);
} }
/** /**
@ -338,78 +335,4 @@ public class PayBeforeUtil {
return false; return false;
} }
} }
/**
* 报价预支付数据处理
* @param user 用户实体
* @param orderLog 订单日志实体
* @param baojiajson 报价json字符串
*/
public void handleQuotationPayBefore(Users user, OrderLog orderLog, String baojiajson,String lastorderid) {
if (user == null || orderLog == null || baojiajson == null || baojiajson.trim().isEmpty()) {
return;
}
try {
com.alibaba.fastjson2.JSONObject json = com.alibaba.fastjson2.JSONObject.parseObject(baojiajson);
// 处理定金
JSONObject deposit = json.getJSONObject("deposit");
if (deposit != null) {
String depositPriceStr = deposit.getString("price");
BigDecimal depositPrice = null;
try {
depositPrice = new BigDecimal(depositPriceStr);
} catch (Exception ignore) {}
if (depositPrice != null && depositPrice.compareTo(BigDecimal.ZERO) > 0) {
// 添加定金预支付信息
this.createPayBefore(
user,
depositPrice,
orderLog.getDepLogId(), // orderid
orderLog.getId(), // oid
null, // serviceId
8L, // type=8 定金
null, null, null, null, null, 1L, null, lastorderid
);
}
}
// 处理尾款
JSONObject project = json.getJSONObject("project");
if (project != null) {
String projectPriceStr = project.getString("price");
BigDecimal projectPrice = null;
try {
projectPrice = new BigDecimal(projectPriceStr);
} catch (Exception ignore) {}
if (projectPrice != null && projectPrice.compareTo(BigDecimal.ZERO) > 0) {
// 判断优惠金额
JSONObject reduction = json.getJSONObject("reduction");
BigDecimal reductionPrice = BigDecimal.ZERO;
if (reduction != null) {
String reductionPriceStr = reduction.getString("price");
try {
reductionPrice = new BigDecimal(reductionPriceStr);
} catch (Exception ignore) {}
}
BigDecimal finalTail = projectPrice;
if (reductionPrice != null && reductionPrice.compareTo(BigDecimal.ZERO) > 0) {
finalTail = projectPrice.subtract(reductionPrice);
}
if (finalTail.compareTo(BigDecimal.ZERO) > 0) {
// 添加尾款预支付信息
this.createPayBefore(
user,
finalTail,
orderLog.getLogOrderId(), // orderid
orderLog.getId(), // oid
null, // serviceId
9L, // type=9 尾款
null, null, null, null, null, 1L, null, lastorderid
);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
} }

View File

@ -1,96 +0,0 @@
package com.ruoyi.system.ControllerUtil;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.service.*;
import com.ruoyi.system.ControllerUtil.WechatPayV3Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Map;
@Component
public class RefundUtil {
private static IUsersService usersService = SpringUtils.getBean(IUsersService.class);
private static WechatPayV3Util wechatPayV3Util = SpringUtils.getBean(WechatPayV3Util.class);
private static IGoodsOrderService goodsOrderService = SpringUtils.getBean(IGoodsOrderService.class);
private static IUserDemandQuotationService userDemandQuotationService = SpringUtils.getBean(IUserDemandQuotationService.class);
private static IUsersPayBeforService usersPayBeforService = SpringUtils.getBean(IUsersPayBeforService.class);
private static IUserMemnerConsumptionLogService userMemnerConsumptionLogService = SpringUtils.getBean(IUserMemnerConsumptionLogService.class);
private static IUserGroupBuyingService userGroupBuyingService = SpringUtils.getBean(IUserGroupBuyingService.class);
// 退款方法
public boolean refundOrder(String orderid) {
// 查询预支付记录
UsersPayBefor payBefor = usersPayBeforService.selectUsersPayBeforByOrderId(orderid);
if (payBefor == null) {
return false;
}
boolean refundSuccess = false;
// paytype=4微信退款金额为allmoney
if (payBefor.getPaytype() != null && payBefor.getPaytype() == 4) {
if (payBefor.getAllmoney() != null && payBefor.getAllmoney().compareTo(BigDecimal.ZERO) > 0) {
Map<String, Object> refundSuccessdata = wechatPayV3Util.refund(payBefor.getOrderid(), payBefor.getPaycode(), payBefor.getAllmoney().intValue(), payBefor.getAllmoney().intValue(), "退款", "");
refundSuccess = true; // 可根据refundSuccessdata内容判断
}
} else {
boolean wxRefunded = false;
boolean yeRefunded = false;
if (payBefor.getWxmoney() != null && payBefor.getWxmoney().compareTo(BigDecimal.ZERO) > 0) {
Map<String, Object> refundSuccessdata = wechatPayV3Util.refund(
payBefor.getOrderid(),
payBefor.getPaycode(),
payBefor.getWxmoney().intValue(),
payBefor.getWxmoney().intValue(),
"退款",
""
);
wxRefunded = true; // 可根据refundSuccessdata内容判断
}
if (payBefor.getYemoney() != null && payBefor.getYemoney().compareTo(BigDecimal.ZERO) > 0) {
yeRefunded = refundBalance(payBefor);
}
refundSuccess = wxRefunded || yeRefunded; // 或者 wxRefunded && yeRefunded
}
// 退款成功后修改状态为3
if (refundSuccess) {
payBefor.setStatus(3L);
usersPayBeforService.updateUsersPayBefor(payBefor);
}
return refundSuccess;
}
// 余额退款逻辑及流水记录
private boolean refundBalance(UsersPayBefor payBefor) {
if (payBefor.getUid() == null || payBefor.getYemoney() == null || payBefor.getYemoney().compareTo(BigDecimal.ZERO) <= 0) {
return false;
}
Users user = usersService.selectUsersById(payBefor.getUid());
if (user == null) return false;
BigDecimal before = user.getBalance();
user.setBalance(user.getBalance().add(payBefor.getYemoney()));
int update = usersService.updateUsers(user);
if (update <= 0) return false;
// 写入退款流水
UserMemnerConsumptionLog log = new UserMemnerConsumptionLog();
log.setUid(Math.toIntExact(user.getId()));
log.setConsumptiontype(4); // 4=余额退款
log.setConsumptiontime(new java.util.Date());
log.setConsumptionmoney(payBefor.getYemoney());
log.setReamk("余额退款,订单号:" + payBefor.getOrderid());
log.setBeformoney(before);
log.setAftermoney(user.getBalance());
log.setNowmoney(user.getBalance());
log.setType(1); // 1=收入
userMemnerConsumptionLogService.insertUserMemnerConsumptionLog(log);
UserGroupBuying groupBuying = userGroupBuyingService.selectUserGroupBuyingByptorderid(payBefor.getOrderid());
if (groupBuying != null) {
groupBuying.setStatus(3L);
userGroupBuyingService.updateUserGroupBuying(groupBuying);
}
// 可选推送退款消息
// WXsendMsgUtil.sendUserPayMoney(user.getOpenid(), "余额退款成功", payBefor.getYemoney().toString(), "1", "余额退款成功");
return true;
}
}

View File

@ -81,7 +81,7 @@ public class WechatPayUtil {
private static final String WECHAT_TRANSFER_URL = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"; // 企业付款 private static final String WECHAT_TRANSFER_URL = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"; // 企业付款
public static final String PAY_FH = "https://4a8ed13a.r3.cpolar.top/"; public static final String PAY_FH = "https://c5ed8e7.r3.cpolar.top/";
/** /**
* 其他配置常量 * 其他配置常量
*/ */

View File

@ -2,8 +2,6 @@ package com.ruoyi.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -202,16 +200,6 @@ public class Order extends BaseEntity
/** 订单附件 */ /** 订单附件 */
@Excel(name = "订单附件") @Excel(name = "订单附件")
private String fileData; private String fileData;
private String ispay;
private Long baojiasf;
private Long baojiayh;
private List<String> ids;
/** 录音文件 */ /** 录音文件 */
@Excel(name = "订单类别 1预约 2报价 3一口价 4拼团 5普通订单") @Excel(name = "订单类别 1预约 2报价 3一口价 4拼团 5普通订单")
private int odertype; private int odertype;
@ -267,25 +255,6 @@ public class Order extends BaseEntity
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date deletedAt; private Date deletedAt;
private Long makeTimeStart;
private Long makeTimeEnd;
public Long getMakeTimeStart() { return makeTimeStart; }
public void setMakeTimeStart(Long makeTimeStart) { this.makeTimeStart = makeTimeStart; }
public Long getMakeTimeEnd() { return makeTimeEnd; }
public void setMakeTimeEnd(Long makeTimeEnd) { this.makeTimeEnd = makeTimeEnd; }
private String dayDate;
public String getDayDate() { return dayDate; }
public void setDayDate(String dayDate) { this.dayDate = dayDate; }
private Date receiveTimeStart;
private Date receiveTimeEnd;
public Date getReceiveTimeStart() { return receiveTimeStart; }
public void setReceiveTimeStart(Date receiveTimeStart) { this.receiveTimeStart = receiveTimeStart; }
public Date getReceiveTimeEnd() { return receiveTimeEnd; }
public void setReceiveTimeEnd(Date receiveTimeEnd) { this.receiveTimeEnd = receiveTimeEnd; }
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
@ -918,41 +887,6 @@ public class Order extends BaseEntity
this.bigtype = bigtype; this.bigtype = bigtype;
} }
public Long getBaojiasf() {
return baojiasf;
}
public void setBaojiasf(Long baojiasf) {
this.baojiasf = baojiasf;
}
public Long getBaojiayh() {
return baojiayh;
}
public void setBaojiayh(Long baojiayh) {
this.baojiayh = baojiayh;
}
public List<String> getIds() {
return ids;
}
public void setIds(List<String> ids) {
this.ids = ids;
}
public String getIspay() {
return ispay;
}
public void setIspay(String ispay) {
this.ispay = ispay;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -81,14 +81,6 @@ public class OrderLog extends BaseEntity
@Excel(name = "工人id") @Excel(name = "工人id")
private Long workerId; private Long workerId;
/** 工人id */
@Excel(name = "补差价金额")
private BigDecimal cjMoney;
/** 工人id */
@Excel(name = "补差价状态")
private Long cjPaid;
/** 工人id */ /** 工人id */
@Excel(name = "工人id") @Excel(name = "工人id")
@ -416,23 +408,6 @@ public class OrderLog extends BaseEntity
this.workerName = workerName; this.workerName = workerName;
} }
public BigDecimal getCjMoney() {
return cjMoney;
}
public void setCjMoney(BigDecimal cjMoney) {
this.cjMoney = cjMoney;
}
public Long getCjPaid() {
return cjPaid;
}
public void setCjPaid(Long cjPaid) {
this.cjPaid = cjPaid;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,18 +0,0 @@
package com.ruoyi.system.domain;
public class OrderTypeCount {
private int bigtype;
private int count;
public OrderTypeCount() {}
public OrderTypeCount(int bigtype, int count) {
this.bigtype = bigtype;
this.count = count;
}
public int getBigtype() { return bigtype; }
public void setBigtype(int bigtype) { this.bigtype = bigtype; }
public int getCount() { return count; }
public void setCount(int count) { this.count = count; }
}

View File

@ -66,14 +66,6 @@ public class QuoteMaterial extends BaseEntity
@Excel(name = "附件图片") @Excel(name = "附件图片")
private String image; private String image;
@Excel(name = "附件图片")
private String manyimages;
@Excel(name = "附件图片")
private String content;
@Excel(name = "是否有分佣 1:有 2:无 (默认有分佣)") @Excel(name = "是否有分佣 1:有 2:无 (默认有分佣)")
private Integer iscommissions; private Integer iscommissions;
@ -257,23 +249,6 @@ public class QuoteMaterial extends BaseEntity
this.image = image; this.image = image;
} }
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getManyimages() {
return manyimages;
}
public void setManyimages(String manyimages) {
this.manyimages = manyimages;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -40,10 +40,6 @@ public class UserDemandQuotation extends BaseEntity
/** 状态 1报价 2被选中 */ /** 状态 1报价 2被选中 */
private Long status; private Long status;
/** 状态 1报价 2被选中 */
private Long oid;
/** 师傅图像 */ /** 师傅图像 */
@Excel(name = "师傅图像") @Excel(name = "师傅图像")
private String workerimage; private String workerimage;
@ -159,15 +155,6 @@ public class UserDemandQuotation extends BaseEntity
return updatedAt; return updatedAt;
} }
public Long getOid() {
return oid;
}
public void setOid(Long oid) {
this.oid = oid;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -3,7 +3,6 @@ package com.ruoyi.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -183,38 +182,11 @@ public class Users extends BaseEntity
private BigDecimal commissionMin; private BigDecimal commissionMin;
private BigDecimal commissionMax; private BigDecimal commissionMax;
private String remember_token; private String remember_token;
private String workerTimeStr;
private Map<String, Object> order_num; private Map<String, Object> order_num;
private Map<String, Object> goods_order_num; private Map<String, Object> goods_order_num;
private List<String> areaList;
private String skill;
// 个人中心接口扩展字段
private Object levelInfo;
private String levelImg;
private String prohibit;
private List<String> skillArr;
private List<Object> serviceCityArr;
public Object getLevelInfo() { return levelInfo; }
public void setLevelInfo(Object levelInfo) { this.levelInfo = levelInfo; }
public String getLevelImg() { return levelImg; }
public void setLevelImg(String levelImg) { this.levelImg = levelImg; }
public String getProhibit() { return prohibit; }
public void setProhibit(String prohibit) { this.prohibit = prohibit; }
public List<String> getSkillArr() { return skillArr; }
public void setSkillArr(List<String> skillArr) { this.skillArr = skillArr; }
public List<Object> getServiceCityArr() { return serviceCityArr; }
public void setServiceCityArr(List<Object> serviceCityArr) { this.serviceCityArr = serviceCityArr; }
public String getWorkerTimeStr() {
return workerTimeStr;
}
public void setWorkerTimeStr(String workerTimeStr) {
this.workerTimeStr = workerTimeStr;
}
public void setId(Long id) public void setId(Long id)
{ {
@ -653,11 +625,6 @@ public class Users extends BaseEntity
this.birthday = birthday; this.birthday = birthday;
} }
public List<String> getAreaList() { return areaList; }
public void setAreaList(List<String> areaList) { this.areaList = areaList; }
public String getSkill() { return skill; }
public void setSkill(String skill) { this.skill = skill; }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -66,13 +66,6 @@ public class UsersPayBefor extends BaseEntity
@Excel(name = "美团号") @Excel(name = "美团号")
private String mtcode; private String mtcode;
/** 美团号 */
@Excel(name = "")
private String lastorderid;
/** 美团抵扣金额 */ /** 美团抵扣金额 */
@Excel(name = "美团抵扣金额") @Excel(name = "美团抵扣金额")
private BigDecimal mtmoney; private BigDecimal mtmoney;
@ -105,8 +98,6 @@ public class UsersPayBefor extends BaseEntity
private Long servicetype; private Long servicetype;
private Long baojiaid;
private String sku; private String sku;
private Long addressid; private Long addressid;
private String maketime; private String maketime;
@ -364,23 +355,6 @@ public class UsersPayBefor extends BaseEntity
this.servicetype = servicetype; this.servicetype = servicetype;
} }
public Long getBaojiaid() {
return baojiaid;
}
public void setBaojiaid(Long baojiaid) {
this.baojiaid = baojiaid;
}
public String getLastorderid() {
return lastorderid;
}
public void setLastorderid(String lastorderid) {
this.lastorderid = lastorderid;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -29,14 +29,6 @@ public interface GoodsOrderMapper
public int selectAllCountGoodsOrderByUid(Long uid); public int selectAllCountGoodsOrderByUid(Long uid);
/**
* 统计指定用户和状态的商品订单数量
* @param uid 用户id
* @param status 订单状态
* @return 订单数量
*/
Integer countGoodsOrderByUidAndStatus(@Param("uid") Long uid, @Param("status") Integer status);
/** /**
* 查询商品订单列表 * 查询商品订单列表

View File

@ -64,22 +64,4 @@ public interface OrderCommentMapper
* @return 结果 * @return 结果
*/ */
public int deleteOrderCommentByIds(Long[] ids); public int deleteOrderCommentByIds(Long[] ids);
/**
* 根据oid列表和type分页查询评价
* @param oids 订单id列表
* @param type 评价类型可为null
* @param offset 分页起始
* @param limit 分页大小
* @return 评价列表
*/
List<OrderComment> selectOrderCommentListByOidsAndType(List<Long> oids, Long type, int offset, int limit);
/**
* 根据oid列表和type统计数量
* @param oids 订单id列表
* @param type 评价类型
* @return 数量
*/
int countByOidsAndType(List<Long> oids, Long type);
} }

View File

@ -70,11 +70,4 @@ public interface OrderLogMapper
* @return 结果 * @return 结果
*/ */
public int deleteOrderLogByIds(Long[] ids); public int deleteOrderLogByIds(Long[] ids);
/**
* 根据师傅ID查询所有服务订单oid
* @param workerId 师傅ID
* @return oid列表
*/
List<Long> selectOidListByWorkerId(Long workerId);
} }

View File

@ -4,7 +4,6 @@ import java.util.List;
import com.ruoyi.system.domain.AppleDoMain.OrderApple; import com.ruoyi.system.domain.AppleDoMain.OrderApple;
import com.ruoyi.system.domain.Order; import com.ruoyi.system.domain.Order;
import com.ruoyi.system.domain.OrderTypeCount;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -77,12 +76,4 @@ public interface OrderMapper
* @return 结果 * @return 结果
*/ */
public int deleteOrderByIds(Long[] ids); public int deleteOrderByIds(Long[] ids);
/**
* 统计指定用户和类型的订单数量
* @param uid 用户id
* @param type 订单类型
* @return 订单数量
*/
Integer selectOrderCountByBigtype(@Param("uid") Long uid, @Param("type") Integer type);
} }

View File

@ -63,11 +63,4 @@ public interface UsersPayBeforMapper
* @return 结果 * @return 结果
*/ */
public int deleteUsersPayBeforByIds(Long[] ids); public int deleteUsersPayBeforByIds(Long[] ids);
/**
* 统计lastorderid=orderid且status=status的数量
* @param orderid 订单id
* @return 数量
*/
public Integer countByLastOrderIdAndStatus(String orderid);
} }

View File

@ -33,14 +33,6 @@ public interface IGoodsOrderService
public int selectAllCountGoodsOrderByUid(Long uid); public int selectAllCountGoodsOrderByUid(Long uid);
/**
* 统计指定用户和状态的商品订单数量
* @param uid 用户id
* @param status 订单状态
* @return 订单数量
*/
Integer countGoodsOrderByUidAndStatus(Long uid, Integer status);
/** /**
* 新增商品订单 * 新增商品订单

View File

@ -59,22 +59,4 @@ public interface IOrderCommentService
* @return 结果 * @return 结果
*/ */
public int deleteOrderCommentById(Long id); public int deleteOrderCommentById(Long id);
/**
* 根据oid列表和type分页查询评价
* @param oids 订单id列表
* @param type 评价类型可为null
* @param offset 分页起始
* @param limit 分页大小
* @return 评价列表
*/
List<OrderComment> selectOrderCommentListByOidsAndType(List<Long> oids, Long type, int offset, int limit);
/**
* 根据oid列表和type统计数量
* @param oids 订单id列表
* @param type 评价类型
* @return 数量
*/
int countByOidsAndType(List<Long> oids, Long type);
} }

View File

@ -85,11 +85,4 @@ public interface IOrderLogService
* @return 结果 * @return 结果
*/ */
public int deleteOrderLogById(Long id); public int deleteOrderLogById(Long id);
/**
* 根据师傅ID查询所有服务订单oid
* @param workerId 师傅ID
* @return oid列表
*/
List<Long> selectOidListByWorkerId(Long workerId);
} }

View File

@ -4,7 +4,6 @@ import java.util.List;
import com.ruoyi.system.domain.AppleDoMain.OrderApple; import com.ruoyi.system.domain.AppleDoMain.OrderApple;
import com.ruoyi.system.domain.Order; import com.ruoyi.system.domain.Order;
import com.ruoyi.system.domain.OrderTypeCount;
/** /**
* 服务订单Service接口 * 服务订单Service接口
@ -75,12 +74,4 @@ public interface IOrderService
* @return 结果 * @return 结果
*/ */
public int deleteOrderById(Long id); public int deleteOrderById(Long id);
/**
* 统计指定用户和类型的订单数量
* @param uid 用户id
* @param type 订单类型
* @return 订单数量
*/
Integer selectOrderCountByBigtype(Long uid, Integer type);
} }

View File

@ -62,12 +62,4 @@ public interface IUsersPayBeforService
* @return 结果 * @return 结果
*/ */
public int deleteUsersPayBeforById(Long id); public int deleteUsersPayBeforById(Long id);
/**
* 统计lastorderid=orderid且status=status的数量
* @param orderid 订单id
* @return 数量
*/
public Integer countByLastOrderIdAndStatus(String orderid);
} }

View File

@ -46,11 +46,6 @@ public class GoodsOrderServiceImpl implements IGoodsOrderService
return goodsOrderMapper.selectAllCountGoodsOrderByUid(uid); return goodsOrderMapper.selectAllCountGoodsOrderByUid(uid);
} }
@Override
public Integer countGoodsOrderByUidAndStatus(Long uid, Integer status) {
return goodsOrderMapper.countGoodsOrderByUidAndStatus(uid, status);
}
/** /**
* 查询商品订单列表 * 查询商品订单列表
* *

View File

@ -51,16 +51,6 @@ public class OrderCommentServiceImpl implements IOrderCommentService
return orderCommentMapper.selectOrderCommentList(orderComment); return orderCommentMapper.selectOrderCommentList(orderComment);
} }
@Override
public List<OrderComment> selectOrderCommentListByOidsAndType(List<Long> oids, Long type, int offset, int limit) {
return orderCommentMapper.selectOrderCommentListByOidsAndType(oids, type, offset, limit);
}
@Override
public int countByOidsAndType(List<Long> oids, Long type) {
return orderCommentMapper.countByOidsAndType(oids, type);
}
/** /**
* 新增订单评价 * 新增订单评价
* *

View File

@ -1,8 +1,6 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.system.ControllerUtil.GenerateCustomCode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OrderLogMapper; import com.ruoyi.system.mapper.OrderLogMapper;
@ -91,7 +89,6 @@ public class OrderLogServiceImpl implements IOrderLogService
@Override @Override
public int insertOrderLog(OrderLog orderLog) public int insertOrderLog(OrderLog orderLog)
{ {
return orderLogMapper.insertOrderLog(orderLog); return orderLogMapper.insertOrderLog(orderLog);
} }
@ -130,14 +127,4 @@ public class OrderLogServiceImpl implements IOrderLogService
{ {
return orderLogMapper.deleteOrderLogById(id); return orderLogMapper.deleteOrderLogById(id);
} }
/**
* 根据师傅ID查询所有服务订单oid
* @param workerId 师傅ID
* @return oid列表
*/
@Override
public List<Long> selectOidListByWorkerId(Long workerId) {
return orderLogMapper.selectOidListByWorkerId(workerId);
}
} }

View File

@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OrderMapper; import com.ruoyi.system.mapper.OrderMapper;
import com.ruoyi.system.domain.Order; import com.ruoyi.system.domain.Order;
import com.ruoyi.system.service.IOrderService; import com.ruoyi.system.service.IOrderService;
import com.ruoyi.system.domain.OrderTypeCount;
/** /**
* 服务订单Service业务层处理 * 服务订单Service业务层处理
@ -70,10 +69,6 @@ public class OrderServiceImpl implements IOrderService
return orderMapper.selectOrderList(order); return orderMapper.selectOrderList(order);
} }
@Override
public Integer selectOrderCountByBigtype(Long uid, Integer type) {
return orderMapper.selectOrderCountByBigtype(uid, type);
}
/** /**
* 新增服务订单 * 新增服务订单
* *

View File

@ -95,9 +95,4 @@ public class UsersPayBeforServiceImpl implements IUsersPayBeforService
{ {
return usersPayBeforMapper.deleteUsersPayBeforById(id); return usersPayBeforMapper.deleteUsersPayBeforById(id);
} }
@Override
public Integer countByLastOrderIdAndStatus(String orderid) {
return usersPayBeforMapper.countByLastOrderIdAndStatus(orderid);
}
} }

View File

@ -88,9 +88,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(1) from goods_order where uid = #{uid} select count(1) from goods_order where uid = #{uid}
</select> </select>
<select id="countGoodsOrderByUidAndStatus" resultType="Integer">
select count(1) from goods_order where uid = #{uid} and status = #{status}
</select>
<insert id="insertGoodsOrder" parameterType="GoodsOrder" useGeneratedKeys="true" keyProperty="id"> <insert id="insertGoodsOrder" parameterType="GoodsOrder" useGeneratedKeys="true" keyProperty="id">

View File

@ -121,36 +121,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectOrderCommentListByOidsAndType" resultMap="OrderCommentResult">
select * from order_comment
<where>
<if test="oids != null and oids.size > 0">
and oid in
<foreach collection="oids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="type != null">
and num_type = #{type}
</if>
</where>
order by id desc
limit #{offset}, #{limit}
</select>
<select id="countByOidsAndType" resultType="int">
select count(1) from order_comment
<where>
<if test="oids != null and oids.size > 0">
and oid in
<foreach collection="oids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="type != null">
and num_type = #{type}
</if>
</where>
</select>
</mapper> </mapper>

View File

@ -17,10 +17,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="depPayTime" column="dep_pay_time" /> <result property="depPayTime" column="dep_pay_time" />
<result property="depLogId" column="dep_log_id" /> <result property="depLogId" column="dep_log_id" />
<result property="price" column="price" /> <result property="price" column="price" />
<result property="cjMoney" column="cj_money" />
<result property="cjPaid" column="cj_paid" />
<result property="paid" column="paid" /> <result property="paid" column="paid" />
<result property="payTime" column="pay_time" /> <result property="payTime" column="pay_time" />
<result property="logId" column="log_id" /> <result property="logId" column="log_id" />
@ -39,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectOrderLogVo"> <sql id="selectOrderLogVo">
select id, oid, order_id, log_order_id,cj_money,cj_paid, title, type, content, deposit, dep_paid, dep_pay_time, dep_log_id, price, paid, pay_time, log_id, worker_id, first_worker_id, give_up, worker_cost, reduction_price, is_pause, coupon_id, deduction, worker_log_id, created_at, updated_at, deleted_at from order_log select id, oid, order_id, log_order_id, title, type, content, deposit, dep_paid, dep_pay_time, dep_log_id, price, paid, pay_time, log_id, worker_id, first_worker_id, give_up, worker_cost, reduction_price, is_pause, coupon_id, deduction, worker_log_id, created_at, updated_at, deleted_at from order_log
</sql> </sql>
<select id="selectOrderLogList" parameterType="OrderLog" resultMap="OrderLogResult"> <select id="selectOrderLogList" parameterType="OrderLog" resultMap="OrderLogResult">
@ -108,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDataTheFirstNew" parameterType="Long" resultMap="OrderLogResult"> <select id="selectDataTheFirstNew" parameterType="Long" resultMap="OrderLogResult">
<include refid="selectOrderLogVo"/> <include refid="selectOrderLogVo"/>
where oid = #{oid} where oid = #{oid}
ORDER BY id DESC LIMIT 1; ORDER BY updated_at DESC LIMIT 1;
</select> </select>
@ -116,10 +112,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from order_log where order_id = #{orderId} order by id DESC select * from order_log where order_id = #{orderId} order by id DESC
</select> </select>
<select id="selectOidListByWorkerId" parameterType="java.lang.Long" resultType="java.lang.Long">
select DISTINCT oid from order_log where worker_id = #{workerId}
</select>
<insert id="insertOrderLog" parameterType="OrderLog" useGeneratedKeys="true" keyProperty="id"> <insert id="insertOrderLog" parameterType="OrderLog" useGeneratedKeys="true" keyProperty="id">
insert into order_log insert into order_log
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -147,8 +139,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deduction != null">deduction,</if> <if test="deduction != null">deduction,</if>
<if test="workerLogId != null">worker_log_id,</if> <if test="workerLogId != null">worker_log_id,</if>
<if test="deletedAt != null">deleted_at,</if> <if test="deletedAt != null">deleted_at,</if>
<if test="cjMoney != null">cj_money,</if>
<if test="cjPaid != null">cj_paid,</if>
created_at, created_at,
updated_at updated_at
@ -178,8 +168,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deduction != null">#{deduction},</if> <if test="deduction != null">#{deduction},</if>
<if test="workerLogId != null">#{workerLogId},</if> <if test="workerLogId != null">#{workerLogId},</if>
<if test="deletedAt != null">#{deletedAt},</if> <if test="deletedAt != null">#{deletedAt},</if>
<if test="cjMoney != null">#{cjMoney},</if>
<if test="cjPaid != null">#{cjPaid},</if>
NOW(), NOW(),
NOW() NOW()
@ -213,8 +201,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deduction != null">deduction = #{deduction},</if> <if test="deduction != null">deduction = #{deduction},</if>
<if test="workerLogId != null">worker_log_id = #{workerLogId},</if> <if test="workerLogId != null">worker_log_id = #{workerLogId},</if>
<if test="deletedAt != null">deleted_at = #{deletedAt},</if> <if test="deletedAt != null">deleted_at = #{deletedAt},</if>
<if test="cjMoney != null">cj_money = #{cjMoney},</if>
<if test="cjPaid != null">cj_paid = #{cjPaid},</if>
updated_at = NOW() updated_at = NOW()
</trim> </trim>

View File

@ -182,23 +182,6 @@
<if test="bigtype != null and bigtype != null"> <if test="bigtype != null and bigtype != null">
and bigtype = #{bigtype} and bigtype = #{bigtype}
</if> </if>
<if test="makeTimeStart != null and makeTimeEnd != null">
and make_time &gt;= #{makeTimeStart} and make_time &lt; #{makeTimeEnd}
</if>
<if test="dayDate != null and dayDate != ''">
AND FROM_UNIXTIME(make_time, '%Y-%m-%d') = #{dayDate}
</if>
<if test="baojiasf != null and baojiasf != null">
and id in (select oid from user_demand_quotation b where b.workerid=#{baojiasf} and b.status=1)
</if>
<if test="baojiayh != null and baojiayh != null">
and id in ( select b.oid from user_demand_quotation b where b.status=1)
</if>
<if test="isComment != null and isComment != ''">
and is_comment =#{isComment}
</if>
<if test="orderId != null and orderId != ''"> <if test="orderId != null and orderId != ''">
and order_id like concat('%', #{orderId}, '%') and order_id like concat('%', #{orderId}, '%')
@ -212,14 +195,7 @@
<if test="uid != null"> <if test="uid != null">
and uid = #{uid} and uid = #{uid}
</if> </if>
<!-- 新增优先用ids in (...)否则用status= --> <if test="status != null">
<if test="ids != null and ids.size > 0">
and status in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="(ids == null or ids.size == 0) and status != null">
and status = #{status} and status = #{status}
</if> </if>
@ -232,15 +208,6 @@
<if test="cartid != null"> <if test="cartid != null">
and cartid = #{cartid} and cartid = #{cartid}
</if> </if>
<!-- 新增ispay逻辑存在users_pay_befor表status=1的lastorderid则排除 -->
<!-- <if test="ispay != null and ispay != ''">-->
<!-- AND (SELECT COUNT(1) FROM users_pay_befor upb WHERE upb.lastorderid = order_id AND upb.STATUS = 1)=0-->
<!-- -->
<!-- </if>-->
<if test="receiveTimeStart != null and receiveTimeEnd != null">
and receive_time BETWEEN #{receiveTimeStart} AND #{receiveTimeEnd}
</if>
</where> </where>
order by id desc order by id desc
@ -253,7 +220,7 @@
<select id="selectCountOrderByUid" resultType="Integer"> <select id="selectCountOrderByUid" resultType="Integer">
select count(1) from order_data where uid = #{uid} and status !=4 select count(1) from order_data where uid = #{uid} and status=#{status}
</select> </select>
<select id="selectAllCountOrderByUid" resultType="Integer"> <select id="selectAllCountOrderByUid" resultType="Integer">
@ -266,14 +233,6 @@
where order_id = #{orderId} where order_id = #{orderId}
</select> </select>
<select id="selectOrderCountByBigtype" resultType="Integer" parameterType="map">
select count(1)
from order_data
where bigtype = #{type}
and status != 4
and uid = #{uid}
</select>
<insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id"> <insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
insert into order_data insert into order_data
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -12,8 +12,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="price" column="price" /> <result property="price" column="price" />
<result property="unit" column="unit" /> <result property="unit" column="unit" />
<result property="image" column="image" /> <result property="image" column="image" />
<result property="manyimages" column="manyimages" />
<result property="content" column="content" />
<result property="iscommissions" column="iscommissions" /> <result property="iscommissions" column="iscommissions" />
<result property="commissions" column="commissions" /> <result property="commissions" column="commissions" />
<result property="profit" column="profit" /> <result property="profit" column="profit" />
@ -21,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updatedAt" column="updated_at" /> <result property="updatedAt" column="updated_at" />
</resultMap> </resultMap>
<sql id="selectQuoteMaterialVo"> <sql id="selectQuoteMaterialVo">
select id, good_id, type_id, title, price, unit,manyimages,content,profit,commissions,iscommissions,image, created_at, updated_at from quote_material select id, good_id, type_id, title, price, unit,profit,commissions,iscommissions,image, created_at, updated_at from quote_material
</sql> </sql>
<select id="selectQuoteMaterialList" parameterType="QuoteMaterial" resultMap="QuoteMaterialResult"> <select id="selectQuoteMaterialList" parameterType="QuoteMaterial" resultMap="QuoteMaterialResult">
<include refid="selectQuoteMaterialVo"/> <include refid="selectQuoteMaterialVo"/>
@ -60,8 +58,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">title,</if> <if test="title != null and title != ''">title,</if>
<if test="price != null">price,</if> <if test="price != null">price,</if>
<if test="unit != null and unit != ''">unit,</if> <if test="unit != null and unit != ''">unit,</if>
<if test="manyimages != null and manyimages != ''">manyimages,</if>
<if test="content != null and content != ''">content,</if>
<if test="image != null and image != ''">image,</if> <if test="image != null and image != ''">image,</if>
<if test="iscommissions != null and iscommissions != ''">iscommissions,</if> <if test="iscommissions != null and iscommissions != ''">iscommissions,</if>
<if test="commissions != null and commissions != ''">commissions,</if> <if test="commissions != null and commissions != ''">commissions,</if>
@ -75,8 +71,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">#{title},</if> <if test="title != null and title != ''">#{title},</if>
<if test="price != null">#{price},</if> <if test="price != null">#{price},</if>
<if test="unit != null and unit != ''">#{unit},</if> <if test="unit != null and unit != ''">#{unit},</if>
<if test="manyimages != null and manyimages != ''">#{manyimages},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="image != null and image != ''">#{image},</if> <if test="image != null and image != ''">#{image},</if>
<if test="iscommissions != null and iscommissions != ''">#{iscommissions},</if> <if test="iscommissions != null and iscommissions != ''">#{iscommissions},</if>
<if test="commissions != null and commissions != ''">#{commissions},</if> <if test="commissions != null and commissions != ''">#{commissions},</if>
@ -94,8 +88,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">title = #{title},</if> <if test="title != null and title != ''">title = #{title},</if>
<if test="price != null">price = #{price},</if> <if test="price != null">price = #{price},</if>
<if test="unit != null and unit != ''">unit = #{unit},</if> <if test="unit != null and unit != ''">unit = #{unit},</if>
<if test="manyimages != null and manyimages != ''">manyimages = #{manyimages},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="image != null and image != ''">image = #{image},</if> <if test="image != null and image != ''">image = #{image},</if>
<if test="iscommissions != null and iscommissions != ''">iscommissions = #{iscommissions},</if> <if test="iscommissions != null and iscommissions != ''">iscommissions = #{iscommissions},</if>
<if test="commissions != null and commissions != ''">commissions = #{commissions},</if> <if test="commissions != null and commissions != ''">commissions = #{commissions},</if>

View File

@ -11,9 +11,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="workerid" column="workerid" /> <result property="workerid" column="workerid" />
<result property="workername" column="workername" /> <result property="workername" column="workername" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="oid" column="oid" />
<result property="workerimage" column="workerimage" /> <result property="workerimage" column="workerimage" />
<result property="quotationTime" column="quotation_time" /> <result property="quotationTime" column="quotation_time" />
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at" />
@ -31,7 +28,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="workerid != null "> and workerid = #{workerid}</if> <if test="workerid != null "> and workerid = #{workerid}</if>
<if test="workername != null and workername != ''"> and workername like concat('%', #{workername}, '%')</if> <if test="workername != null and workername != ''"> and workername like concat('%', #{workername}, '%')</if>
<if test="status != null "> and status = #{status}</if> <if test="status != null "> and status = #{status}</if>
<if test="oid != null "> and oid = #{oid}</if>
<if test="workerimage != null and workerimage != ''"> and workerimage = #{workerimage}</if> <if test="workerimage != null and workerimage != ''"> and workerimage = #{workerimage}</if>
<if test="quotationTime != null "> and quotation_time = #{quotationTime}</if> <if test="quotationTime != null "> and quotation_time = #{quotationTime}</if>
</where> </where>
@ -53,8 +49,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="workerimage != null">workerimage,</if> <if test="workerimage != null">workerimage,</if>
<if test="quotationTime != null">quotation_time,</if> <if test="quotationTime != null">quotation_time,</if>
<if test="oid != null">oid,</if>
created_at, created_at,
updated_at updated_at
</trim> </trim>
@ -67,7 +61,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="workerimage != null">#{workerimage},</if> <if test="workerimage != null">#{workerimage},</if>
<if test="quotationTime != null">#{quotationTime},</if> <if test="quotationTime != null">#{quotationTime},</if>
<if test="oid != null">#{oid},</if>
NOW(), NOW(),
NOW() NOW()
</trim> </trim>
@ -83,7 +76,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="workerimage != null">workerimage = #{workerimage},</if> <if test="workerimage != null">workerimage = #{workerimage},</if>
<if test="quotationTime != null">quotation_time = #{quotationTime},</if> <if test="quotationTime != null">quotation_time = #{quotationTime},</if>
<if test="oid != null">oid = #{oid},</if>
updated_at = NOW(), updated_at = NOW(),
</trim> </trim>
where id = #{id} where id = #{id}

View File

@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserGroupBuyingByptorderid" parameterType="String" resultMap="UserGroupBuyingResult"> <select id="selectUserGroupBuyingByptorderid" parameterType="String" resultMap="UserGroupBuyingResult">
<include refid="selectUserGroupBuyingVo"/> <include refid="selectUserGroupBuyingVo"/>
where ptorderid = #{ptorderid} limit 1 where ptorderid = #{ptorderid}
</select> </select>
<insert id="insertUserGroupBuying" parameterType="UserGroupBuying"> <insert id="insertUserGroupBuying" parameterType="UserGroupBuying">

View File

@ -191,28 +191,6 @@
<if test="updatedAt != null"> <if test="updatedAt != null">
and updated_at = #{updatedAt} and updated_at = #{updatedAt}
</if> </if>
<if test="areaList != null and areaList.size > 0">
and (
<foreach collection="areaList" item="area" separator=" or ">
service_city_ids like concat('%"', #{area}, '"%')
</foreach>
)
</if>
<if test="skill != null and skill != ''">
and skill_ids like concat('%"', #{skill}, '"%')
</if>
<if test="workerTimeStr != null and workerTimeStr != ''">
and DATE_FORMAT(worker_time, '%Y-%m-%d') = #{workerTimeStr}
</if>
<if test="skillArr != null and skillArr.size > 0">
and (
<foreach collection="skillArr" item="sid" separator=" OR ">
JSON_CONTAINS(skill_ids, CONCAT('"', #{sid}, '"'), '$')
OR FIND_IN_SET(#{sid}, REPLACE(REPLACE(REPLACE(skill_ids, '[', ''), ']', ''), '"', ''))
OR skill_ids = #{sid}
</foreach>
)
</if>
</where> </where>
order by id desc order by id desc
</select> </select>

View File

@ -19,8 +19,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="mtmoney" column="mtmoney" /> <result property="mtmoney" column="mtmoney" />
<result property="allmoney" column="allmoney" /> <result property="allmoney" column="allmoney" />
<result property="servicetype" column="servicetype" /> <result property="servicetype" column="servicetype" />
<result property="baojiaid" column="baojiaid" />
<result property="lastorderid" column="lastorderid" />
<result property="sku" column="sku" /> <result property="sku" column="sku" />
<result property="addressid" column="addressid" /> <result property="addressid" column="addressid" />
@ -39,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectUsersPayBeforVo"> <sql id="selectUsersPayBeforVo">
select id, uid, paytype,grouporderid,baojiaid, lastorderid,wxmoney,serviceid,servicetype,sku,addressid,maketime,attachments, yemoney, allmoney,membermoney, shopmoney, servicemoney, couponid, couponmoney, mtcode, mtmoney, type, orderid, oid, status, paytime, paycode from users_pay_befor select id, uid, paytype,grouporderid, wxmoney,serviceid,servicetype,sku,addressid,maketime,attachments, yemoney, allmoney,membermoney, shopmoney, servicemoney, couponid, couponmoney, mtcode, mtmoney, type, orderid, oid, status, paytime, paycode from users_pay_befor
</sql> </sql>
<select id="selectUsersPayBeforList" parameterType="UsersPayBefor" resultMap="UsersPayBeforResult"> <select id="selectUsersPayBeforList" parameterType="UsersPayBefor" resultMap="UsersPayBeforResult">
@ -57,8 +55,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mtcode != null and mtcode != ''"> and mtcode = #{mtcode}</if> <if test="mtcode != null and mtcode != ''"> and mtcode = #{mtcode}</if>
<if test="mtmoney != null "> and mtmoney = #{mtmoney}</if> <if test="mtmoney != null "> and mtmoney = #{mtmoney}</if>
<if test="type != null "> and type = #{type}</if> <if test="type != null "> and type = #{type}</if>
<if test="lastorderid != null "> and lastorderid = #{lastorderid}</if>
<if test="orderid != null and orderid != ''"> and orderid = #{orderid}</if> <if test="orderid != null and orderid != ''"> and orderid = #{orderid}</if>
<if test="oid != null "> and oid = #{oid}</if> <if test="oid != null "> and oid = #{oid}</if>
<if test="status != null "> and status = #{status}</if> <if test="status != null "> and status = #{status}</if>
@ -81,10 +77,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where orderid = #{orderid} limit 1 where orderid = #{orderid} limit 1
</select> </select>
<select id="countByLastOrderIdAndStatus" parameterType="String" resultType="Integer">
select count(1) from users_pay_befor where lastorderid = #{orderid} and status = 1
</select>
<insert id="insertUsersPayBefor" parameterType="UsersPayBefor" useGeneratedKeys="true" keyProperty="id"> <insert id="insertUsersPayBefor" parameterType="UsersPayBefor" useGeneratedKeys="true" keyProperty="id">
insert into users_pay_befor insert into users_pay_befor
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -114,8 +106,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="grouporderid != null">grouporderid,</if> <if test="grouporderid != null">grouporderid,</if>
<if test="serviceid != null">serviceid,</if> <if test="serviceid != null">serviceid,</if>
<if test="servicetype != null">servicetype,</if> <if test="servicetype != null">servicetype,</if>
<if test="baojiaid != null">baojiaid,</if>
<if test="lastorderid != null">lastorderid,</if>
@ -147,8 +137,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="grouporderid != null">#{grouporderid},</if> <if test="grouporderid != null">#{grouporderid},</if>
<if test="serviceid != null">#{serviceid},</if> <if test="serviceid != null">#{serviceid},</if>
<if test="servicetype != null">#{servicetype},</if> <if test="servicetype != null">#{servicetype},</if>
<if test="baojiaid != null">#{baojiaid},</if>
<if test="lastorderid != null">#{lastorderid},</if>
</trim> </trim>
</insert> </insert>
@ -175,7 +163,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="paycode != null">paycode = #{paycode},</if> <if test="paycode != null">paycode = #{paycode},</if>
<if test="allmoney != null">allmoney = #{allmoney},</if> <if test="allmoney != null">allmoney = #{allmoney},</if>
<if test="serviceid != null">serviceid = #{serviceid},</if> <if test="serviceid != null">serviceid = #{serviceid},</if>
<if test="baojiaid != null">baojiaid = #{baojiaid},</if>
<if test="sku != null">sku = #{sku},</if> <if test="sku != null">sku = #{sku},</if>
<if test="addressid != null">addressid = #{addressid},</if> <if test="addressid != null">addressid = #{addressid},</if>
@ -183,7 +170,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attachments != null">attachments = #{attachments},</if> <if test="attachments != null">attachments = #{attachments},</if>
<if test="grouporderid != null">grouporderid = #{grouporderid},</if> <if test="grouporderid != null">grouporderid = #{grouporderid},</if>
<if test="servicetype != null">servicetype = #{servicetype},</if> <if test="servicetype != null">servicetype = #{servicetype},</if>
<if test="lastorderid != null">lastorderid = #{lastorderid},</if>
</trim> </trim>
where id = #{id} where id = #{id}

View File

@ -64,7 +64,7 @@ export default {
// //
limit: { limit: {
type: Number, type: Number,
default: 9 default: 5
}, },
// (MB) // (MB)
fileSize: { fileSize: {

View File

@ -525,7 +525,6 @@ export default {
} }
// skuType // skuType
this.skuType = 1; this.skuType = 1;
this.form.skuType = 1;
// //
this.activeTab = 'base'; this.activeTab = 'base';
this.resetForm("form"); this.resetForm("form");
@ -572,8 +571,6 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset() this.reset()
this.skuType = 1; //
this.form.skuType = 1;
this.open = true this.open = true
this.title = "添加服务内容" this.title = "添加服务内容"
}, },
@ -583,20 +580,6 @@ export default {
const id = row.id || this.ids const id = row.id || this.ids
getServiceGoods(id).then(response => { getServiceGoods(id).then(response => {
this.form = response.data this.form = response.data
// icon
if (Array.isArray(this.form.icon)) {
this.form.icon = this.form.icon.length > 0 ? this.form.icon[0] : '';
}
// imgs
if (typeof this.form.imgs === 'string' && this.form.imgs) {
if (this.form.imgs.includes(',')) {
this.form.imgs = this.form.imgs.split(',').filter(Boolean);
} else {
this.form.imgs = [this.form.imgs];
}
} else if (!Array.isArray(this.form.imgs)) {
this.form.imgs = [];
}
// //
if (this.form.questions) { if (this.form.questions) {
@ -646,14 +629,6 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
// icon
if (Array.isArray(this.form.icon)) {
this.form.icon = this.form.icon.length > 0 ? this.form.icon[0] : '';
}
// imgs
if (Array.isArray(this.form.imgs)) {
this.form.imgs = this.form.imgs.filter(Boolean).join(',');
}
// //
if (this.form.questionsArray && Array.isArray(this.form.questionsArray)) { if (this.form.questionsArray && Array.isArray(this.form.questionsArray)) {
const validQuestions = this.form.questionsArray.filter(qa => const validQuestions = this.form.questionsArray.filter(qa =>
@ -667,6 +642,9 @@ export default {
this.form.questions = null; this.form.questions = null;
} }
//
this.form.skuType = this.skuType;
// //
if (this.skuType === 2) { if (this.skuType === 2) {
// //
@ -682,9 +660,16 @@ export default {
return; return;
} }
} else { } else {
// {"type":"single"} //
this.form.sku = JSON.stringify({ type: "single" }); if (!this.form.skuName || !this.form.skuValue) {
this.form.skuType = 1; this.$modal.msgError("请完善单规格信息");
return;
}
const singleSku = {
name: this.form.skuName,
value: this.form.skuValue
};
this.form.sku = JSON.stringify(singleSku);
} }
// sku // sku
@ -750,65 +735,234 @@ export default {
handleExport() { handleExport() {
this.download('system/ServiceGoods/export', { this.download('system/ServiceGoods/export', {
...this.queryParams ...this.queryParams
}); }, `ServiceGoods_${new Date().getTime()}.xlsx`)
}, },
// playAudio(url) {
addQuestion() { this.currentAudioUrl = url
this.form.questionsArray.push({ this.audioDialogVisible = true
question: '',
answer: ''
});
}, },
//
removeQuestion(index) {
this.form.questionsArray.splice(index, 1);
},
//
handleQuestionChange() {
//
this.$nextTick(() => {
this.$refs.form.validateField('questionsArray');
});
},
//
openEditDialog(row, field, label) { openEditDialog(row, field, label) {
// this.editRow = row;
this.editRow = JSON.parse(JSON.stringify(row));
this.editField = field; this.editField = field;
this.editFieldLabel = label; this.editFieldLabel = label;
this.editFieldValue = row[field]; this.editFieldValue = row[field];
this.editDialogVisible = true; this.editDialogVisible = true;
}, },
// async saveEditField() {
saveEditField() { if (!this.editRow) return;
//
this.editRow[this.editField] = this.editFieldValue; //
// let value = this.editFieldValue;
updateServiceGoods(this.editRow).then(response => { if (['price', 'margin'].includes(this.editField)) {
this.$modal.msgSuccess("保存成功"); //
this.editDialogVisible = false; const numValue = parseFloat(value);
this.getList(); // if (isNaN(numValue) || numValue < 0) {
}).catch(error => { this.$message.error('请输入有效的价格');
this.$modal.msgError("保存失败,请稍后重试"); return;
});
},
//
cancelEdit() {
this.editDialogVisible = false;
},
//
getForServiceList(callback) {
getselectTypeList(1).then(response => {
this.forServiceList = response.data;
if (callback) {
callback();
} }
value = numValue;
} else if (['sales', 'stock', 'sort'].includes(this.editField)) {
//
const numValue = parseInt(value);
if (isNaN(numValue) || numValue < 0) {
this.$message.error('请输入有效的数字');
return;
}
value = numValue;
}
const payload = {
id: this.editRow.id,
[this.editField]: value
};
try {
await updateServiceGoods(payload);
this.$message.success('修改成功');
//
this.editRow[this.editField] = value;
this.getList();
//
this.editDialogVisible = false;
} catch (error) {
console.error('快捷编辑失败:', error);
this.$message.error('修改失败,请稍后重试');
}
},
addSpec() {
this.specList.push({ name: '', values: [''] });
this.updateSkuTable();
},
removeSpec(idx) {
this.specList.splice(idx, 1);
this.updateSkuTable();
},
addSpecValue(specIdx) {
this.specList[specIdx].values.push('');
this.updateSkuTable();
},
removeSpecValue(specIdx, valIdx) {
this.specList[specIdx].values.splice(valIdx, 1);
this.updateSkuTable();
},
updateSkuTable() {
if (this.specList.length === 0) {
this.skuTable = [];
return;
}
const valueArr = this.specList.map(spec => spec.values.filter(v => v));
if (valueArr.some(arr => arr.length === 0)) {
this.skuTable = [];
return;
}
const cartesian = (arr) => arr.reduce((a, b) => a.flatMap(d => b.map(e => [].concat(d, e))));
const combos = cartesian(valueArr);
this.skuTable = combos.map(combo => {
const row = {};
this.specList.forEach((spec, i) => row[spec.name] = combo[i]);
return Object.assign(row, { imageUrl: '', price: 0, stock: 0 });
}); });
}, },
handleImageSuccess(idx, file) {
// url
this.$set(this.skuTable[idx], 'imageUrl', URL.createObjectURL(file.raw));
},
removeSkuImage(idx) {
this.$set(this.skuTable[idx], 'imageUrl', '');
},
//
addQuestion() {
if (!this.form.questionsArray) {
this.$set(this.form, 'questionsArray', []);
}
this.form.questionsArray.push({
question: '',
answer: ''
});
},
//
removeQuestion(index) {
this.form.questionsArray.splice(index, 1);
//
this.handleQuestionChange();
},
//
async silentSave() {
try {
//
if (!this.form.questionsArray || !Array.isArray(this.form.questionsArray)) {
return;
}
//
if (!this.form.id) {
return;
}
//
const validQuestions = this.form.questionsArray.filter(qa =>
qa && qa.question && qa.question.trim() && qa.answer && qa.answer.trim()
).map(qa => ({
question: qa.question.trim(),
answer: qa.answer.trim()
}));
//
const submitData = {
id: this.form.id,
questions: JSON.stringify(validQuestions)
};
//
await updateServiceGoods(submitData);
} catch (error) {
console.error('问答数据静默保存失败:', error);
}
},
//
handleQuestionChange() {
// 使
if (this.saveTimeout) {
clearTimeout(this.saveTimeout);
}
this.saveTimeout = setTimeout(() => {
this.silentSave();
}, 1000); // 1
},
getForServiceList (cb) {
getselectTypeList(1).then(res => {
this.forServiceList = res.data || [];
if (typeof cb === 'function') cb();
})
},
// getForServiceList() {
// // type=1
// listServiceGoods({ type: 1, status: 1 }).then(res => {
// this.forServiceList = res.rows || [];
// });
// },
} }
} }
</script> </script>
<style scoped> <style scoped>
/* 你的样式代码 */ /* 问答样式 */
.qa-container {
padding: 5px;
}
.qa-header {
margin-bottom: 15px;
}
.qa-item {
margin-bottom: 10px;
padding: 10px;
border: 1px solid #EBEEF5;
border-radius: 4px;
background-color: #fafafa;
}
.qa-item:hover {
box-shadow: 0 2px 8px 0 rgba(0,0,0,.05);
}
.qa-item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.qa-index {
font-size: 14px;
font-weight: bold;
color: #606266;
}
.qa-item :deep(.el-form-item) {
margin-bottom: 10px;
}
.qa-item :deep(.el-form-item__label) {
padding: 0 5px 0 0;
line-height: 32px;
}
.qa-item :deep(.el-form-item__content) {
line-height: 32px;
}
.qa-item :deep(.el-textarea__inner) {
padding: 5px 8px;
}
.qa-item :deep(.el-divider--horizontal) {
margin: 10px 0;
}
</style> </style>

View File

@ -124,16 +124,6 @@
<image-preview :src="scope.row.image" :width="50" :height="50"/> <image-preview :src="scope.row.image" :width="50" :height="50"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="轮播图" align="center" prop="manyimages" width="120">
<template slot-scope="scope">
<image-preview v-for="img in (scope.row.manyimages ? scope.row.manyimages.split(',') : [])" :key="img" :src="img" :width="40" :height="40" style="margin-right:2px;" />
</template>
</el-table-column>
<el-table-column label="简介" align="center" prop="content" width="200">
<template slot-scope="scope">
<div v-html="scope.row.content"></div>
</template>
</el-table-column>
<el-table-column label="是否有分佣" align="center" prop="iscommissions"> <el-table-column label="是否有分佣" align="center" prop="iscommissions">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.iscommissions" :value="scope.row.iscommissions"/> <dict-tag :options="dict.type.iscommissions" :value="scope.row.iscommissions"/>
@ -171,8 +161,7 @@
/> />
<!-- 添加或修改项目报价--物料信息对话框 --> <!-- 添加或修改项目报价--物料信息对话框 -->
<el-drawer :title="title" :visible.sync="open" size="600px" direction="rtl" :with-header="true" append-to-body> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<div style="padding: 0 20px;">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="服务项目" prop="goodsintids"> <el-form-item label="服务项目" prop="goodsintids">
<el-select v-model="form.goodsintids" multiple filterable placeholder="请选择服务项目" style="width: 100%"> <el-select v-model="form.goodsintids" multiple filterable placeholder="请选择服务项目" style="width: 100%">
@ -209,12 +198,6 @@
<el-form-item label="附件图片" prop="image"> <el-form-item label="附件图片" prop="image">
<image-upload v-model="form.image"/> <image-upload v-model="form.image"/>
</el-form-item> </el-form-item>
<el-form-item label="轮播图" prop="manyimages">
<image-upload v-model="form.manyimages" multiple />
</el-form-item>
<el-form-item label="简介" prop="content">
<editor v-model="form.content" :height="200" />
</el-form-item>
<el-form-item label="是否有分佣" prop="iscommissions"> <el-form-item label="是否有分佣" prop="iscommissions">
<el-radio-group v-model="form.iscommissions" > <el-radio-group v-model="form.iscommissions" >
<el-radio <el-radio
@ -233,13 +216,13 @@
<el-input-number v-model="form.profit" placeholder="请输入净利润" /> <el-input-number v-model="form.profit" placeholder="请输入净利润" />
</el-form-item> </el-form-item>
</template> </template>
</el-form> </el-form>
<div class="dialog-footer" style="text-align:left;margin-top:20px;"> <div class="dialog-footer" style="text-align:left;margin-top:20px;">
<el-button @click="reset">重置</el-button> <el-button @click="reset">重置</el-button>
<el-button type="primary" @click="submitForm">提交</el-button> <el-button type="primary" @click="submitForm">提交</el-button>
</div> </div>
</div> </el-dialog>
</el-drawer>
</div> </div>
</template> </template>
@ -303,8 +286,6 @@ export default {
iscommissions: null, iscommissions: null,
commissions: null, commissions: null,
profit: null, profit: null,
manyimages: [],
content: '',
createdAt: null, createdAt: null,
updatedAt: null updatedAt: null
}, },
@ -363,8 +344,6 @@ export default {
iscommissions: null, iscommissions: null,
commissions: null, commissions: null,
profit: null, profit: null,
manyimages: [],
content: '',
createdAt: null, createdAt: null,
updatedAt: null updatedAt: null
} }
@ -439,9 +418,7 @@ export default {
this.form = { this.form = {
...response.data, ...response.data,
goodsintids: response.data.goodsintids || [], goodsintids: response.data.goodsintids || [],
typeintids: response.data.typeintids || [], typeintids: response.data.typeintids || []
manyimages: Array.isArray(response.data.manyimages) ? response.data.manyimages : (typeof response.data.manyimages === 'string' && response.data.manyimages ? response.data.manyimages.split(',') : []),
content: response.data.content || ''
} }
// material_commissions // material_commissions
if (this.form.commissions === null || this.form.commissions === undefined || this.form.commissions === '') { if (this.form.commissions === null || this.form.commissions === undefined || this.form.commissions === '') {
@ -459,10 +436,6 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
// JSON
if (Array.isArray(this.form.manyimages)) {
this.form.manyimages = JSON.stringify(this.form.manyimages.filter(Boolean));
}
if (this.form.id != null) { if (this.form.id != null) {
updateQuoteMaterial(this.form).then(response => { updateQuoteMaterial(this.form).then(response => {
this.$modal.msgSuccess("修改成功") this.$modal.msgSuccess("修改成功")

View File

@ -522,7 +522,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="指定工人集合" prop="workerids" v-if="form.dispatchtype === 3"> <el-form-item label="指定工人集合" prop="workerids" v-if="form.dispatchtype === 3">
<el-select v-model="form.workerids" filterable placeholder="请选择工人" style="width: 100%"> <el-select v-model="form.workerids" multiple filterable placeholder="请选择工人" style="width: 100%">
<el-option <el-option
v-for="worker in listworkerlist" v-for="worker in listworkerlist"
:key="worker.id" :key="worker.id"
@ -920,7 +920,7 @@ export default {
status: "1", status: "1",
description: null, description: null,
skuType: 1, skuType: 1,
sku: JSON.stringify({ type: "single" }), sku: "{}",
skuName: '', skuName: '',
skuValue: '', skuValue: '',
latitude: null, latitude: null,
@ -1023,25 +1023,32 @@ export default {
handleAdd() { handleAdd() {
this.reset() this.reset()
this.getlistworkerdatalist(); this.getlistworkerdatalist();
//
this.$set(this.form, 'skillIdsArray', []); this.$set(this.form, 'skillIdsArray', []);
this.$set(this.form, 'basicArray', []); this.$set(this.form, 'basicArray', []);
//
this.basicOptions = []; this.basicOptions = [];
//
this.showBasicInput = false; this.showBasicInput = false;
this.newBasicTag = ''; this.newBasicTag = '';
// workerids null // workerids
this.form.workerids = null; this.form.workerids = [];
//
this.$set(this.form, 'questionsArray', []); this.$set(this.form, 'questionsArray', []);
// ID
this.$set(this.form, 'firstCateId', null); this.$set(this.form, 'firstCateId', null);
this.$set(this.form, 'secondCateId', null); this.$set(this.form, 'secondCateId', null);
console.log('新增时初始化form:', this.form);
//
if (this.siteSkillList.length === 0) { if (this.siteSkillList.length === 0) {
console.warn('技能列表未加载,重新获取...');
this.getSiteSkillList(); this.getSiteSkillList();
} }
this.open = true this.open = true
this.title = "添加服务内容" this.title = "添加服务内容"
this.handleServiceTypeChange(this.form.servicetype); this.handleServiceTypeChange(this.form.servicetype);
this.form.skuType = 1;
this.skuType = 1;
this.form.sku = JSON.stringify({ type: "single" });
}, },
getSiteSkillList(){ getSiteSkillList(){
@ -1087,9 +1094,11 @@ export default {
this.reset() this.reset()
const id = row.id || this.ids const id = row.id || this.ids
this.getlistworkerdatalist(); this.getlistworkerdatalist();
//
const skillPromise = this.siteSkillList.length > 0 ? const skillPromise = this.siteSkillList.length > 0 ?
Promise.resolve(this.siteSkillList) : Promise.resolve(this.siteSkillList) :
this.getSiteSkillList(); this.getSiteSkillList();
Promise.all([ Promise.all([
getServiceGoods(id), getServiceGoods(id),
skillPromise skillPromise
@ -1269,39 +1278,21 @@ export default {
} }
}); });
// workerids // workerids
if (this.form.workerids && typeof this.form.workerids === 'string') { if (this.form.workerids && typeof this.form.workerids === 'string') {
// try {
if (!isNaN(this.form.workerids)) { const arr = JSON.parse(this.form.workerids);
this.form.workerids = Number(this.form.workerids); this.form.workerids = Array.isArray(arr) ? arr.map(id => Number(id)).filter(id => !isNaN(id)) : [];
} else { } catch (e) {
this.form.workerids = null; this.form.workerids = [];
} }
} else if (Array.isArray(this.form.workerids) && this.form.workerids.length > 0) {
//
this.form.workerids = Number(this.form.workerids[0]);
} else if (!this.form.workerids) { } else if (!this.form.workerids) {
this.form.workerids = null; this.form.workerids = [];
} }
this.open = true this.open = true
this.title = "修改服务内容" this.title = "修改服务内容"
this.handleServiceTypeChange(this.form.servicetype); this.handleServiceTypeChange(this.form.servicetype);
// icon
if (Array.isArray(this.form.icon)) {
this.form.icon = this.form.icon.length > 0 ? this.form.icon[0] : '';
}
// imgs
if (typeof this.form.imgs === 'string' && this.form.imgs) {
if (this.form.imgs.includes(',')) {
this.form.imgs = this.form.imgs.split(',').filter(Boolean);
} else {
this.form.imgs = [this.form.imgs];
}
} else if (!Array.isArray(this.form.imgs)) {
this.form.imgs = [];
}
}).catch(error => { }).catch(error => {
console.error('编辑数据加载失败:', error); console.error('编辑数据加载失败:', error);
this.$message.error('编辑数据加载失败,请重试'); this.$message.error('编辑数据加载失败,请重试');
@ -1391,22 +1382,12 @@ export default {
this.form.sort = parseInt(this.form.sort); this.form.sort = parseInt(this.form.sort);
} }
// icon
if (Array.isArray(this.form.icon)) {
this.form.icon = this.form.icon.length > 0 ? this.form.icon[0] : '';
}
// imgs
if (Array.isArray(this.form.imgs)) {
this.form.imgs = this.form.imgs.filter(Boolean).join(',');
}
// this.form // this.form
const submitData = { ...this.form }; const submitData = { ...this.form };
// workerids // workerids
if (this.form.workerids !== null && this.form.workerids !== undefined) { if (Array.isArray(submitData.workerids)) {
submitData.workerids = JSON.stringify([Number(this.form.workerids)]); const arr = submitData.workerids.map(id => Number(id)).filter(id => !isNaN(id));
} else { submitData.workerids = JSON.stringify(arr);
submitData.workerids = null;
} }
// ID // ID

View File

@ -560,17 +560,6 @@
<el-button type="success" @click="saveSiteLinks" style="margin-left: 12px;">保存</el-button> <el-button type="success" @click="saveSiteLinks" style="margin-left: 12px;">保存</el-button>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="上门标准" name="serviceStandard">
<el-form :model="serviceStandardForm" label-width="120px" class="tab-form">
<el-form-item label="上门标准说明">
<Editor v-model="serviceStandardForm.serviceStandard" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveAllConfig('serviceStandard')">提交</el-button>
<el-button @click="resetServiceStandard">重置</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs> </el-tabs>
<el-button type="primary" style="margin-top: 24px;" @click="saveAllConfig">保存全部配置</el-button> <el-button type="primary" style="margin-top: 24px;" @click="saveAllConfig">保存全部配置</el-button>
</div> </div>
@ -671,10 +660,6 @@ export default {
config_eight: {}, config_eight: {},
config_nine: {}, // config_nine: {}, //
siteLinks: [], // siteLinks: [], //
config_ten: {}, //
serviceStandardForm: {
serviceStandard: ''
},
} }
}, },
@ -827,21 +812,6 @@ export default {
this.siteLinks = []; this.siteLinks = [];
} }
// config_ten
this.config_ten = response.rows.find(item => item.name === 'config_ten')
if (this.config_ten && this.config_ten.value) {
try {
const configTenObj = JSON.parse(this.config_ten.value)
this.serviceStandardForm = {
serviceStandard: configTenObj.serviceStandard || ''
}
} catch (e) {
this.serviceStandardForm = { serviceStandard: '' }
}
} else {
this.serviceStandardForm = { serviceStandard: '' }
}
this.total = response.total this.total = response.total
this.loading = false this.loading = false
}) })
@ -921,9 +891,6 @@ export default {
goods: ['商品质量好', '包装完整', '物流快速', '性价比高', '描述相符'] goods: ['商品质量好', '包装完整', '物流快速', '性价比高', '描述相符']
} }
}, },
resetServiceStandard() {
this.serviceStandardForm = { serviceStandard: '' }
},
async saveAllConfig(e) { async saveAllConfig(e) {
// 1. config_one // 1. config_one
const config_one = { const config_one = {
@ -1052,29 +1019,9 @@ export default {
} catch (error) { } catch (error) {
this.$message.error('保存失败,请重试'); this.$message.error('保存失败,请重试');
} }
}else if(e=='serviceStandard'){
const config_ten = {
serviceStandard: this.serviceStandardForm.serviceStandard
};
try {
if (!this.config_ten || !this.config_ten.id) {
await addSiteConfig({ name: 'config_ten', value: JSON.stringify(config_ten), status: 1 });
} else {
await updateSiteConfig({ name: 'config_ten', id: this.config_ten.id, value: JSON.stringify(config_ten) });
} }
this.$message.success('上门标准已保存!');
await this.getList();
} catch (error) {
this.$message.error('保存失败,请重试');
}
return; //
}
//
if (!e) {
this.$message.success('保存成功!'); this.$message.success('保存成功!');
await this.getList(); await this.getList();
}
} catch (error) { } catch (error) {
console.error('保存失败:', error); console.error('保存失败:', error);
console.error('错误详情:', error.response || error.message || error); console.error('错误详情:', error.response || error.message || error);