'修复已知问题'

dev-discount
199901012 4 years ago
parent 4940188ce8
commit d8ee5d273e
  1. 2
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 3
      hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java
  3. 2
      hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java
  4. 2
      hai-service/src/main/java/com/hai/common/security/UserCenter.java
  5. 65
      hai-service/src/main/java/com/hai/dao/HighCouponRecycleMapper.java
  6. 73
      hai-service/src/main/java/com/hai/dao/HighCouponRecycleSqlProvider.java
  7. 2
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java
  8. 10
      hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java

@ -108,6 +108,8 @@ public class HighOrderController {
log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息"); log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, "");
} }
highOrder.setPayModel(1); // 支付模式:1 金币,2 第三方平台,3 混合
highOrder.setPayType(3); // 支付方式: 1:支付宝 2:微信 3:金币
// 是否达到限购数量 // 是否达到限购数量
if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) { if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) {
log.error("HighOrderController --> addOrder() error!", "已达到限购数量"); log.error("HighOrderController --> addOrder() error!", "已达到限购数量");

@ -29,8 +29,7 @@ public class HighCouponSchedule {
* @Description 处理过期的卡券 * @Description 处理过期的卡券
* @Date 2021/4/4 22:44 * @Date 2021/4/4 22:44
**/ **/
// @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 @Scheduled(cron = "5 0 0 * * ?") //每日凌晨12点5秒执行一次
@Scheduled(cron = "0 0 0 * * ?") //每天 凌晨0点执行
public void expiredCoupon() { public void expiredCoupon() {
// 查询过期的卡券 // 查询过期的卡券
List<HighUserCoupon> userCoupons = highUserCouponService.getOverdueCoupon(); List<HighUserCoupon> userCoupons = highUserCouponService.getOverdueCoupon();

@ -29,7 +29,7 @@ public class HighDiscountSchedule {
* @Description 处理过期的优惠券 * @Description 处理过期的优惠券
* @Date 2021/4/4 22:44 * @Date 2021/4/4 22:44
**/ **/
@Scheduled(cron = "0 0 0 * * ?") //每1分钟执行一次 @Scheduled(cron = "5 0 0 * * ?") //每日凌晨12点5秒执行一次
public void expiredDiscount() { public void expiredDiscount() {
List<HighDiscountUserRel> expiredDiscount = highDiscountUserRelService.getExpiredDiscount(); List<HighDiscountUserRel> expiredDiscount = highDiscountUserRelService.getExpiredDiscount();
for (HighDiscountUserRel rel : expiredDiscount) { for (HighDiscountUserRel rel : expiredDiscount) {

@ -19,7 +19,7 @@ public class UserCenter {
private static Logger log = LoggerFactory.getLogger(UserCenter.class); private static Logger log = LoggerFactory.getLogger(UserCenter.class);
private static final String COOKIE_FIELD = "_ida"; private static final String COOKIE_FIELD = "_ida";
private static final int EXPIRE = 3600;//cookie过期时间为1小时,3600秒 private static final int EXPIRE = 43200;//过期时间为12小时
/** /**
* 判断用户是否登录,并且不能单个用户同时登录 * 判断用户是否登录,并且不能单个用户同时登录

@ -3,6 +3,7 @@ package com.hai.dao;
import com.hai.entity.HighCouponRecycle; import com.hai.entity.HighCouponRecycle;
import com.hai.entity.HighCouponRecycleExample; import com.hai.entity.HighCouponRecycleExample;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider; import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider; import org.apache.ibatis.annotations.InsertProvider;
@ -10,7 +11,9 @@ import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider; import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider; import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -29,6 +32,12 @@ public interface HighCouponRecycleMapper extends HighCouponRecycleMapperExt {
@DeleteProvider(type=HighCouponRecycleSqlProvider.class, method="deleteByExample") @DeleteProvider(type=HighCouponRecycleSqlProvider.class, method="deleteByExample")
int deleteByExample(HighCouponRecycleExample example); int deleteByExample(HighCouponRecycleExample example);
@Delete({
"delete from high_coupon_recycle",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({ @Insert({
"insert into high_coupon_recycle (coupon_id, coupon_name, ", "insert into high_coupon_recycle (coupon_id, coupon_name, ",
"merchant_id, coupon_sales_code, ", "merchant_id, coupon_sales_code, ",
@ -56,7 +65,7 @@ public interface HighCouponRecycleMapper extends HighCouponRecycleMapperExt {
@SelectProvider(type=HighCouponRecycleSqlProvider.class, method="selectByExample") @SelectProvider(type=HighCouponRecycleSqlProvider.class, method="selectByExample")
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR), @Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR),
@Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT), @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
@ -76,9 +85,63 @@ public interface HighCouponRecycleMapper extends HighCouponRecycleMapperExt {
}) })
List<HighCouponRecycle> selectByExample(HighCouponRecycleExample example); List<HighCouponRecycle> selectByExample(HighCouponRecycleExample example);
@Select({
"select",
"id, coupon_id, coupon_name, merchant_id, coupon_sales_code, coupon_code_id, ",
"user_id, user_phone, order_no, order_id, child_order_id, `type`, receive_time, ",
"create_time, ext_1, ext_3, ext_2",
"from high_coupon_recycle",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR),
@Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_sales_code", property="couponSalesCode", jdbcType=JdbcType.VARCHAR),
@Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT),
@Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="receive_time", property="receiveTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR)
})
HighCouponRecycle selectByPrimaryKey(Long id);
@UpdateProvider(type=HighCouponRecycleSqlProvider.class, method="updateByExampleSelective") @UpdateProvider(type=HighCouponRecycleSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighCouponRecycle record, @Param("example") HighCouponRecycleExample example); int updateByExampleSelective(@Param("record") HighCouponRecycle record, @Param("example") HighCouponRecycleExample example);
@UpdateProvider(type=HighCouponRecycleSqlProvider.class, method="updateByExample") @UpdateProvider(type=HighCouponRecycleSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighCouponRecycle record, @Param("example") HighCouponRecycleExample example); int updateByExample(@Param("record") HighCouponRecycle record, @Param("example") HighCouponRecycleExample example);
@UpdateProvider(type=HighCouponRecycleSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighCouponRecycle record);
@Update({
"update high_coupon_recycle",
"set coupon_id = #{couponId,jdbcType=BIGINT},",
"coupon_name = #{couponName,jdbcType=VARCHAR},",
"merchant_id = #{merchantId,jdbcType=BIGINT},",
"coupon_sales_code = #{couponSalesCode,jdbcType=VARCHAR},",
"coupon_code_id = #{couponCodeId,jdbcType=BIGINT},",
"user_id = #{userId,jdbcType=BIGINT},",
"user_phone = #{userPhone,jdbcType=VARCHAR},",
"order_no = #{orderNo,jdbcType=VARCHAR},",
"order_id = #{orderId,jdbcType=BIGINT},",
"child_order_id = #{childOrderId,jdbcType=BIGINT},",
"`type` = #{type,jdbcType=INTEGER},",
"receive_time = #{receiveTime,jdbcType=TIMESTAMP},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighCouponRecycle record);
} }

@ -234,6 +234,79 @@ public class HighCouponRecycleSqlProvider {
return sql.toString(); return sql.toString();
} }
public String updateByPrimaryKeySelective(HighCouponRecycle record) {
SQL sql = new SQL();
sql.UPDATE("high_coupon_recycle");
if (record.getCouponId() != null) {
sql.SET("coupon_id = #{couponId,jdbcType=BIGINT}");
}
if (record.getCouponName() != null) {
sql.SET("coupon_name = #{couponName,jdbcType=VARCHAR}");
}
if (record.getMerchantId() != null) {
sql.SET("merchant_id = #{merchantId,jdbcType=BIGINT}");
}
if (record.getCouponSalesCode() != null) {
sql.SET("coupon_sales_code = #{couponSalesCode,jdbcType=VARCHAR}");
}
if (record.getCouponCodeId() != null) {
sql.SET("coupon_code_id = #{couponCodeId,jdbcType=BIGINT}");
}
if (record.getUserId() != null) {
sql.SET("user_id = #{userId,jdbcType=BIGINT}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}");
}
if (record.getOrderNo() != null) {
sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}");
}
if (record.getOrderId() != null) {
sql.SET("order_id = #{orderId,jdbcType=BIGINT}");
}
if (record.getChildOrderId() != null) {
sql.SET("child_order_id = #{childOrderId,jdbcType=BIGINT}");
}
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getReceiveTime() != null) {
sql.SET("receive_time = #{receiveTime,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, HighCouponRecycleExample example, boolean includeExamplePhrase) { protected void applyWhere(SQL sql, HighCouponRecycleExample example, boolean includeExamplePhrase) {
if (example == null) { if (example == null) {
return; return;

@ -144,7 +144,7 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
@Override @Override
public List<HighDiscountUserRel> getExpiredDiscount() { public List<HighDiscountUserRel> getExpiredDiscount() {
HighDiscountUserRelExample example = new HighDiscountUserRelExample(); HighDiscountUserRelExample example = new HighDiscountUserRelExample();
example.createCriteria().andStatusEqualTo(1).andUseEndTimeGreaterThanOrEqualTo(new Date()); example.createCriteria().andStatusEqualTo(1).andUseEndTimeLessThanOrEqualTo(new Date());
return highDiscountUserRelMapper.selectByExample(example); return highDiscountUserRelMapper.selectByExample(example);
} }
} }

@ -55,7 +55,7 @@ public class HighUserCouponServiceImpl implements HighUserCouponService {
@Override @Override
public List<HighUserCoupon> getOverdueCoupon() { public List<HighUserCoupon> getOverdueCoupon() {
HighUserCouponExample example = new HighUserCouponExample(); HighUserCouponExample example = new HighUserCouponExample();
example.createCriteria().andStatusEqualTo(1).andUseEndTimeGreaterThanOrEqualTo(new Date()); example.createCriteria().andStatusEqualTo(1).andUseEndTimeLessThanOrEqualTo(new Date());
return highUserCouponMapper.selectByExample(example); return highUserCouponMapper.selectByExample(example);
} }
@ -181,8 +181,6 @@ public class HighUserCouponServiceImpl implements HighUserCouponService {
// 查询销售码 // 查询销售码
HighCouponCode couponCode = highCouponCodeService.getCouponCodeById(highUserCoupon.getCouponCodeId()); HighCouponCode couponCode = highCouponCodeService.getCouponCodeById(highUserCoupon.getCouponCodeId());
couponCode.setChildOrderId(null);
couponCode.setReceiveTime(null);
HighUser highUser = highUserService.findByUserId(highUserCoupon.getUserId()); HighUser highUser = highUserService.findByUserId(highUserCoupon.getUserId());
@ -190,7 +188,7 @@ public class HighUserCouponServiceImpl implements HighUserCouponService {
HighCoupon coupon = highCouponService.getCouponById(highUserCoupon.getCouponId()); HighCoupon coupon = highCouponService.getCouponById(highUserCoupon.getCouponId());
HighChildOrder childOrder = highOrderService.getChildOrderById(couponCode.getChildOrderId()); HighChildOrder childOrder = highOrderService.getChildOrderById(couponCode.getChildOrderId());
HighOrder order = highOrderService.getOrderById(childOrder.getId()); HighOrder order = highOrderService.getOrderById(childOrder.getOrderId());
// 归库记录 // 归库记录
HighCouponRecycle highCouponRecycle = new HighCouponRecycle(); HighCouponRecycle highCouponRecycle = new HighCouponRecycle();
@ -212,5 +210,9 @@ public class HighUserCouponServiceImpl implements HighUserCouponService {
highCouponRecycle.setReceiveTime(highUserCoupon.getCreateTime()); // 领取时间 highCouponRecycle.setReceiveTime(highUserCoupon.getCreateTime()); // 领取时间
highCouponRecycle.setCreateTime(new Date()); highCouponRecycle.setCreateTime(new Date());
highCouponRecycleService.insertCouponRecycle(highCouponRecycle); highCouponRecycleService.insertCouponRecycle(highCouponRecycle);
couponCode.setChildOrderId(null);
couponCode.setReceiveTime(null);
highCouponCodeService.updateCouponCode(couponCode);
} }
} }

Loading…
Cancel
Save