Merge remote-tracking branch 'origin/master'
| | |
| | | package com.yeshi.fanli.controller.client;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | |
| | | @Controller
|
| | | @RequestMapping("api/v1/user/coupon")
|
| | | public class UserCouponController {
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | // 更新福利中心未读数量
|
| | | if (page == 1) {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | // 未读券是否大于0
|
| | | if (userInfoExtra != null && userInfoExtra.getCouponNews() > 0) {
|
| | | userInfoExtra.setCouponNews(0);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(userInfoExtra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.common.Config;
|
| | |
| | | }
|
| | |
|
| | | data.put("moduleState", mySettings);
|
| | |
|
| | | |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(user.getId());
|
| | | if (userInfoExtra == null) {
|
| | | data.put("welfareCenterNews", 0);
|
| | | } else {
|
| | | data.put("welfareCenterNews", userInfoExtra.getCouponNews());
|
| | | }
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | | final UserInfo uuser = user;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | |
| | | @Column(name = "uie_lottery_newbies")
|
| | | private Integer lotteryNewbies;
|
| | |
|
| | | // 券未读数量
|
| | | @Column(name = "uie_coupon_news")
|
| | | private Integer couponNews;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "uie_create_time")
|
| | |
| | | public void setLotteryNewbies(Integer lotteryNewbies) {
|
| | | this.lotteryNewbies = lotteryNewbies;
|
| | | }
|
| | |
|
| | | public Integer getCouponNews() {
|
| | | return couponNews;
|
| | | }
|
| | |
|
| | | public void setCouponNews(Integer couponNews) {
|
| | | this.couponNews = couponNews;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/> |
| | | <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/> |
| | | <result column="uie_coupon_news" property="couponNews" jdbcType="INTEGER"/> |
| | | <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | |
| | | <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/> |
| | | <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/> |
| | | <result column="uie_coupon_news" property="couponNews" jdbcType="INTEGER"/> |
| | | <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_create_time,uie_update_time</sql> |
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_create_time,uie_update_time</sql> |
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT} |
| | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}</delete> |
| | | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="rankUpdateTime != null">uie_rank_update_time,</if> |
| | | <if test="inviteCode != null">uie_invite_code,</if> |
| | | <if test="lotteryNewbies != null">uie_lottery_newbies,</if> |
| | | <if test="couponNews != null">uie_coupon_news,</if> |
| | | <if test="createTime != null">uie_create_time,</if> |
| | | <if test="updateTime != null">uie_update_time,</if> |
| | | </trim>values |
| | |
| | | <if test="rankUpdateTime != null">#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">#{inviteCode,jdbcType=VARCHAR},</if> |
| | | <if test="lotteryNewbies != null">#{lotteryNewbies,jdbcType=INTEGER},</if> |
| | | <if test="couponNews != null">#{couponNews,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_invite_code = #{inviteCode,jdbcType=VARCHAR},uie_lottery_newbies = #{lotteryNewbies,jdbcType=INTEGER},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_invite_code = #{inviteCode,jdbcType=VARCHAR},uie_lottery_newbies = #{lotteryNewbies,jdbcType=INTEGER},uie_coupon_news = #{couponNews,jdbcType=INTEGER},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra |
| | | <set> |
| | | <if test="userInfo != null">uie_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | |
| | | <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if> |
| | | <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},</if> |
| | | <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where uie_id = #{id,jdbcType=BIGINT} |
| | |
| | | <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if> |
| | | <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},</if> |
| | | <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where uie_uid = #{userInfo.id,jdbcType=BIGINT} |
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | |
| | | @Service
|
| | | public class UserSystemCouponServiceImpl implements UserSystemCouponService {
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | | @Resource
|
| | | private UserSystemCouponMapper userSystemCouponMapper;
|
| | |
|
| | |
| | | // 插入数据库
|
| | | insertSelective(userCoupon);
|
| | |
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | // 添加一条消息
|
| | | if (userInfoExtra != null) {
|
| | | userInfoExtra.setCouponNews(userInfoExtra.getCouponNews() + 1);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(userInfoExtra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | });
|
| | |
|
| | | // 消息推送
|
| | | try {
|