| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.dto.vip.UserVIPLevel;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | /**
|
| | | * 查询开通记录
|
| | |
| | | }
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 设置状态
|
| | | *
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 删除云发单备选库
|
| | | *
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | CloudOrderMenuEnum typeEnum = CloudOrderMenuEnum.valueOf(type);
|
| | | if (typeEnum == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "套餐选择出错"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (typeEnum == CloudOrderMenuEnum.robotMonthVip) {
|
| | | UserVIPPreInfo vip = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vip == null || vip.getProcess() < UserVIPLevel.LEVEL_7) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户等级不满足"));
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | // 创建支付信息
|
| | | String alipayForm = userCloudAlipayManager.getAlipayForm(uid, type);
|
| | |
|
| | |
| | |
|
| | | /**
|
| | | * 动态一键发单
|
| | | *
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | |
| | |
|
| | | /**
|
| | | * 商品详情一键发单
|
| | | *
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | |
| | | * @return |
| | | */ |
| | | UserCloudOrder selectForUpdate(long id); |
| | | |
| | | /** |
| | | * 检索 |
| | | * @param type |
| | | * @param uid |
| | | * @param state |
| | | * @return |
| | | */ |
| | | List<UserCloudOrder> list(@Param("type") String type,@Param("uid")Long uid, @Param("state")boolean state); |
| | | |
| | | /** |
| | | * 查询后一条支付完成的 |
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | public enum CloudOrderMenuEnum {
|
| | | robotMonth(20, 4, 1, "全能机器人", "一个月");
|
| | | robotMonth(20, 4, 1, "全能机器人", "月卡"),//全价
|
| | | robotMonthHalfPrice(10, 4, 1, "全能机器人", "月卡"),//半价
|
| | | robotMonthVip(0.01, 4, 1, "全能机器人", "月卡");//会员价
|
| | |
|
| | | private double money;
|
| | | private Integer robotType;
|
| | |
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.cloud.UserCloudOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.cloud.UserCloudService;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | |
|
| | | @Service
|
| | |
| | | private UserCloudService userCloudService;
|
| | |
|
| | |
|
| | | |
| | | @Transactional
|
| | | @Override
|
| | | public UserCloudOrder addCloudOrder(Long uid, String type) throws UserCloudOrderException{
|
| | | if (uid == null)
|
| | |
| | | if (menuEnum == null)
|
| | | throw new UserCloudOrderException(1, "请选择正确套餐");
|
| | |
|
| | | if (menuEnum == CloudOrderMenuEnum.robotMonthHalfPrice || menuEnum == CloudOrderMenuEnum.robotMonthVip) {
|
| | | List<UserCloudOrder> list = userCloudOrderMapper.list(menuEnum.name(), uid, true);
|
| | | if (list != null && list.size() > 0)
|
| | | throw new UserCloudOrderException(1, "只能购买一次");
|
| | | }
|
| | | UserCloudOrder cloudOrder = new UserCloudOrder();
|
| | | cloudOrder.setUid(uid);
|
| | | cloudOrder.setState(false);
|
| | |
| | | <result column="crd_desc" property="desc" jdbcType="VARCHAR"/> |
| | | <result column="crd_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="crd_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="crd_type" property="type" typeHandler="com.yeshi.fanli.util.mybatishandler.CloudOrderMenuEnumHandler"/> |
| | | <result column="crd_type" property="type" |
| | | typeHandler="com.yeshi.fanli.util.mybatishandler.CloudOrderMenuEnumHandler"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">crd_id,crd_uid,crd_money,crd_type,crd_state,crd_desc,crd_create_time,crd_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_cloud_order where crd_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_cloud_order where crd_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud_order (crd_id,crd_uid,crd_money,crd_type,crd_state,crd_desc,crd_create_time,crd_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=VARCHAR},#{state,jdbcType=BOOLEAN},#{desc,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud_order |
| | | <delete id="deleteByPrimaryKey" |
| | | parameterType="java.lang.Long">delete from yeshi_ec_user_cloud_order where crd_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder" useGeneratedKeys="true" |
| | | keyProperty="id">insert into yeshi_ec_user_cloud_order (crd_id,crd_uid,crd_money,crd_type,crd_state,crd_desc,crd_create_time,crd_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=VARCHAR},#{state,jdbcType=BOOLEAN},#{desc,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">crd_id,</if> |
| | | <if test="uid != null">crd_uid,</if> |
| | |
| | | <if test="desc != null">crd_desc,</if> |
| | | <if test="createTime != null">crd_create_time,</if> |
| | | <if test="updateTime != null">crd_update_time,</if> |
| | | </trim>values |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder">update yeshi_ec_user_cloud_order set crd_uid = #{uid,jdbcType=BIGINT},crd_money = #{money,jdbcType=DECIMAL},crd_type = #{type,jdbcType=VARCHAR},crd_state = #{state,jdbcType=BOOLEAN},crd_desc = #{desc,jdbcType=VARCHAR},crd_create_time = #{createTime,jdbcType=TIMESTAMP},crd_update_time = #{updateTime,jdbcType=TIMESTAMP} where crd_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder">update yeshi_ec_user_cloud_order |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder">update yeshi_ec_user_cloud_order set crd_uid = #{uid,jdbcType=BIGINT},crd_money = #{money,jdbcType=DECIMAL},crd_type = #{type,jdbcType=VARCHAR},crd_state = #{state,jdbcType=BOOLEAN},crd_desc = #{desc,jdbcType=VARCHAR},crd_create_time = #{createTime,jdbcType=TIMESTAMP},crd_update_time = #{updateTime,jdbcType=TIMESTAMP} where crd_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder">update |
| | | yeshi_ec_user_cloud_order |
| | | <set> |
| | | <if test="uid != null">crd_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="money != null">crd_money=#{money,jdbcType=DECIMAL},</if> |
| | |
| | | <if test="desc != null">crd_desc=#{desc,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">crd_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">crd_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where crd_id = #{id,jdbcType=BIGINT} |
| | | </set> |
| | | where crd_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="selectForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | SELECT * from yeshi_ec_user_cloud_order where crd_id = #{id,jdbcType=BIGINT} FOR UPDATE |
| | | </select> |
| | | |
| | | <select id="list" resultMap="BaseResultMap"> |
| | | SELECT * from yeshi_ec_user_cloud_order where 1=1 |
| | | <if test="type!=null"> |
| | | |
| | | and crd_type=#{type} |
| | | </if> |
| | | |
| | | <if test="uid!=null"> |
| | | |
| | | and crd_uid=#{uid} |
| | | </if> |
| | | |
| | | <if test="state!=null"> |
| | | |
| | | and crd_state=#{state} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getLastOrderByPayEnd" resultMap="BaseResultMap"> |
| | |
| | | </select> |
| | | |
| | | <select id="getLastOrderByUnpaid" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List"/> FROM yeshi_ec_user_cloud_order d |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM yeshi_ec_user_cloud_order d |
| | | WHERE d.`crd_uid` = #{uid} AND d.`crd_type` = #{type} AND crd_state = 0 |
| | | ORDER BY d.`crd_id` DESC |
| | | LIMIT 1 |
| | |
| | | |
| | | <select id="getOrderRecord" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_cloud_order d |
| | | WHERE d.`crd_uid` = #{uid} <if test="state != null">and d.crd_state = #{state}</if> |
| | | WHERE d.`crd_uid` = #{uid} |
| | | <if test="state != null">and d.crd_state = #{state}</if> |
| | | ORDER BY d.`crd_id` DESC |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countOrderRecord" resultType="Long"> |
| | | SELECT count(d.`crd_id`) FROM yeshi_ec_user_cloud_order d |
| | | WHERE d.`crd_uid` = #{uid} <if test="state != null">and d.crd_state = #{state}</if> |
| | | WHERE d.`crd_uid` = #{uid} |
| | | <if test="state != null">and d.crd_state = #{state}</if> |
| | | </select> |
| | | |
| | | <select id="getLasthourByUnpaid" resultMap="BaseResultMap"> |