diff --git a/hai-bweb/src/main/java/com/bweb/controller/CmsContentController.java b/hai-bweb/src/main/java/com/bweb/controller/CmsContentController.java index 5c82b985..55c65353 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/CmsContentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/CmsContentController.java @@ -216,6 +216,8 @@ public class CmsContentController { } } + + @RequestMapping(value = "/updateStatusOfContent", method = RequestMethod.POST) @ApiOperation(value = "更新 内容发布状态") @ResponseBody diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java index eabb1b6d..b4d9072a 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java @@ -27,6 +27,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -60,6 +61,9 @@ public class HighDiscountPackageController { @Resource private HighDiscountPackageRecordService discountPackageRecordService; + @Resource + private HighDiscountPackageActualService discountPackageActualService; + @RequestMapping(value = "/getDiscountPackageList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取优惠券包列表") @@ -83,7 +87,14 @@ public class HighDiscountPackageController { map.put("salesType" , salesType); map.put("status" , status); PageHelper.startPage(pageNum,pageSize); - return ResponseMsgUtil.success(new PageInfo<>(highDiscountPackageService.getDiscountPackageList(map))); + + List list = highDiscountPackageService.getDiscountPackageList(map); + + for (HighDiscountPackage data : list) { + data.setSurplusStock(discountPackageActualService.getDiscountPackageNum(data.getId()).intValue()); + } + + return ResponseMsgUtil.success(new PageInfo<>(list)); } catch (Exception e) { log.error("HighOrderController --> getUserOrderList() error!", e); @@ -115,6 +126,7 @@ public class HighDiscountPackageController { map.put("recordNo" , recordNo); map.put("phone" , phone); map.put("salesType" , salesType); + PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(highDiscountPackageService.getDiscountPackageRecordList(map))); @@ -136,9 +148,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null -// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) -// || StringUtils.isBlank(highDiscountPackage.getListImg()) -// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) + || StringUtils.isBlank(highDiscountPackage.getBannerImg()) + || StringUtils.isBlank(highDiscountPackage.getListImg()) + || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> insertCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -429,7 +441,7 @@ public class HighDiscountPackageController { throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); } - if (highDiscountPackage.getSurplusStock() == null || highDiscountPackage.getSurplusStock() == 0 ) { + if (discountPackageActualService.getDiscountPackageNum(object.getInteger("discountPackageId")) == 0 ) { log.error("highCouponPackage -> upDiscountPackage() error!","当前库存不足"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前库存不足"); } diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index dc3ea8d9..76b425c3 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -74,6 +74,8 @@ public class HighOrderController { @Resource private HighDiscountPackageActualService discountPackageActualService; + + @Resource private HighUserService highUserService; @@ -243,6 +245,7 @@ public class HighOrderController { if (childOrder.getGoodsType() == 7) { // 查询优惠券包 HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(childOrder.getGoodsId().intValue()); + if (discountPackage == null) { log.error("HighOrderController --> addOrder() error!", ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到优惠券包"); @@ -255,6 +258,12 @@ public class HighOrderController { log.error("HighOrderController --> addOrder() error!", ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "库存数量不足"); } + + if (discountPackage.getPurchaseNum() < discountPackageActualService.userPurchaseByUserId(userInfoModel.getHighUser().getId().intValue(), discountPackage.getId())) { + log.error("HighOrderController --> addOrder() error!", ""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "超过购买限制"); + } + childOrder.setGoodsActualPrice(childOrder.getGoodsPrice()); childOrder.setGoodsName(discountPackage.getTitle()); childOrder.setGoodsImg(discountPackage.getListImg()); diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 32b48835..745404ff 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -6,8 +6,10 @@ import com.hai.config.QianZhuConfig; import com.hai.config.WxOrderConfig; import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; +import com.hai.entity.OutRechargeOrder; import com.hai.model.OrderRefundModel; import com.hai.service.HighOrderService; +import com.hai.service.OutRechargeOrderService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Configuration; @@ -33,6 +35,9 @@ public class HighOrderSchedule { @Resource private HighOrderService highOrderService; + @Resource + private OutRechargeOrderService outRechargeOrderService; + /** * @Author 胡锐 * @Description 取消订单 15分钟 @@ -52,6 +57,28 @@ public class HighOrderSchedule { } } + /** + * @Author Sum1Dream + * @name cancelMobileOrder.java + * @Description // 取消话费订单 + * @Date 3:33 下午 2021/12/10 + * @Param [] + * @return void + */ + @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + public void cancelMobileOrder() { + List orderList = outRechargeOrderService.getOutRechargeOrderList(); + if (orderList != null && orderList.size() > 0) { + for (OutRechargeOrder order : orderList) { + try { + outRechargeOrderService.cancelOrder(order.getId()); + } catch (Exception e) { + log.error("HighCouponSchedule --> expiredCoupon() error!", e); + } + } + } + } + /** * @Author 胡锐 * @Description 处理话费充值订单 diff --git a/hai-schedule/src/main/resources/dev/application.yml b/hai-schedule/src/main/resources/dev/application.yml index b3da0b6b..87a928d3 100644 --- a/hai-schedule/src/main/resources/dev/application.yml +++ b/hai-schedule/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 + url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/hai-service/src/main/java/com/hai/dao/CmsContentMapperExt.java b/hai-service/src/main/java/com/hai/dao/CmsContentMapperExt.java index 82f62645..1e78cfbd 100644 --- a/hai-service/src/main/java/com/hai/dao/CmsContentMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/CmsContentMapperExt.java @@ -44,7 +44,7 @@ public interface CmsContentMapperExt { " AND cc.status = #{status}", " ", "", - "ORDER BY cc.sort_id ASC, cc.update_time DESC, cc.create_time DESC", + "ORDER BY cc.category_code", "" }) @Results({ diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java index 37ff0874..3002b4b1 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java @@ -1,6 +1,8 @@ package com.hai.dao; +import com.hai.entity.HighOrder; +import com.hai.entity.OutRechargeOrder; import com.hai.model.OutOrderModel; import com.hai.model.OutRechargeOrderModel; import com.hai.model.OutUserOrderModel; @@ -101,4 +103,40 @@ public interface OutRechargeOrderMapperExt { "" }) List selectOrderCount(@Param("map") Map map); + + + @Select({"SELECT * FROM out_recharge_order ho WHERE TIMESTAMPDIFF(MINUTE,ho.create_timed,SYSDATE()) > 15 AND ho.status = 1"}) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="mem_discount_id", property="memDiscountId", jdbcType=JdbcType.BIGINT), + @Result(column="mem_discount_name", property="memDiscountName", jdbcType=JdbcType.VARCHAR), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR), + @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_model", property="rechargeModel", jdbcType=JdbcType.INTEGER), + @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), + @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="order_price", property="orderPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="recharge_content", property="rechargeContent", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="id_card", property="idCard", jdbcType=JdbcType.VARCHAR), + @Result(column="create_timed", property="createTimed", jdbcType=JdbcType.TIMESTAMP), + @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), + @Result(column="out_refund_no", property="outRefundNo", jdbcType=JdbcType.VARCHAR), + @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="refund_id", property="refundId", jdbcType=JdbcType.VARCHAR), + @Result(column="refund_fee", property="refundFee", jdbcType=JdbcType.DECIMAL), + @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.INTEGER), + @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT) + }) + List getCloseOrder(); } diff --git a/hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java b/hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java index 3d23abe2..4ed49461 100644 --- a/hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java +++ b/hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java @@ -69,4 +69,24 @@ public interface HighDiscountPackageActualService { */ List getListByPackageId(Integer packageId, Integer status); + /** + * @Author Sum1Dream + * @name getDiscountPackageNum.java + * @Description // 获取优惠券包实际库存数量 + * @Date 9:59 上午 2021/12/10 + * @Param [java.lang.Integer] + * @return java.lang.Integer + */ + Long getDiscountPackageNum(Integer discountPackageId); + + /** + * @Author Sum1Dream + * @name userPurchaseByUserId.java + * @Description // 查询用户是否限购 + * @Date 5:09 下午 2021/12/10 + * @Param [java.lang.Integer, java.lang.Integer] + * @return java.lang.Long + */ + Long userPurchaseByUserId(Integer userId , Integer discountPackage); + } diff --git a/hai-service/src/main/java/com/hai/service/HighDiscountPackageDetailsService.java b/hai-service/src/main/java/com/hai/service/HighDiscountPackageDetailsService.java index a2f4159b..79bd17c8 100644 --- a/hai-service/src/main/java/com/hai/service/HighDiscountPackageDetailsService.java +++ b/hai-service/src/main/java/com/hai/service/HighDiscountPackageDetailsService.java @@ -1,6 +1,7 @@ package com.hai.service; import com.hai.entity.HighDiscount; +import com.hai.entity.HighDiscountPackageActual; import com.hai.entity.HighDiscountPackageDetails; import java.util.List; @@ -62,4 +63,7 @@ public interface HighDiscountPackageDetailsService { */ void updateDiscountPackageDetails(HighDiscountPackageDetails highDiscountPackageDetails); + + + } diff --git a/hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java b/hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java index 4b5c0527..7fe0e5c5 100644 --- a/hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java +++ b/hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java @@ -89,5 +89,4 @@ public interface HighDiscountPackageService { */ void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel , Integer num); - } diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java index be1f0076..2ee2d377 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java @@ -120,4 +120,15 @@ public interface OutRechargeOrderService { * @param orderId */ void goldPayOrder(Long userId, Long orderId); + + /** + * @Author Sum1Dream + * @name getOutRechargeOrderList.java + * @Description // 查询话费充值超过15分钟订单 + * @Date 3:34 下午 2021/12/10 + * @Param [] + * @return java.util.List + */ + List getOutRechargeOrderList(); + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index cba36210..b2f7d568 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -380,7 +380,7 @@ public class HighCouponServiceImpl implements HighCouponService { criteria.andCouponSourceNotEqualTo(MapUtils.getInteger(map, "notCouponSource")); } - example.setOrderByClause("create_time desc"); + example.setOrderByClause("display_area desc"); List coupons = highCouponMapper.selectByExample(example); if (coupons != null && coupons.size() > 0) { for (HighCoupon highCoupon : coupons) { diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java index 78b2586b..9caf932e 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java @@ -10,6 +10,7 @@ import com.hai.service.HighDiscountPackageActualService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -79,4 +80,22 @@ public class HighDiscountPackageActualServiceImpl implements HighDiscountPackage example.setOrderByClause("created_time"); return discountPackageActualMapper.selectByExample(example); } + + @Override + public Long getDiscountPackageNum(Integer discountPackageId) { + HighDiscountPackageActualExample example = new HighDiscountPackageActualExample(); + HighDiscountPackageActualExample.Criteria criteria = example.createCriteria(); + criteria.andDiscountPackageIdEqualTo(discountPackageId).andStatusEqualTo(1); + return discountPackageActualMapper.countByExample(example); + } + + @Override + public Long userPurchaseByUserId(Integer userId, Integer discountPackage) { + List statusList = new ArrayList<>(); + statusList.add(2); + statusList.add(3); + HighDiscountPackageActualExample example = new HighDiscountPackageActualExample(); + example.createCriteria().andDiscountPackageIdEqualTo(discountPackage).andUserIdEqualTo(userId).andStatusIn(statusList); + return discountPackageActualMapper.countByExample(example); + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageDetailsServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageDetailsServiceImpl.java index 18f37756..4fbb190f 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageDetailsServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageDetailsServiceImpl.java @@ -66,4 +66,5 @@ public class HighDiscountPackageDetailsServiceImpl implements HighDiscountPackag public void updateDiscountPackageDetails(HighDiscountPackageDetails highDiscountPackageDetails) { highDiscountPackageDetailsMapper.updateByPrimaryKey(highDiscountPackageDetails); } + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java index d14b45ad..bb336378 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java @@ -222,4 +222,5 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic highDiscountPackage.setTotalStock(totalStock + num); highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage); } + } diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index cb15c5ec..30396e80 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -340,4 +340,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { order.setPayTime(new Date()); // 支付时间 updateOrder(order); } + + @Override + public List getOutRechargeOrderList() { + return outRechargeOrderMapper.getCloseOrder(); + } }