'修复已知问题'

dev-discount
199901012 4 years ago
parent 84f9418d4c
commit 71f32c0077
  1. 7
      hai-service/src/main/java/com/hai/service/HighUserCouponService.java
  2. 17
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  3. 12
      hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java

@ -34,6 +34,13 @@ public interface HighUserCouponService {
**/ **/
List<HighUserCoupon> getOverdueCoupon(); List<HighUserCoupon> getOverdueCoupon();
/**
* @Author 胡锐
* @Description 根据卡卷销售码id查询
* @Date 2021/3/29 23:28
**/
HighUserCoupon getDetailByCodeId(Long couponCodeId);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 查询用户列表 * @Description 查询用户列表

@ -8,13 +8,11 @@ import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator; import com.hai.common.utils.IDGenerator;
import com.hai.dao.HighCouponCodeMapper; import com.hai.dao.HighCouponCodeMapper;
import com.hai.dao.HighCouponCodeMapperExt; import com.hai.dao.HighCouponCodeMapperExt;
import com.hai.entity.HighChildOrder; import com.hai.entity.*;
import com.hai.entity.HighCouponCode;
import com.hai.entity.HighCouponCodeExample;
import com.hai.entity.HighOrder;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.HighCouponCodeService; import com.hai.service.HighCouponCodeService;
import com.hai.service.HighOrderService; import com.hai.service.HighOrderService;
import com.hai.service.HighUserCouponService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -44,6 +42,9 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
@Resource @Resource
private HighOrderService highOrderService; private HighOrderService highOrderService;
@Resource
private HighUserCouponService highUserCouponService;
@Override @Override
public void insertCouponCode(HighCouponCode highCouponCode) { public void insertCouponCode(HighCouponCode highCouponCode) {
highCouponCodeMapper.insert(highCouponCode); highCouponCodeMapper.insert(highCouponCode);
@ -91,6 +92,14 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
salesCode.setStatus(3); salesCode.setStatus(3);
updateCouponCode(salesCode); updateCouponCode(salesCode);
//修改 用户与卡卷的关系
HighUserCoupon userCoupon = highUserCouponService.getDetailByCodeId(salesCode.getId());
if (userCoupon == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "卡卷状态异常");
}
userCoupon.setStatus(2); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponService.updateUserCoupon(userCoupon);
highOrderService.childOrderComplete(salesCode.getChildOrderId()); highOrderService.childOrderComplete(salesCode.getChildOrderId());
} }

@ -43,6 +43,18 @@ public class HighUserCouponServiceImpl implements HighUserCouponService {
return highUserCouponMapper.selectByExample(example); return highUserCouponMapper.selectByExample(example);
} }
@Override
public HighUserCoupon getDetailByCodeId(Long couponCodeId) {
HighUserCouponExample example = new HighUserCouponExample();
example.createCriteria().andStatusEqualTo(1).andCouponCodeIdEqualTo(couponCodeId);
List<HighUserCoupon> highUserCoupons = highUserCouponMapper.selectByExample(example);
if (highUserCoupons.size() > 0) {
return highUserCoupons.get(0);
}
return null;
}
@Override @Override
public List<HighUserCouponModel> getUserCouponList(Map<String, Object> map) { public List<HighUserCouponModel> getUserCouponList(Map<String, Object> map) {
HighUserCouponExample example = new HighUserCouponExample(); HighUserCouponExample example = new HighUserCouponExample();

Loading…
Cancel
Save