...
|
...
|
@@ -402,6 +402,9 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
|
|
|
|
public PageResponseBO<UidCouponQueryResp> queryUserCouponList(UserCouponQueryReq req) {
|
|
|
LOGGER.info("enter queryUserCouponList, req is {}",req);
|
|
|
if(req.getUid() == null && StringUtils.isEmpty(req.getCouponCode())){
|
|
|
return null;
|
|
|
}
|
|
|
int total = userCouponMapper.selectTotalByCondition(req);
|
|
|
if(0==total){
|
|
|
new PageResponseBO<>(total, Lists.newArrayList(), req.getRows(), req.getPage());;
|
...
|
...
|
@@ -426,6 +429,54 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
|
return new ApiResponse();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int updateUserCoupon(UserCouponUpdateReq userCouponUpdateReq) {
|
|
|
|
|
|
PlatformException platformException = null;
|
|
|
Integer uid;
|
|
|
if (Objects.isNull(uid = userCouponUpdateReq.getUid())){
|
|
|
platformException = new PlatformException("uid is null", 401);
|
|
|
throwRuntimeExcetion(platformException);
|
|
|
}
|
|
|
Integer couponId;
|
|
|
if (Objects.isNull(couponId = userCouponUpdateReq.getCouponId())){
|
|
|
platformException = new PlatformException("couponId is null", 401);
|
|
|
throwRuntimeExcetion(platformException);
|
|
|
}
|
|
|
String couponCode;
|
|
|
if (StringUtils.isBlank(couponCode = userCouponUpdateReq.getCouponCode())){
|
|
|
platformException = new PlatformException("couponCode is null", 401);
|
|
|
throwRuntimeExcetion(platformException);
|
|
|
}
|
|
|
|
|
|
Integer endtime;
|
|
|
if (Objects.isNull(endtime = userCouponUpdateReq.getEndTime())){
|
|
|
platformException = new PlatformException("endtime is null", 401);
|
|
|
throwRuntimeExcetion(platformException);
|
|
|
}
|
|
|
|
|
|
if (endtime<=0){
|
|
|
platformException = new PlatformException("endtime is illegal", 401);
|
|
|
throwRuntimeExcetion(platformException);
|
|
|
}
|
|
|
|
|
|
UserCoupon condition = new UserCoupon();
|
|
|
condition.setUid(uid);
|
|
|
condition.setCouponCode(couponCode);
|
|
|
condition.setCouponId(couponId);
|
|
|
condition.setEndTime(endtime);
|
|
|
int rows = userCouponMapper.updateEndTimeOfOneUser(condition);
|
|
|
if (rows == 0){
|
|
|
platformException = new PlatformException("修改失败", 401);
|
|
|
throwRuntimeExcetion(platformException);
|
|
|
}
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
private static void throwRuntimeExcetion(PlatformException platformException){
|
|
|
throw new RuntimeException(platformException);
|
|
|
}
|
|
|
|
|
|
private List<UidCouponQueryResp> complateCouponInfo(List<UserCoupon> userCoupons) {
|
|
|
if (CollectionUtils.isEmpty(userCoupons)) {
|
|
|
return Lists.newArrayList();
|
...
|
...
|
|