| | |
| | | import com.stylefeng.guns.modular.system.service.ISysCouponActivityService; |
| | | import com.stylefeng.guns.modular.system.service.ISysCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import com.stylefeng.guns.modular.system.util.WxMaSubscribeMessageUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | |
| | | @Autowired |
| | | private ISysCouponRecordService couponRecordService; |
| | | |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | |
| | | userCouponRecord.setCouponActivityId(sysCouponActivity.getId()); |
| | | userCouponRecord.setCouponId(sysCouponActivity.getCouponId()); |
| | | userCouponRecord.setActivityType(1); |
| | | |
| | | SysCouponRecord sysCouponRecord = couponRecordService.selectById(sysCouponActivity.getCouponId()); |
| | | |
| | | |
| | | |
| | | //判断发送类型1=全部用户,2=选择用户 |
| | | if(sysCouponActivity.getSendType()==1){ |
| | | Wrapper wrapper = new EntityWrapper<TUser>(); |
| | |
| | | userCouponRecord.setUserId(user.getId()); |
| | | for (int i=0;i<sysCouponActivity.getNumber();i++){ |
| | | userCouponRecord.insert(); |
| | | |
| | | // 订阅通知 |
| | | if(user.getOpenId()!=null){ |
| | | // 推送订阅消息 |
| | | WxMaSubscribeMessageUtil.push(user.getAppletsOpenId(),sysCouponRecord.getName(),sysCouponRecord.getMoney().doubleValue()); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | sysCouponActivity.setSendUserNum(list.size()); |
| | |
| | | userCouponRecord.setUserId(userId.getJSONObject(j).getInteger("userId")); |
| | | for (int i=0;i<sysCouponActivity.getNumber();i++){ |
| | | userCouponRecord.insert(); |
| | | TUser user = userService.selectById(userCouponRecord.getUserId()); |
| | | // 订阅通知 |
| | | if(user.getOpenId()!=null){ |
| | | // 推送订阅消息 |
| | | WxMaSubscribeMessageUtil.push(user.getAppletsOpenId(),sysCouponRecord.getName(),sysCouponRecord.getMoney().doubleValue()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | sysCouponActivity.setSendUserNum(userId.size()); |