限制积分记录

dev-discount
袁野 3 years ago
parent 47c5828309
commit edea984a07
  1. 9
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  2. 11
      hai-service/src/main/java/com/hai/service/HighUserService.java
  3. 12
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java
  4. 6
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

@ -228,7 +228,14 @@ public class CzOrderController {
// 积分退款
if (order.getPayType() == 3) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
if (!highUserService.findGoldRepeat(3 , order.getId())) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
}else {
log.error("orderToPay error!", "已有退款记录");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录");
}
}
// 银联退款

@ -108,6 +108,17 @@ public interface HighUserService {
**/
void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId);
/**
* @Author Sum1Dream
* @name findGoldRepeat.java
* @Description // 查询用户是否有重复记录
* @Date 3:55 下午 2022/2/16
* @Param [java.lang.Integer, java.lang.Long]
* @return java.lang.Boolean
*/
Boolean findGoldRepeat(Integer resType , Long resId);
Long countUser();
}

@ -6,8 +6,10 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.dao.HighGoldRecMapper;
import com.hai.dao.HighUserMapper;
import com.hai.entity.HighGoldRec;
import com.hai.entity.HighGoldRecExample;
import com.hai.entity.HighUser;
import com.hai.entity.HighUserExample;
import com.hai.model.HighUserModel;
@ -50,6 +52,9 @@ public class HighUserServiceImpl implements HighUserService {
@Resource
private UserCenter userCenter;
@Resource
private HighGoldRecMapper highGoldRecMapper;
@Override
public List<HighUser> getListUser(Map<String, String> map) {
@ -224,4 +229,11 @@ public class HighUserServiceImpl implements HighUserService {
HighUserExample example = new HighUserExample();
return highUserMapper.countByExample(example);
}
@Override
public Boolean findGoldRepeat(Integer resType, Long resId) {
HighGoldRecExample example = new HighGoldRecExample();
example.createCriteria().andResIdEqualTo(resId).andResTypeEqualTo(resType);
return highGoldRecMapper.selectByExample(example) != null;
}
}

@ -476,7 +476,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 金币退款
if (order.getPayType() == 3) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().intValue() * 100, 1, 3, order.getId());
if (!highUserService.findGoldRepeat(3 , order.getId())) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
}else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录");
}
order.setStatus(5);
order.setRefundTime(new Date());
order.setOutRefundNo("HFR"+new Date().getTime() );

Loading…
Cancel
Save