202507241748
This commit is contained in:
parent
02a4d1438b
commit
8c064d6657
|
|
@ -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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("");
|
||||||
}
|
}
|
||||||
UsersInvoiceInfo invoiceInfo = usersInvoiceInfoService.selectUsersInvoiceInfoById(id);
|
UsersInvoiceInfo invoiceInfo = usersInvoiceInfoService.selectUsersInvoiceInfoById(id);
|
||||||
if (invoiceInfo == null) {
|
if (invoiceInfo == null) {
|
||||||
|
|
|
||||||
|
|
@ -573,13 +573,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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 参数验证
|
// 3. 参数验证
|
||||||
|
|
@ -592,6 +592,7 @@ public class AppleMemberController extends BaseController {
|
||||||
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.selectOrderById(Long.valueOf(orderId));
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
|
|
@ -624,7 +625,7 @@ public class AppleMemberController extends BaseController {
|
||||||
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();
|
//JSONArray jsonArrayimg=new JSONArray();
|
||||||
// 8. 处理图片附件
|
// 8. 处理图片附件
|
||||||
if (params.containsKey("images") && params.get("images") != null) {
|
if (params.containsKey("images") && params.get("images") != null) {
|
||||||
|
|
@ -644,7 +645,6 @@ public class AppleMemberController extends BaseController {
|
||||||
// 10. 保存评价并更新订单状态
|
// 10. 保存评价并更新订单状态
|
||||||
// 保存评价
|
// 保存评价
|
||||||
orderCommentService.insertOrderComment(comment);
|
orderCommentService.insertOrderComment(comment);
|
||||||
if (type.equals("service")){
|
|
||||||
// 添加订单日志
|
// 添加订单日志
|
||||||
OrderLog orderLog = new OrderLog();
|
OrderLog orderLog = new OrderLog();
|
||||||
orderLog.setOid(order.getId());
|
orderLog.setOid(order.getId());
|
||||||
|
|
@ -666,10 +666,63 @@ public class AppleMemberController extends BaseController {
|
||||||
order.setIsComment(1); // 1=已评价
|
order.setIsComment(1); // 1=已评价
|
||||||
orderService.updateOrder(order);
|
orderService.updateOrder(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.equals("goods")){{
|
if (type.equals("goods")){{
|
||||||
GoodsOrder goodsOrder = goodsOrderService.selectGoodsOrderByorderId(orderId);
|
|
||||||
if (goodsOrder != null){
|
|
||||||
// goodsOrder.setis
|
|
||||||
|
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("操作失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -700,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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 验证图像和昵称是否为系统默认
|
// 3. 验证图像和昵称是否为系统默认
|
||||||
|
|
@ -774,13 +827,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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 验证必要参数
|
// 3. 验证必要参数
|
||||||
|
|
@ -880,13 +933,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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 设置分页参数
|
// 4. 设置分页参数
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ import com.ruoyi.system.service.IShopAddressService;
|
||||||
import com.ruoyi.system.domain.ShopAddress;
|
import com.ruoyi.system.domain.ShopAddress;
|
||||||
import com.ruoyi.system.domain.GoodsCart;
|
import com.ruoyi.system.domain.GoodsCart;
|
||||||
import com.ruoyi.system.service.IGoodsCartService;
|
import com.ruoyi.system.service.IGoodsCartService;
|
||||||
|
import com.ruoyi.system.domain.OrderTypeCount;
|
||||||
|
import com.ruoyi.system.service.IQuoteMaterialTypeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 苹果订单控制器
|
* 苹果订单控制器
|
||||||
|
|
@ -109,6 +111,9 @@ public class AppleOrderController extends BaseController {
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// private IUserGroupBuyingService userGroupBuyingService;
|
// private IUserGroupBuyingService userGroupBuyingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IQuoteMaterialTypeService quoteMaterialTypeService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -124,13 +129,13 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 获取用户信息
|
// 4. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
UsersPayBefor usersPayBefor = usersPayBeforService.selectUsersPayBeforByOrderId(id);
|
UsersPayBefor usersPayBefor = usersPayBeforService.selectUsersPayBeforByOrderId(id);
|
||||||
|
|
@ -216,12 +221,12 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 验证必填参数
|
// 2. 验证必填参数
|
||||||
|
|
@ -419,6 +424,12 @@ public class AppleOrderController extends BaseController {
|
||||||
// result.put("totalAmount", totalAmount);
|
// result.put("totalAmount", totalAmount);
|
||||||
// result.put("orderType", ordertype);
|
// result.put("orderType", ordertype);
|
||||||
// result.put("attachments", attachments);
|
// result.put("attachments", attachments);
|
||||||
|
Order order = orderService.selectOrderByOrderId(orderId);
|
||||||
|
Users worker = usersService.selectUsersById(2L);
|
||||||
|
if (order != null&&worker!=null){
|
||||||
|
AppletControllerUtil.creatWorkerForOrder(order,worker);
|
||||||
|
}
|
||||||
|
|
||||||
return AppletControllerUtil.appletSuccess(result);
|
return AppletControllerUtil.appletSuccess(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -863,11 +874,11 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 查询次卡基本信息
|
// 3. 查询次卡基本信息
|
||||||
UserSecondaryCard card = userSecondaryCardService.selectUserSecondaryCardById(cardId);
|
UserSecondaryCard card = userSecondaryCardService.selectUserSecondaryCardById(cardId);
|
||||||
|
|
@ -986,11 +997,11 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 查询用户全部次卡
|
// 查询用户全部次卡
|
||||||
UserUseSecondaryCard queryCard = new UserUseSecondaryCard();
|
UserUseSecondaryCard queryCard = new UserUseSecondaryCard();
|
||||||
|
|
@ -1054,11 +1065,11 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 1. 查次卡使用记录
|
// 1. 查次卡使用记录
|
||||||
UserUseSecondaryCard card = userUseSecondaryCardService.selectUserUseSecondaryCardById(cardid);
|
UserUseSecondaryCard card = userUseSecondaryCardService.selectUserUseSecondaryCardById(cardid);
|
||||||
|
|
@ -1826,12 +1837,12 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
String maincorid=GenerateCustomCode.generCreateOrder("MC");
|
String maincorid=GenerateCustomCode.generCreateOrder("MC");
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
if (params == null || params.get("carid") == null || params.get("address_id") == null) {
|
if (params == null || params.get("carid") == null || params.get("address_id") == null) {
|
||||||
return AppletControllerUtil.appletWarning("carid和address_id不能为空");
|
return AppletControllerUtil.appletWarning("carid和address_id不能为空");
|
||||||
|
|
@ -1928,17 +1939,18 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 构建查询条件
|
// 2. 构建查询条件
|
||||||
Order queryOrder = new Order();
|
Order queryOrder = new Order();
|
||||||
queryOrder.setUid(user.getId());
|
queryOrder.setUid(user.getId());
|
||||||
|
//queryOrder.setWorkerId(user.getId());
|
||||||
|
|
||||||
// 根据bigtype筛选订单类型
|
// 根据bigtype筛选订单类型
|
||||||
if (bigtype != null) {
|
if (bigtype != null) {
|
||||||
|
|
@ -1972,6 +1984,7 @@ public class AppleOrderController extends BaseController {
|
||||||
}else if (status == 13){
|
}else if (status == 13){
|
||||||
queryOrder.setStatus(6L);
|
queryOrder.setStatus(6L);
|
||||||
queryOrder.setIsComment(0);
|
queryOrder.setIsComment(0);
|
||||||
|
queryOrder.setIspay("1");
|
||||||
}else {
|
}else {
|
||||||
queryOrder.setStatus(Long.valueOf(status));
|
queryOrder.setStatus(Long.valueOf(status));
|
||||||
}
|
}
|
||||||
|
|
@ -2254,12 +2267,12 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 验证订单是否存在且属于当前用户
|
// 2. 验证订单是否存在且属于当前用户
|
||||||
|
|
@ -2320,12 +2333,12 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 验证请求参数
|
// 2. 验证请求参数
|
||||||
|
|
@ -2467,11 +2480,11 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
List<Order> orderList = new ArrayList<>();
|
List<Order> orderList = new ArrayList<>();
|
||||||
Order queryOrder = new Order();
|
Order queryOrder = new Order();
|
||||||
|
|
@ -2890,12 +2903,12 @@ public class AppleOrderController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 查询订单信息,验证订单是否存在
|
// 2. 查询订单信息,验证订单是否存在
|
||||||
|
|
@ -3835,27 +3848,58 @@ public class AppleOrderController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 统计bigtype为1、2、3且status!=4的订单数量(针对当前用户)
|
||||||
|
// * @return 统计结果
|
||||||
|
// */
|
||||||
|
// @GetMapping("/api/order/bigtype/count")
|
||||||
|
// public AjaxResult getOrderCountByBigtype(HttpServletRequest request) {
|
||||||
|
// try {
|
||||||
|
// String token = request.getHeader("token");
|
||||||
|
// Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
|
||||||
|
// if (!(Boolean) userValidation.get("valid")) {
|
||||||
|
// return AppletControllerUtil.appletUnauthorized();
|
||||||
|
// }
|
||||||
|
// Users user = (Users) userValidation.get("user");
|
||||||
|
// if (user == null) {
|
||||||
|
// return AppletControllerUtil.appletWarning("用户信息获取失败");
|
||||||
|
// }
|
||||||
|
// List<OrderTypeCount> counts = orderService.selectOrderCountByBigtype(user.getId());
|
||||||
|
// return AjaxResult.success(counts);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// logger.error("统计订单数量失败:", e);
|
||||||
|
// return AjaxResult.error("统计订单数量失败:" + e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计bigtype为1、2、3且status!=4的订单数量(针对当前用户)
|
* 查看物料详情接口
|
||||||
* @return 统计结果
|
* @param id 物料id
|
||||||
|
* @return 物料详情
|
||||||
*/
|
*/
|
||||||
@GetMapping("/api/order/bigtype/count")
|
@GetMapping("/api/material/detail")
|
||||||
public AjaxResult getOrderCountByBigtype(HttpServletRequest request) {
|
public AjaxResult getMaterialDetail(@RequestParam("id") Long id) {
|
||||||
try {
|
try {
|
||||||
String token = request.getHeader("token");
|
QuoteMaterialType material = quoteMaterialTypeService.selectQuoteMaterialTypeById(id);
|
||||||
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
|
if (material == null) {
|
||||||
if (!(Boolean) userValidation.get("valid")) {
|
return AjaxResult.error("物料不存在");
|
||||||
return AppletControllerUtil.appletUnauthorized();
|
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
// 构建返回数据(可根据实际字段调整)
|
||||||
if (user == null) {
|
Map<String, Object> result = new HashMap<>();
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
result.put("id", material.getId());
|
||||||
}
|
result.put("name", material.getName());
|
||||||
List<Order.OrderTypeCount> counts = orderService.selectOrderCountByBigtype(user.getId());
|
result.put("type", material.getType());
|
||||||
return AjaxResult.success(counts);
|
result.put("price", material.getPrice());
|
||||||
|
result.put("unit", material.getUnit());
|
||||||
|
result.put("desc", material.getDesc());
|
||||||
|
result.put("status", material.getStatus());
|
||||||
|
result.put("createdAt", material.getCreatedAt());
|
||||||
|
result.put("updatedAt", material.getUpdatedAt());
|
||||||
|
// 可根据需要添加更多字段
|
||||||
|
return AjaxResult.success(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("统计订单数量失败:", e);
|
logger.error("查询物料详情失败:", e);
|
||||||
return AjaxResult.error("统计订单数量失败:" + e.getMessage());
|
return AjaxResult.error("查询物料详情失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("退款参数不完整");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 验证必要参数
|
// 2. 验证必要参数
|
||||||
if (params == null || params.get("orderNo") == null) {
|
if (params == null || params.get("orderNo") == null) {
|
||||||
return AppletControllerUtil.appletWarning("订单号不能为空");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 验证必要参数
|
// 3. 验证必要参数
|
||||||
|
|
|
||||||
|
|
@ -282,12 +282,12 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 4. 设置分页参数
|
// 4. 设置分页参数
|
||||||
PageHelper.startPage(page, limit);
|
PageHelper.startPage(page, limit);
|
||||||
|
|
@ -329,12 +329,12 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 4. 查询地址信息
|
// 4. 查询地址信息
|
||||||
UserAddress userAddress = userAddressService.selectUserAddressById(id);
|
UserAddress userAddress = userAddressService.selectUserAddressById(id);
|
||||||
|
|
@ -385,12 +385,12 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 4. 查询原地址信息并验证归属权
|
// 4. 查询原地址信息并验证归属权
|
||||||
UserAddress existingAddress = userAddressService.selectUserAddressById(addressId);
|
UserAddress existingAddress = userAddressService.selectUserAddressById(addressId);
|
||||||
|
|
@ -443,12 +443,12 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 构建新增的地址对象
|
// 3. 构建新增的地址对象
|
||||||
UserAddress newAddress = AppletControllerUtil.buildNewAddress(params, user.getId());
|
UserAddress newAddress = AppletControllerUtil.buildNewAddress(params, user.getId());
|
||||||
|
|
@ -520,12 +520,12 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 4. 查询订单信息并验证归属权
|
// 4. 查询订单信息并验证归属权
|
||||||
Order order = orderService.selectOrderByOrderId(orderId);
|
Order order = orderService.selectOrderByOrderId(orderId);
|
||||||
|
|
@ -579,12 +579,12 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 4. 设置分页参数
|
// 4. 设置分页参数
|
||||||
PageHelper.startPage(page, limit);
|
PageHelper.startPage(page, limit);
|
||||||
|
|
@ -645,13 +645,13 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 设置分页参数
|
// 4. 设置分页参数
|
||||||
|
|
@ -684,7 +684,7 @@ public class AppletController extends BaseController {
|
||||||
orderData.put("total_price", order.getTotalPrice() != null ? order.getTotalPrice().toString() : "0.00");
|
orderData.put("total_price", order.getTotalPrice() != null ? order.getTotalPrice().toString() : "0.00");
|
||||||
orderData.put("num", order.getNum());
|
orderData.put("num", order.getNum());
|
||||||
if (order.getSku() != null) {
|
if (order.getSku() != null) {
|
||||||
orderData.put("sku", order.getSku());
|
orderData.put("sku",AppletControllerUtil.parseSkuStringToObject(order.getSku()));
|
||||||
} else {
|
} else {
|
||||||
orderData.put("sku", null);
|
orderData.put("sku", null);
|
||||||
}
|
}
|
||||||
|
|
@ -1564,13 +1564,13 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 构建用户信息响应数据
|
// 3. 构建用户信息响应数据
|
||||||
|
|
@ -1585,18 +1585,18 @@ public class AppletController extends BaseController {
|
||||||
query.setStatus(0); // 只查启用
|
query.setStatus(0); // 只查启用
|
||||||
java.util.List<UserMemberRechargeProgram> rechargePrograms = userMemberRechargeProgramService.selectUserMemberRechargeProgramList(query);
|
java.util.List<UserMemberRechargeProgram> rechargePrograms = userMemberRechargeProgramService.selectUserMemberRechargeProgramList(query);
|
||||||
userInfo.put("memberRechargePrograms", rechargePrograms.getFirst());
|
userInfo.put("memberRechargePrograms", rechargePrograms.getFirst());
|
||||||
|
//List<OrderTypeCount> counts = orderService.selectOrderCountByBigtype(user.getId());
|
||||||
order_num.put("yikoujia", 0);
|
// OrderTypeCount
|
||||||
order_num.put("baojia", 0);
|
order_num.put("yuyue",orderService.selectOrderCountByBigtype(user.getId(),1));
|
||||||
order_num.put("yuyue", 0);
|
order_num.put("baojia",orderService.selectOrderCountByBigtype(user.getId(),2));
|
||||||
|
order_num.put("yikoujia",orderService.selectOrderCountByBigtype(user.getId(),3));
|
||||||
userInfo.put("order_num", order_num);
|
userInfo.put("order_num", order_num);
|
||||||
|
|
||||||
goods_order_num.put("daifukuan",0);
|
goods_order_num.put("daifukuan",goodsOrderService.countGoodsOrderByUidAndStatus(user.getId(),1));
|
||||||
goods_order_num.put("daifahuo",0);
|
goods_order_num.put("daifahuo",goodsOrderService.countGoodsOrderByUidAndStatus(user.getId(),2));
|
||||||
goods_order_num.put("daishouhuo", 0);
|
goods_order_num.put("daishouhuo",goodsOrderService.countGoodsOrderByUidAndStatus(user.getId(),3));
|
||||||
goods_order_num.put("daipingjia",0);
|
goods_order_num.put("daipingjia",goodsOrderService.countGoodsOrderByUidAndStatus(user.getId(),4));
|
||||||
goods_order_num.put("shouhou",0);
|
goods_order_num.put("shouhou",goodsOrderService.countGoodsOrderByUidAndStatus(user.getId(),20));
|
||||||
userInfo.put("goods_order_num", goods_order_num);
|
userInfo.put("goods_order_num", goods_order_num);
|
||||||
|
|
||||||
// 新增tx_time字段
|
// 新增tx_time字段
|
||||||
|
|
@ -1765,13 +1765,13 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取当前登录用户信息
|
// 2. 获取当前登录用户信息
|
||||||
Users currentUser = (Users) userValidation.get("user");
|
Users currentUser = (Users) userValidation.get("user");
|
||||||
if (currentUser == null) {
|
if (currentUser == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 验证请求参数
|
// 3. 验证请求参数
|
||||||
|
|
@ -1859,7 +1859,7 @@ public class AppletController extends BaseController {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
return AppletControllerUtil.appletWarning("未提供token,请先登录");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 验证token
|
// 2. 验证token
|
||||||
|
|
@ -1894,7 +1894,7 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
WechatPayUtil wechatPayUtil = new WechatPayUtil();
|
WechatPayUtil wechatPayUtil = new WechatPayUtil();
|
||||||
// 2. 查询订单状态
|
// 2. 查询订单状态
|
||||||
|
|
@ -1943,13 +1943,13 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 获取用户信息
|
// 4. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 设置分页参数
|
// 5. 设置分页参数
|
||||||
|
|
@ -2111,13 +2111,13 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 获取用户信息
|
// 4. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
Long userId = user.getId(); // 获取当前用户id
|
Long userId = user.getId(); // 获取当前用户id
|
||||||
|
|
@ -2166,12 +2166,12 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
IntegralOrder integralOrder = integralOrderService.selectIntegralOrderById(Long.valueOf(id));
|
IntegralOrder integralOrder = integralOrderService.selectIntegralOrderById(Long.valueOf(id));
|
||||||
if (integralOrder==null){
|
if (integralOrder==null){
|
||||||
|
|
@ -2290,12 +2290,12 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 4. 获取用户信息
|
// 4. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 5. 设置分页参数
|
// 5. 设置分页参数
|
||||||
PageHelper.startPage(page, limit);
|
PageHelper.startPage(page, limit);
|
||||||
|
|
@ -2352,13 +2352,13 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 获取用户信息
|
// 4. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 设置分页参数
|
// 5. 设置分页参数
|
||||||
|
|
@ -2407,12 +2407,12 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 查询积分订单信息
|
// 4. 查询积分订单信息
|
||||||
|
|
@ -2598,12 +2598,12 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 首先查询用户的默认地址
|
// 3. 首先查询用户的默认地址
|
||||||
UserAddress userAddressQuery = new UserAddress();
|
UserAddress userAddressQuery = new UserAddress();
|
||||||
|
|
@ -2659,13 +2659,13 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 直接返回固定的消息模板配置数据
|
// 3. 直接返回固定的消息模板配置数据
|
||||||
|
|
@ -2692,13 +2692,13 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 获取模板ID列表
|
// 3. 获取模板ID列表
|
||||||
|
|
@ -2777,13 +2777,13 @@ public class AppletController 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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 验证请求参数
|
// 3. 验证请求参数
|
||||||
|
|
@ -2890,13 +2890,13 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 查询订单信息并验证归属权
|
// 4. 查询订单信息并验证归属权
|
||||||
|
|
@ -3132,12 +3132,12 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 验证请求参数
|
// 3. 验证请求参数
|
||||||
if (params == null || params.get("good_id") == null) {
|
if (params == null || params.get("good_id") == null) {
|
||||||
|
|
@ -3264,11 +3264,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
if (param == null || !param.containsKey("ids") || param.get("ids") == null || param.get("ids").isEmpty()) {
|
if (param == null || !param.containsKey("ids") || param.get("ids") == null || param.get("ids").isEmpty()) {
|
||||||
return AppletControllerUtil.appletWarning("请选择要删除的购物车商品");
|
return AppletControllerUtil.appletWarning("请选择要删除的购物车商品");
|
||||||
|
|
@ -3313,11 +3313,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
if (param == null || !param.containsKey("ids") || param.get("ids") == null || param.get("ids").isEmpty()) {
|
if (param == null || !param.containsKey("ids") || param.get("ids") == null || param.get("ids").isEmpty()) {
|
||||||
return AppletControllerUtil.appletWarning("请选择要查询的购物车商品");
|
return AppletControllerUtil.appletWarning("请选择要查询的购物车商品");
|
||||||
|
|
@ -3422,11 +3422,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
if (params == null || params.get("id") == null) {
|
if (params == null || params.get("id") == null) {
|
||||||
return AppletControllerUtil.appletWarning("购物车ID不能为空");
|
return AppletControllerUtil.appletWarning("购物车ID不能为空");
|
||||||
|
|
@ -3534,12 +3534,12 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 3. 查询全部购物车数据(不分页)
|
// 3. 查询全部购物车数据(不分页)
|
||||||
GoodsCart queryCart = new GoodsCart();
|
GoodsCart queryCart = new GoodsCart();
|
||||||
|
|
@ -3620,12 +3620,12 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 获取分页参数
|
// 3. 获取分页参数
|
||||||
|
|
@ -3752,7 +3752,7 @@ public class AppletController extends BaseController {
|
||||||
// 2. 验证分页参数
|
// 2. 验证分页参数
|
||||||
Map<String, Object> pageValidation = PageUtil.validatePageParams(page, limit);
|
Map<String, Object> pageValidation = PageUtil.validatePageParams(page, limit);
|
||||||
if (!(Boolean) pageValidation.get("valid")) {
|
if (!(Boolean) pageValidation.get("valid")) {
|
||||||
return AppletControllerUtil.appletWarning((String) pageValidation.get("message"));
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 设置分页参数
|
// 3. 设置分页参数
|
||||||
|
|
@ -3851,13 +3851,13 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 获取用户信息
|
// 3. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 查询订单信息并验证归属权
|
// 4. 查询订单信息并验证归属权
|
||||||
|
|
@ -3982,13 +3982,13 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. 构建返回数据
|
// 6. 构建返回数据
|
||||||
|
|
@ -4041,17 +4041,18 @@ public class AppletController extends BaseController {
|
||||||
@PostMapping("/api/service/cancel/order")
|
@PostMapping("/api/service/cancel/order")
|
||||||
public AjaxResult cancelServiceOrder(@RequestBody Map<String, Object> params, HttpServletRequest request) {
|
public AjaxResult cancelServiceOrder(@RequestBody Map<String, Object> params, HttpServletRequest request) {
|
||||||
try {
|
try {
|
||||||
|
RefundUtil refundUtil = new RefundUtil();
|
||||||
// 1. 验证用户登录状态
|
// 1. 验证用户登录状态
|
||||||
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.appletWarning("用户未登录或token无效");
|
return AppletControllerUtil.appletdengluWarning("用户未登录或token无效");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息 AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 验证必要参数
|
// 3. 验证必要参数
|
||||||
|
|
@ -4093,7 +4094,16 @@ public class AppletController extends BaseController {
|
||||||
orderLog.setType(new BigDecimal(9.0));
|
orderLog.setType(new BigDecimal(9.0));
|
||||||
orderLog.setContent(jsonObject.toString());
|
orderLog.setContent(jsonObject.toString());
|
||||||
orderLogService.insertOrderLog(orderLog);
|
orderLogService.insertOrderLog(orderLog);
|
||||||
|
UsersPayBefor usersPayBefor = usersPayBeforService.selectUsersPayBeforByOrderId(order.getOrderId());
|
||||||
|
//如果有支付信息就要进行退款
|
||||||
|
if (usersPayBefor != null) {
|
||||||
|
if (usersPayBefor.getStatus() == 2){
|
||||||
|
refundUtil.refundOrder(order.getOrderId());
|
||||||
|
}
|
||||||
|
}
|
||||||
return AppletControllerUtil.appletSuccess("取消成功");
|
return AppletControllerUtil.appletSuccess("取消成功");
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return AppletControllerUtil.appletWarning("取消失败,请稍后重试");
|
return AppletControllerUtil.appletWarning("取消失败,请稍后重试");
|
||||||
}
|
}
|
||||||
|
|
@ -4108,11 +4118,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users worker = (Users) userValidation.get("user");
|
Users worker = (Users) userValidation.get("user");
|
||||||
if (worker == null) {
|
if (worker == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 查询订单
|
// 2. 查询订单
|
||||||
Order order = orderService.selectOrderById(id);
|
Order order = orderService.selectOrderById(id);
|
||||||
|
|
@ -4176,11 +4186,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 解析分页和筛选参数
|
// 2. 解析分页和筛选参数
|
||||||
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
|
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
|
||||||
|
|
@ -4329,11 +4339,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 查询config_one配置
|
// 2. 查询config_one配置
|
||||||
SiteConfig configQuery = new SiteConfig();
|
SiteConfig configQuery = new SiteConfig();
|
||||||
|
|
@ -4485,11 +4495,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users worker = (Users) userValidation.get("user");
|
Users worker = (Users) userValidation.get("user");
|
||||||
if (worker == null) {
|
if (worker == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 查询订单
|
// 2. 查询订单
|
||||||
Order order = orderService.selectOrderById(id);
|
Order order = orderService.selectOrderById(id);
|
||||||
|
|
@ -4919,11 +4929,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users worker = (Users) userValidation.get("user");
|
Users worker = (Users) userValidation.get("user");
|
||||||
if (worker == null) {
|
if (worker == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 查询订单
|
// 2. 查询订单
|
||||||
Order order = orderService.selectOrderById(id);
|
Order order = orderService.selectOrderById(id);
|
||||||
|
|
@ -5351,11 +5361,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 构建WorkerApply对象
|
// 构建WorkerApply对象
|
||||||
WorkerApply apply = new WorkerApply();
|
WorkerApply apply = new WorkerApply();
|
||||||
|
|
@ -5520,11 +5530,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 查询等级信息
|
// 2. 查询等级信息
|
||||||
Object levelInfo = null;
|
Object levelInfo = null;
|
||||||
|
|
@ -5716,11 +5726,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
if (params == null || !params.containsKey("year") || !params.containsKey("month")) {
|
if (params == null || !params.containsKey("year") || !params.containsKey("month")) {
|
||||||
return AppletControllerUtil.appletWarning("参数year和month不能为空");
|
return AppletControllerUtil.appletWarning("参数year和month不能为空");
|
||||||
|
|
@ -5771,11 +5781,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
|
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
|
||||||
int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 15;
|
int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 15;
|
||||||
|
|
@ -5858,11 +5868,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
|
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
|
||||||
int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 15;
|
int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 15;
|
||||||
|
|
@ -5950,11 +5960,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
// 2. 解析分页和筛选参数
|
// 2. 解析分页和筛选参数
|
||||||
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
|
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1;
|
||||||
|
|
@ -6065,11 +6075,11 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
Long orderId = params.get("id") != null ? Long.parseLong(params.get("id").toString()) : null;
|
Long orderId = params.get("id") != null ? Long.parseLong(params.get("id").toString()) : null;
|
||||||
|
|
@ -6104,6 +6114,7 @@ public class AppletController extends BaseController {
|
||||||
neworderLog.setPaid(1L);
|
neworderLog.setPaid(1L);
|
||||||
neworderLog.setPrice( price);
|
neworderLog.setPrice( price);
|
||||||
neworderLog.setLogId(GenerateCustomCode.generCreateOrder("FEE"));
|
neworderLog.setLogId(GenerateCustomCode.generCreateOrder("FEE"));
|
||||||
|
|
||||||
neworderLog.setWorkerId(user.getId());
|
neworderLog.setWorkerId(user.getId());
|
||||||
neworderLog.setWorkerCost( price);
|
neworderLog.setWorkerCost( price);
|
||||||
neworderLog.setWorkerLogId(user.getId());
|
neworderLog.setWorkerLogId(user.getId());
|
||||||
|
|
@ -6115,7 +6126,7 @@ public class AppletController extends BaseController {
|
||||||
PayBeforeUtil payBeforeUtil = new PayBeforeUtil();
|
PayBeforeUtil payBeforeUtil = new PayBeforeUtil();
|
||||||
payBeforeUtil.createPayBefore(userinfo, totalAmount, logOrderId, neworderLog.getId(),
|
payBeforeUtil.createPayBefore(userinfo, totalAmount, logOrderId, neworderLog.getId(),
|
||||||
null, 7L, null, null,
|
null, 7L, null, null,
|
||||||
null, null, null,1L,null,null);
|
null, null, null,1L,null,order.getOrderId());
|
||||||
|
|
||||||
// // 9. 计算会员优惠和服务金抵扣
|
// // 9. 计算会员优惠和服务金抵扣
|
||||||
// BigDecimal memberMoney = BigDecimal.ZERO;
|
// BigDecimal memberMoney = BigDecimal.ZERO;
|
||||||
|
|
@ -6774,7 +6785,7 @@ public class AppletController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
Users userinfo = usersService.selectUsersById(order.getUid());
|
Users userinfo = usersService.selectUsersById(order.getUid());
|
||||||
payBeforeUtil.handleQuotationPayBefore(userinfo, neworderLog, contentStr);
|
payBeforeUtil.handleQuotationPayBefore(userinfo, neworderLog, contentStr, order.getOrderId());
|
||||||
orderLogService.updateOrderLog(neworderLog);
|
orderLogService.updateOrderLog(neworderLog);
|
||||||
return AppletControllerUtil.appletSuccess("报价成功");
|
return AppletControllerUtil.appletSuccess("报价成功");
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -6820,7 +6831,7 @@ public class AppletController extends BaseController {
|
||||||
//小程序推送用户报价成功
|
//小程序推送用户报价成功
|
||||||
WXsendMsgUtil.sendWorkerADDmoney(user.getOpenid(), order, serviceGoods);
|
WXsendMsgUtil.sendWorkerADDmoney(user.getOpenid(), order, serviceGoods);
|
||||||
Users userinfo = usersService.selectUsersById(order.getUid());
|
Users userinfo = usersService.selectUsersById(order.getUid());
|
||||||
payBeforeUtil.handleQuotationPayBefore(userinfo, log, contentStr);
|
payBeforeUtil.handleQuotationPayBefore(userinfo, log, contentStr, order.getOrderId());
|
||||||
return AppletControllerUtil.appletSuccess("报价成功");
|
return AppletControllerUtil.appletSuccess("报价成功");
|
||||||
} else {
|
} else {
|
||||||
return AppletControllerUtil.appletError("报价失败");
|
return AppletControllerUtil.appletError("报价失败");
|
||||||
|
|
@ -7090,16 +7101,18 @@ public class AppletController extends BaseController {
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
return AppletControllerUtil.appletError("订单不存在");
|
return AppletControllerUtil.appletError("订单不存在");
|
||||||
}
|
}
|
||||||
|
PayBeforeUtil payBeforeUtil = new PayBeforeUtil();
|
||||||
String priceDifferenceprice= params.get("priceDifferenceprice").toString();
|
String priceDifferenceprice= params.get("priceDifferenceprice").toString();
|
||||||
|
int paynum=usersPayBeforService.countByLastOrderIdAndStatus(order.getOrderId());
|
||||||
|
//如果订单没有支付
|
||||||
|
if (paynum<=0){
|
||||||
// 1. 修改订单状态
|
// 1. 修改订单状态
|
||||||
order.setStatus(6L); // 完成
|
order.setStatus(6L); // 完成
|
||||||
order.setReceiveType(3L); // 完成类型
|
order.setReceiveType(3L); // 完成类型
|
||||||
order.setJsonStatus(9); // 完成
|
order.setJsonStatus(9); // 完成
|
||||||
order.setLogJson("{\"type\":8}");
|
order.setLogJson("{\"type\":8}");
|
||||||
int update = orderService.updateOrder(order);
|
int update = orderService.updateOrder(order);
|
||||||
if (update > 0) {
|
}
|
||||||
// 2. 组装日志内容
|
// 2. 组装日志内容
|
||||||
Map<String, Object> logContent = new LinkedHashMap<>();
|
Map<String, Object> logContent = new LinkedHashMap<>();
|
||||||
logContent.put("name", "师傅服务完成");
|
logContent.put("name", "师傅服务完成");
|
||||||
|
|
@ -7109,6 +7122,7 @@ public class AppletController extends BaseController {
|
||||||
OrderLog log = new OrderLog();
|
OrderLog log = new OrderLog();
|
||||||
log.setOid(order.getId());
|
log.setOid(order.getId());
|
||||||
log.setOrderId(order.getOrderId());
|
log.setOrderId(order.getOrderId());
|
||||||
|
log.setLogOrderId(GenerateCustomCode.generCreateOrder("DSB"));
|
||||||
log.setTitle("服务完成");
|
log.setTitle("服务完成");
|
||||||
log.setType(new java.math.BigDecimal(7));
|
log.setType(new java.math.BigDecimal(7));
|
||||||
log.setContent(contentStr);
|
log.setContent(contentStr);
|
||||||
|
|
@ -7118,15 +7132,20 @@ public class AppletController extends BaseController {
|
||||||
if (StringUtils.isNotBlank(priceDifferenceprice)) {
|
if (StringUtils.isNotBlank(priceDifferenceprice)) {
|
||||||
log.setCjMoney(new BigDecimal(priceDifferenceprice));
|
log.setCjMoney(new BigDecimal(priceDifferenceprice));
|
||||||
log.setCjPaid(1L);
|
log.setCjPaid(1L);
|
||||||
|
Users userinfo = usersService.selectUsersById(order.getUid());
|
||||||
|
|
||||||
|
payBeforeUtil.createPayBefore(userinfo, log.getCjMoney(), log.getLogOrderId(), log.getId(),
|
||||||
|
null, 10L, null, null,
|
||||||
|
null, null, null,1L,null,order.getOrderId());
|
||||||
}
|
}
|
||||||
orderLogService.insertOrderLog(log);
|
orderLogService.insertOrderLog(log);
|
||||||
Users users = usersService.selectUsersById(order.getUid());
|
Users users = usersService.selectUsersById(order.getUid());
|
||||||
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(order.getProductId());
|
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(order.getProductId());
|
||||||
|
|
||||||
|
|
||||||
WXsendMsgUtil.sendWorkerFinishOrder(users.getOpenid(), order, serviceGoods);
|
WXsendMsgUtil.sendWorkerFinishOrder(users.getOpenid(), order, serviceGoods);
|
||||||
return AppletControllerUtil.appletSuccess("服务已完成");
|
return AppletControllerUtil.appletSuccess("服务已完成");
|
||||||
} else {
|
|
||||||
return AppletControllerUtil.appletError("操作失败");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 结束订单
|
* 结束订单
|
||||||
|
|
@ -7639,13 +7658,13 @@ public class AppletController 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.appletUnauthorized();
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
String orderId =GenerateCustomCode.generCreateOrder("TX");
|
String orderId =GenerateCustomCode.generCreateOrder("TX");
|
||||||
// 2. 获取用户信息
|
// 2. 获取用户信息
|
||||||
Users user = (Users) userValidation.get("user");
|
Users user = (Users) userValidation.get("user");
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||||
}
|
}
|
||||||
String money = params.get("money").toString();
|
String money = params.get("money").toString();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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://c5ed8e7.r3.cpolar.top/";
|
public static final String PAY_FH = "https://4a8ed13a.r3.cpolar.top/";
|
||||||
/**
|
/**
|
||||||
* 其他配置常量
|
* 其他配置常量
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,9 @@ public class Order extends BaseEntity
|
||||||
private String fileData;
|
private String fileData;
|
||||||
|
|
||||||
|
|
||||||
|
private String ispay;
|
||||||
|
|
||||||
|
|
||||||
private Long baojiasf;
|
private Long baojiasf;
|
||||||
|
|
||||||
private Long baojiayh;
|
private Long baojiayh;
|
||||||
|
|
@ -934,17 +937,13 @@ public class Order extends BaseEntity
|
||||||
this.ids = ids;
|
this.ids = ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class OrderTypeCount {
|
|
||||||
private int bigtype;
|
public String getIspay() {
|
||||||
private int count;
|
return ispay;
|
||||||
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 void setIspay(String ispay) {
|
||||||
public int getCount() { return count; }
|
this.ispay = ispay;
|
||||||
public void setCount(int count) { this.count = count; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,14 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询商品订单列表
|
* 查询商品订单列表
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -78,9 +79,10 @@ public interface OrderMapper
|
||||||
public int deleteOrderByIds(Long[] ids);
|
public int deleteOrderByIds(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计bigtype为1、2、3且status!=4的订单数量,按bigtype分组,指定用户
|
* 统计指定用户和类型的订单数量
|
||||||
* @param uid 用户id
|
* @param uid 用户id
|
||||||
* @return 统计结果
|
* @param type 订单类型
|
||||||
|
* @return 订单数量
|
||||||
*/
|
*/
|
||||||
List<Order.OrderTypeCount> selectOrderCountByBigtype(Long uid);
|
Integer selectOrderCountByBigtype(@Param("uid") Long uid, @Param("type") Integer type);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,11 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,14 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增商品订单
|
* 新增商品订单
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ 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接口
|
||||||
|
|
@ -76,9 +77,10 @@ public interface IOrderService
|
||||||
public int deleteOrderById(Long id);
|
public int deleteOrderById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计bigtype为1、2、3且status!=4的订单数量,按bigtype分组,指定用户
|
* 统计指定用户和类型的订单数量
|
||||||
* @param uid 用户id
|
* @param uid 用户id
|
||||||
* @return 统计结果
|
* @param type 订单类型
|
||||||
|
* @return 订单数量
|
||||||
*/
|
*/
|
||||||
List<Order.OrderTypeCount> selectOrderCountByBigtype(Long uid);
|
Integer selectOrderCountByBigtype(Long uid, Integer type);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,4 +62,12 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,11 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询商品订单列表
|
* 查询商品订单列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ 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,8 +71,8 @@ public class OrderServiceImpl implements IOrderService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Order.OrderTypeCount> selectOrderCountByBigtype(Long uid) {
|
public Integer selectOrderCountByBigtype(Long uid, Integer type) {
|
||||||
return orderMapper.selectOrderCountByBigtype(uid);
|
return orderMapper.selectOrderCountByBigtype(uid, type);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 新增服务订单
|
* 新增服务订单
|
||||||
|
|
|
||||||
|
|
@ -95,4 +95,9 @@ public class UsersPayBeforServiceImpl implements IUsersPayBeforService
|
||||||
{
|
{
|
||||||
return usersPayBeforMapper.deleteUsersPayBeforById(id);
|
return usersPayBeforMapper.deleteUsersPayBeforById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer countByLastOrderIdAndStatus(String orderid) {
|
||||||
|
return usersPayBeforMapper.countByLastOrderIdAndStatus(orderid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,9 @@ 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">
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,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 updated_at DESC LIMIT 1;
|
ORDER BY id DESC LIMIT 1;
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,11 @@
|
||||||
<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>-->
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
order by id desc
|
order by id desc
|
||||||
|
|
@ -257,13 +262,12 @@
|
||||||
where order_id = #{orderId}
|
where order_id = #{orderId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOrderCountByBigtype" resultType="com.ruoyi.system.domain.Order.OrderTypeCount" parameterType="map">
|
<select id="selectOrderCountByBigtype" resultType="Integer" parameterType="map">
|
||||||
select bigtype, count(1) as count
|
select count(1)
|
||||||
from order_data
|
from order_data
|
||||||
where bigtype in (1,2,3)
|
where bigtype = #{type}
|
||||||
and status != 4
|
and status != 4
|
||||||
and uid = #{uid}
|
and uid = #{uid}
|
||||||
group by bigtype
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,10 @@ 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=",">
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ export default {
|
||||||
// 图片数量限制
|
// 图片数量限制
|
||||||
limit: {
|
limit: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 5
|
default: 9
|
||||||
},
|
},
|
||||||
// 大小限制(MB)
|
// 大小限制(MB)
|
||||||
fileSize: {
|
fileSize: {
|
||||||
|
|
|
||||||
|
|
@ -525,6 +525,7 @@ 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");
|
||||||
|
|
@ -571,6 +572,8 @@ 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 = "添加服务内容"
|
||||||
},
|
},
|
||||||
|
|
@ -580,6 +583,20 @@ 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) {
|
||||||
|
|
@ -629,6 +646,14 @@ 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 =>
|
||||||
|
|
@ -642,9 +667,6 @@ export default {
|
||||||
this.form.questions = null;
|
this.form.questions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置规格类型
|
|
||||||
this.form.skuType = this.skuType;
|
|
||||||
|
|
||||||
// 处理规格信息
|
// 处理规格信息
|
||||||
if (this.skuType === 2) {
|
if (this.skuType === 2) {
|
||||||
// 多规格模式
|
// 多规格模式
|
||||||
|
|
@ -660,16 +682,9 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 单规格模式
|
// 单规格模式,直接设置为{"type":"single"}
|
||||||
if (!this.form.skuName || !this.form.skuValue) {
|
this.form.sku = JSON.stringify({ type: "single" });
|
||||||
this.$modal.msgError("请完善单规格信息");
|
this.form.skuType = 1;
|
||||||
return;
|
|
||||||
}
|
|
||||||
const singleSku = {
|
|
||||||
name: this.form.skuName,
|
|
||||||
value: this.form.skuValue
|
|
||||||
};
|
|
||||||
this.form.sku = JSON.stringify(singleSku);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证sku不能为空
|
// 验证sku不能为空
|
||||||
|
|
@ -735,234 +750,4 @@ 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) {
|
|
||||||
this.currentAudioUrl = url
|
|
||||||
this.audioDialogVisible = true
|
|
||||||
},
|
|
||||||
openEditDialog(row, field, label) {
|
|
||||||
this.editRow = row;
|
|
||||||
this.editField = field;
|
|
||||||
this.editFieldLabel = label;
|
|
||||||
this.editFieldValue = row[field];
|
|
||||||
this.editDialogVisible = true;
|
|
||||||
},
|
|
||||||
async saveEditField() {
|
|
||||||
if (!this.editRow) return;
|
|
||||||
|
|
||||||
// 验证输入值
|
|
||||||
let value = this.editFieldValue;
|
|
||||||
if (['price', 'margin'].includes(this.editField)) {
|
|
||||||
// 价格字段验证
|
|
||||||
const numValue = parseFloat(value);
|
|
||||||
if (isNaN(numValue) || numValue < 0) {
|
|
||||||
this.$message.error('请输入有效的价格');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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>
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
@ -920,7 +920,7 @@ export default {
|
||||||
status: "1",
|
status: "1",
|
||||||
description: null,
|
description: null,
|
||||||
skuType: 1,
|
skuType: 1,
|
||||||
sku: "{}",
|
sku: JSON.stringify({ type: "single" }),
|
||||||
skuName: '',
|
skuName: '',
|
||||||
skuValue: '',
|
skuValue: '',
|
||||||
latitude: null,
|
latitude: null,
|
||||||
|
|
@ -1039,6 +1039,9 @@ export default {
|
||||||
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(){
|
||||||
|
|
@ -1284,6 +1287,21 @@ export default {
|
||||||
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('编辑数据加载失败,请重试');
|
||||||
|
|
@ -1373,6 +1391,15 @@ 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 单选转字符串数组
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue