订单评价和投诉
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.starry.admin.modules.weichat.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.common.aspect.CustomUserLogin;
|
||||
import com.starry.admin.common.conf.ThreadLocalRequestDetail;
|
||||
@@ -11,14 +12,21 @@ import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserListResultVo;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkCommodityService;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomLeaveMsgEntity;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomLeaveMsgService;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
||||
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
||||
import com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity;
|
||||
import com.starry.admin.modules.gift.service.IPlayGiftInfoService;
|
||||
import com.starry.admin.modules.order.module.entity.PlayOrderComplaintInfoEntity;
|
||||
import com.starry.admin.modules.order.module.entity.PlayOrderEvaluateInfoEntity;
|
||||
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||
import com.starry.admin.modules.order.module.vo.PlayOrderDetailsReturnVo;
|
||||
import com.starry.admin.modules.order.module.vo.PlayOrderInfoQueryVo;
|
||||
import com.starry.admin.modules.order.module.vo.PlayOrderInfoReturnVo;
|
||||
import com.starry.admin.modules.order.service.IPlayOrderComplaintInfoService;
|
||||
import com.starry.admin.modules.order.service.IPlayOrderEvaluateInfoService;
|
||||
import com.starry.admin.modules.order.service.IPlayOrderInfoService;
|
||||
import com.starry.admin.modules.weichat.entity.*;
|
||||
import com.starry.admin.modules.weichat.service.WxCustomUserService;
|
||||
@@ -32,6 +40,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
@@ -66,7 +75,16 @@ public class WxCustomController {
|
||||
private WxCustomUserService customUserService;
|
||||
|
||||
@Resource
|
||||
private IPlayOrderInfoService orderInfoService;
|
||||
private IPlayOrderInfoService playOrderInfoService;
|
||||
|
||||
@Resource
|
||||
private IPlayCustomLeaveMsgService playCustomLeaveMsgService;
|
||||
|
||||
@Resource
|
||||
private IPlayOrderComplaintInfoService playOrderComplaintInfoService;
|
||||
|
||||
@Resource
|
||||
private IPlayOrderEvaluateInfoService playOrderEvaluateInfoService;
|
||||
|
||||
/**
|
||||
* 根据店员ID查询店员详细信息
|
||||
@@ -115,7 +133,7 @@ public class WxCustomController {
|
||||
throw new CustomException("余额不足");
|
||||
}
|
||||
// 记录订单信息
|
||||
orderInfoService.createRewardOrder(new BigDecimal(vo.getMoney()), new BigDecimal(vo.getMoney()), userId);
|
||||
playOrderInfoService.createRewardOrder(new BigDecimal(vo.getMoney()), new BigDecimal(vo.getMoney()), userId);
|
||||
// 顾客减少余额
|
||||
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance().subtract(new BigDecimal(vo.getMoney())));
|
||||
playBalanceDetailsInfoService.create("0", customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(new BigDecimal(vo.getMoney())), "打赏", new BigDecimal(vo.getMoney()).multiply(new BigDecimal("-1")));
|
||||
@@ -141,7 +159,7 @@ public class WxCustomController {
|
||||
throw new CustomException("账号余额不足");
|
||||
}
|
||||
// 记录订单信息
|
||||
orderInfoService.createGiftOrder(vo.getGiftId(), giftInfo.getPrice(), vo.getGiftQuantity(), money, money, userId);
|
||||
playOrderInfoService.createGiftOrder(vo.getGiftId(), giftInfo.getPrice(), vo.getGiftQuantity(), money, money, userId);
|
||||
// 顾客减少余额
|
||||
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance().subtract(money));
|
||||
playBalanceDetailsInfoService.create("0", customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(money), "赠送礼物", money.multiply(new BigDecimal("-1")));
|
||||
@@ -157,7 +175,7 @@ public class WxCustomController {
|
||||
*
|
||||
* @param vo 指定订单查询对象
|
||||
* @return com.starry.common.result.R
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @author admin
|
||||
* @since 2024/5/8 16:31
|
||||
**/
|
||||
@CustomUserLogin
|
||||
@@ -174,7 +192,7 @@ public class WxCustomController {
|
||||
throw new CustomException("余额不足");
|
||||
}
|
||||
// 记录订单信息
|
||||
orderInfoService.createOrdinaryOrder("2", "0", clerkCommodity.getCommodityId(), clerkCommodity.getCommodityPrice(), vo.getCommodityQuantity(), money, money, customId);
|
||||
playOrderInfoService.createOrdinaryOrder("2", "0", clerkCommodity.getCommodityId(), clerkCommodity.getCommodityPrice(), vo.getCommodityQuantity(), money, money, customId);
|
||||
// 顾客减少余额
|
||||
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance().subtract(money));
|
||||
playBalanceDetailsInfoService.create("0", customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(money), "打赏", money.multiply(new BigDecimal("-1")));
|
||||
@@ -197,7 +215,7 @@ public class WxCustomController {
|
||||
*
|
||||
* @param vo 订单列表分页查询对象
|
||||
* @return com.starry.common.result.R
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @author admin
|
||||
* @since 2024/5/8 15:57
|
||||
**/
|
||||
@CustomUserLogin
|
||||
@@ -205,7 +223,7 @@ public class WxCustomController {
|
||||
public R queryOrderByPage(@Validated @RequestBody PlayOrderInfoQueryVo vo) {
|
||||
vo.setPurchaserBy(ThreadLocalRequestDetail.getCustomUserInfo().getId());
|
||||
vo.setOrderType("2");
|
||||
IPage<PlayOrderInfoReturnVo> iPage = orderInfoService.selectOrderInfoPage(vo);
|
||||
IPage<PlayOrderInfoReturnVo> iPage = playOrderInfoService.selectOrderInfoPage(vo);
|
||||
return R.ok(iPage);
|
||||
}
|
||||
|
||||
@@ -214,13 +232,13 @@ public class WxCustomController {
|
||||
*
|
||||
* @param id 订单ID
|
||||
* @return com.starry.common.result.R
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @author admin
|
||||
* @since 2024/5/8 15:57
|
||||
**/
|
||||
@CustomUserLogin
|
||||
@GetMapping("/order/queryById")
|
||||
public R queryById(@RequestParam("id") String id) {
|
||||
PlayOrderInfoEntity orderInfo = orderInfoService.selectOrderInfoById(id);
|
||||
PlayOrderDetailsReturnVo orderInfo = playOrderInfoService.selectById(id);
|
||||
return R.ok(orderInfo);
|
||||
}
|
||||
|
||||
@@ -229,22 +247,119 @@ public class WxCustomController {
|
||||
*
|
||||
* @param id 订单ID
|
||||
* @return com.starry.common.result.R
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @author admin
|
||||
* @since 2024/5/8 15:57
|
||||
**/
|
||||
@CustomUserLogin
|
||||
@GetMapping("/order/cancellation")
|
||||
public R cancellationOrder(@RequestParam("id") String id) {
|
||||
orderInfoService.customCancellationOrder(id);
|
||||
playOrderInfoService.customCancellationOrder(id);
|
||||
return R.ok("取消成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增订单评价信息
|
||||
*
|
||||
* @param vo 订单评价信息实体
|
||||
* @return com.starry.common.result.R
|
||||
* @author admin
|
||||
* @since 2024/5/8 15:57
|
||||
**/
|
||||
@CustomUserLogin
|
||||
@PostMapping("/order/evaluate/add")
|
||||
public R addOrderEvaluate(@Validated @RequestBody PlayOrderEvaluateAddVo vo) {
|
||||
vo.setCustomId(ThreadLocalRequestDetail.getCustomUserInfo().getId());
|
||||
PlayOrderInfoEntity orderInfo = playOrderInfoService.selectOrderInfoById(vo.getOrderId());
|
||||
if (!orderInfo.getPurchaserBy().equals(vo.getCustomId())) {
|
||||
throw new CustomException("只有下单人才能评价");
|
||||
}
|
||||
PlayOrderEvaluateInfoEntity entity = ConvertUtil.entityToVo(vo, PlayOrderEvaluateInfoEntity.class);
|
||||
playOrderEvaluateInfoService.create(entity);
|
||||
return R.ok("评价成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增订单投诉信息
|
||||
*
|
||||
* @param vo 订单评价信息实体
|
||||
* @return com.starry.common.result.R
|
||||
* @author admin
|
||||
* @since 2024/5/8 15:57
|
||||
**/
|
||||
@CustomUserLogin
|
||||
@PostMapping("/order/complaint/add")
|
||||
public R addOrderComplaint(@Validated @RequestBody PlayOrderComplaintAddVo vo) {
|
||||
vo.setCustomId(ThreadLocalRequestDetail.getCustomUserInfo().getId());
|
||||
PlayOrderInfoEntity orderInfo = playOrderInfoService.selectOrderInfoById(vo.getOrderId());
|
||||
if (!orderInfo.getPurchaserBy().equals(vo.getCustomId())) {
|
||||
throw new CustomException("只有下单人才能投诉");
|
||||
}
|
||||
PlayOrderComplaintInfoEntity entity = ConvertUtil.entityToVo(vo, PlayOrderComplaintInfoEntity.class);
|
||||
playOrderComplaintInfoService.create(entity);
|
||||
return R.ok("新增成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 顾客新增留言
|
||||
*
|
||||
* @param vo 顾客新增留言对象
|
||||
* @return com.starry.common.result.R
|
||||
* @author admin
|
||||
* @since 2024/5/8 15:57
|
||||
**/
|
||||
@CustomUserLogin
|
||||
@PostMapping("/leave/add")
|
||||
public R cancellationOrder(@Validated @RequestBody PlayCustomLeaveAddVo vo) {
|
||||
vo.setCustomId(ThreadLocalRequestDetail.getCustomUserInfo().getId());
|
||||
PlayCustomLeaveMsgEntity entity = ConvertUtil.entityToVo(vo, PlayCustomLeaveMsgEntity.class);
|
||||
entity.setMsgTime(new Date());
|
||||
playCustomLeaveMsgService.create(entity);
|
||||
return R.ok("取消成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前顾客是否允许留言
|
||||
*
|
||||
* @return com.starry.common.result.R
|
||||
* @author admin
|
||||
* @since 2024/5/8 15:57
|
||||
**/
|
||||
@CustomUserLogin
|
||||
@GetMapping("/leave/queryPermission")
|
||||
public R queryLeavePermission() {
|
||||
// 不允许留言的原因,如果原因为空,说明允许留言
|
||||
String noMessagesAllowedReason = playCustomLeaveMsgService.queryNoMessagesAllowedReason(ThreadLocalRequestDetail.getCustomUserInfo().getId());
|
||||
if (StringUtils.isEmpty(noMessagesAllowedReason)) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("permission", true);
|
||||
jsonObject.put("msg", "");
|
||||
return R.ok(jsonObject);
|
||||
} else {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("permission", false);
|
||||
jsonObject.put("msg", noMessagesAllowedReason);
|
||||
return R.ok(jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 顾客修改对陪玩的关注状态
|
||||
*
|
||||
* @param vo 陪玩的关注状态对象
|
||||
* @return com.starry.common.result.R
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @author admin
|
||||
* @since 2024/5/8 15:57
|
||||
**/
|
||||
@CustomUserLogin
|
||||
|
||||
@@ -54,7 +54,7 @@ public class WxPlayController {
|
||||
/**
|
||||
* 微信支付-微信回调地址(https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_7&index=8)
|
||||
*
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @author admin
|
||||
* @since 2024/5/8 11:25
|
||||
**/
|
||||
@GetMapping("/jsCallback")
|
||||
@@ -74,15 +74,15 @@ public class WxPlayController {
|
||||
log.error("*********未查询到对应的支付记录,订单号:{}", outTradeNo);
|
||||
return;
|
||||
}
|
||||
// TODO如果支付状态不是待支付
|
||||
if (!orderInfoEntity.getOrderStatus().equals(RepairStatusEnum.NOT_PAY.name())) {
|
||||
log.error("*********支付记录状态异常,支付记录:{}", JSONObject.toJSONString(repair));
|
||||
return;
|
||||
}
|
||||
Date nowDate = new Date();
|
||||
repair.setPaySuccessTime(nowDate);
|
||||
repair.setPayStatus(RepairStatusEnum.PAID.name());
|
||||
repair.setStatus(RepairStatusEnum.REPAIRING.name());
|
||||
// // TODO如果支付状态不是待支付
|
||||
// if (!orderInfoEntity.getOrderStatus().equals(RepairStatusEnum.NOT_PAY.name())) {
|
||||
// log.error("*********支付记录状态异常,支付记录:{}", JSONObject.toJSONString(repair));
|
||||
// return;
|
||||
// }
|
||||
// Date nowDate = new Date();
|
||||
// repair.setPaySuccessTime(nowDate);
|
||||
// repair.setPayStatus(RepairStatusEnum.PAID.name());
|
||||
// repair.setStatus(RepairStatusEnum.REPAIRING.name());
|
||||
orderInfoService.updateById(orderInfoEntity);
|
||||
|
||||
log.info("*********支付处理完成");
|
||||
@@ -134,8 +134,8 @@ public class WxPlayController {
|
||||
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(ThreadLocalRequestDetail.getCustomUserInfo().getId());
|
||||
// 租户信息
|
||||
SysTenantEntity entity = tenantService.selectSysTenantByTenantId(tenantId);
|
||||
// 订单总金额,单位为分(开发阶段固定设置为支付1分钱)
|
||||
long totalFee = 1;
|
||||
// 订单总金额,单位为分
|
||||
long totalFee = getTotalFee(money);
|
||||
// 创建订单信息
|
||||
String orderId = IdUtil.fastSimpleUUID();
|
||||
orderInfoService.createRechargeOrder(orderId, new BigDecimal(totalFee * 1.0 / 100), new BigDecimal(totalFee * 1.0 / 100), customUserInfo.getId());
|
||||
@@ -184,7 +184,7 @@ public class WxPlayController {
|
||||
public long getTotalFee(String money) {
|
||||
long totalFee;
|
||||
try {
|
||||
totalFee = (long) Float.parseFloat(money) * 100;
|
||||
totalFee = (long) (Float.parseFloat(money) * 100);
|
||||
} catch (Exception e) {
|
||||
throw new CustomException("请求参数错误,money类型异常");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顾客新增留言对象
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024/5/8 下午10:03
|
||||
**/
|
||||
@Data
|
||||
public class PlayCustomLeaveAddVo {
|
||||
|
||||
/**
|
||||
* 顾客ID
|
||||
*/
|
||||
private String customId;
|
||||
|
||||
/**
|
||||
* 留言内容
|
||||
*/
|
||||
@NotBlank(message = "留言内容不能为空")
|
||||
@Length(max = 255, message = "留言内容不能超过255个字符")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
|
||||
@NotNull(message = "images不能为空")
|
||||
@Size(max = 3, message = "照片不能超过3张")
|
||||
private List<String> images;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单投诉新增VO
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024/5/8 下午10:49
|
||||
**/
|
||||
@Data
|
||||
public class PlayOrderComplaintAddVo {
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@NotBlank(message = "订单ID不能为空")
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 顾客ID
|
||||
*/
|
||||
private String customId;
|
||||
|
||||
/**
|
||||
* 投诉人微信号码
|
||||
*/
|
||||
@NotBlank(message = "微信号码不能为空")
|
||||
private String wxChatCode;
|
||||
|
||||
/**
|
||||
* 投诉内容
|
||||
*/
|
||||
@NotBlank(message = "投诉内容不能为空")
|
||||
@Length(max = 255, message = "投诉内容最多255个字符")
|
||||
private String complaintCon;
|
||||
|
||||
/**
|
||||
* 投诉时间
|
||||
*/
|
||||
private Date complaintTime = new Date();
|
||||
|
||||
/**
|
||||
* 图片列表
|
||||
*/
|
||||
private List<String> images;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 订单评价新增VO
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024/5/8 下午10:49
|
||||
**/
|
||||
@Data
|
||||
public class PlayOrderEvaluateAddVo {
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@NotBlank(message = "订单ID不能为空")
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 顾客ID
|
||||
*/
|
||||
private String customId;
|
||||
|
||||
/**
|
||||
* 匿名评价(0:匿名,1:非匿名)
|
||||
*/
|
||||
@NotBlank(message = "是否匿名不能为空")
|
||||
@Pattern(regexp = "[01]", message = "匿名评价只能位0或1")
|
||||
private String anonymous;
|
||||
|
||||
/**
|
||||
* 评价类型(0:好评,1差评)
|
||||
*/
|
||||
private String evaluateType = "0";
|
||||
|
||||
/**
|
||||
* 评价等级【1-5星,最低1星,最高5星】
|
||||
*/
|
||||
@NotNull(message = "评价等级不能为空")
|
||||
@Min(value = 1, message = "评价等级最低位1星")
|
||||
@Max(value = 5, message = "评价等级最高5星")
|
||||
private int evaluateLevel;
|
||||
|
||||
/**
|
||||
* 评价内容
|
||||
*/
|
||||
@NotNull(message = "评价内容不能为空")
|
||||
@Length(max = 255, message = "评价内容最多255个字符")
|
||||
private String evaluateCon;
|
||||
|
||||
/**
|
||||
* 评价时间
|
||||
*/
|
||||
private Date evaluateTime = new Date();
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
/**
|
||||
* 微信预支付接口返回信息
|
||||
*
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @author admin
|
||||
* @since 2024/5/8 10:43
|
||||
**/
|
||||
@Data
|
||||
|
||||
@@ -17,6 +17,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WxCustomMpService {
|
||||
@@ -53,7 +56,9 @@ public class WxCustomMpService {
|
||||
if (entity == null) {
|
||||
throw new CustomException("系统错误,租户ID不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(entity.getMchId())) throw new CustomException("商户号不能为空,请联系平台方进行配置");
|
||||
if (StringUtils.isEmpty(entity.getMchId())) {
|
||||
throw new CustomException("商户号不能为空,请联系平台方进行配置");
|
||||
}
|
||||
WxPayConfig payConfig = new WxPayConfig();
|
||||
payConfig.setAppId(StringUtils.trimToNull(entity.getAppId()));
|
||||
payConfig.setMchId(StringUtils.trimToNull(entity.getMchId()));
|
||||
|
||||
Reference in New Issue
Block a user