| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
|
| | | import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponGiveRecordService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponCountService userSystemCouponCountService;
|
| | | |
| | | @Resource
|
| | | private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
|
| | |
|
| | | /**
|
| | | * 用户奖励券列表
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | long count = userSystemCouponCountService.countSystemCouponFree(key);
|
| | | long count = list.size();
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询赠送免券
|
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * @param type 1赠送免单券 、2-奖励券
|
| | | * @param state
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listGiveCoupon")
|
| | | public void listGiveCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer type,
|
| | | Integer state, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | | |
| | | String couponType = null;
|
| | | if (type != null) {
|
| | | if (type == 1) {
|
| | | couponType = "freeCouponGive";
|
| | | } else if (type == 2){
|
| | | couponType = "rebatePercentCoupon";
|
| | | } |
| | | }
|
| | |
|
| | | try {
|
| | | List<UserSystemCouponGiveRecord> list = userSystemCouponGiveRecordService.listGiveRecord((pageIndex - 1) * pageSize,
|
| | | pageSize, couponType, state);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = userSystemCouponGiveRecordService.countGiveRecord(couponType, state);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(list));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 奖励券数量曲线图
|
| | | * @param callback
|
| | |
| | | couponType = "freeCoupon";
|
| | | } else if (coupon == 2){
|
| | | couponType = "welfareFreeCoupon";
|
| | | } else if (coupon == 3){
|
| | | couponType = "freeCouponBuy";
|
| | | }
|
| | |
|
| | |
|
| | |
| | | */ |
| | | UserSystemCouponGiveRecord getByReceiveId(@Param("receiveId") Long receiveId); |
| | | |
| | | |
| | | /** |
| | | * 查询赠送记录 |
| | | * @param start |
| | | * @param count |
| | | * @param type |
| | | * @param state |
| | | * @return |
| | | */ |
| | | List<UserSystemCouponGiveRecord> listGiveRecord(@Param("start") long start, @Param("count") int count, |
| | | @Param("type") String type, @Param("state")Integer state); |
| | | |
| | | long countGiveRecord(@Param("type") String type, @Param("state")Integer state); |
| | | |
| | | } |
| | |
| | | @Column(name = "b_min_ios_version_code")
|
| | | private Integer minIOSVersionCode;
|
| | |
|
| | | //起始时间
|
| | | @Column(name = "b_start_time")
|
| | | private Date startTime;
|
| | | |
| | | //结束时间
|
| | | @Column(name = "b_end_time")
|
| | | private Date endTime;
|
| | | |
| | | // 创建时间
|
| | | @Column(name = "b_createtime")
|
| | | private Date createtime;
|
| | |
| | |
|
| | | // 限制最低版本
|
| | | private String version;
|
| | | |
| | | |
| | | // 是否定时
|
| | | private boolean timeTask;
|
| | | // 起始时间
|
| | | private String startTime_str;
|
| | | // 结束时间
|
| | | private String endTime_str;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | this.minIOSVersionCode = minIOSVersionCode;
|
| | | }
|
| | |
|
| | | public Date getStartTime() {
|
| | | return startTime;
|
| | | }
|
| | |
|
| | | public void setStartTime(Date startTime) {
|
| | | this.startTime = startTime;
|
| | | }
|
| | |
|
| | | public Date getEndTime() {
|
| | | return endTime;
|
| | | }
|
| | |
|
| | | public void setEndTime(Date endTime) {
|
| | | this.endTime = endTime;
|
| | | }
|
| | |
|
| | | public boolean isTimeTask() {
|
| | | return timeTask;
|
| | | }
|
| | |
|
| | | public void setTimeTask(boolean timeTask) {
|
| | | this.timeTask = timeTask;
|
| | | }
|
| | |
|
| | | public String getStartTime_str() {
|
| | | return startTime_str;
|
| | | }
|
| | |
|
| | | public void setStartTime_str(String startTime_str) {
|
| | | this.startTime_str = startTime_str;
|
| | | }
|
| | |
|
| | | public String getEndTime_str() {
|
| | | return endTime_str;
|
| | | }
|
| | |
|
| | | public void setEndTime_str(String endTime_str) {
|
| | | this.endTime_str = endTime_str;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | @Column(name = "cgr_state")
|
| | | private Integer state;
|
| | |
|
| | | // 券名称
|
| | | private String couponName;
|
| | | // 赠送人
|
| | | private String giveName;
|
| | | // 领取人
|
| | | private String receiveName;
|
| | | |
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | public void setReceiveId(Long receiveId) {
|
| | | this.receiveId = receiveId;
|
| | | }
|
| | |
|
| | | public String getCouponName() {
|
| | | return couponName;
|
| | | }
|
| | |
|
| | | public void setCouponName(String couponName) {
|
| | | this.couponName = couponName;
|
| | | }
|
| | |
|
| | | public String getGiveName() {
|
| | | return giveName;
|
| | | }
|
| | |
|
| | | public void setGiveName(String giveName) {
|
| | | this.giveName = giveName;
|
| | | }
|
| | |
|
| | | public String getReceiveName() {
|
| | | return receiveName;
|
| | | }
|
| | |
|
| | | public void setReceiveName(String receiveName) {
|
| | | this.receiveName = receiveName;
|
| | | }
|
| | | }
|
| | |
| | | <result column="b_remark" property="remark" jdbcType="VARCHAR" />
|
| | | <result column="b_min_android_version_code" property="minAndroidVersionCode" jdbcType="INTEGER"/>
|
| | | <result column="b_min_ios_version_code" property="minIOSVersionCode" jdbcType="INTEGER"/>
|
| | | <result column="b_start_time" property="startTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="b_end_time" property="endTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="b_createtime" property="createtime" jdbcType="TIMESTAMP" />
|
| | | <result column="b_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
|
| | |
|
| | |
| | | </association>
|
| | |
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_createtime,b_updatetime</sql>
|
| | | <sql id="Base_Column_List">b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_start_time,b_end_time,b_createtime,b_updatetime</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | |
| | | yeshi_ec_special where b_id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_special
|
| | | (b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_createtime,b_updatetime)
|
| | | (b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_start_time,b_end_time,b_createtime,b_updatetime)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{cardId,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{subPicture,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpLogin,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{orderMan,jdbcType=INTEGER},#{orderWoman,jdbcType=INTEGER},#{state,jdbcType=BIGINT},#{sex,jdbcType=INTEGER},#{showType,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{minAndroidVersionCode,jdbcType=INTEGER},#{minIOSVersionCode,jdbcType=INTEGER},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
|
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{cardId,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{subPicture,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpLogin,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{orderMan,jdbcType=INTEGER},#{orderWoman,jdbcType=INTEGER},#{state,jdbcType=BIGINT},#{sex,jdbcType=INTEGER},#{showType,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{minAndroidVersionCode,jdbcType=INTEGER},#{minIOSVersionCode,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_special
|
| | |
| | | <if test="remark != null">b_remark,</if>
|
| | | <if test="minAndroidVersionCode != null">b_min_android_version_code,</if>
|
| | | <if test="minIOSVersionCode != null">b_min_ios_version_code,</if>
|
| | | <if test="startTime != null">b_start_time,</if>
|
| | | <if test="endTime != null">b_end_time,</if>
|
| | | <if test="createtime != null">b_createtime,</if>
|
| | | <if test="updatetime != null">b_updatetime,</if>
|
| | | </trim>
|
| | |
| | | <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
|
| | | <if test="minAndroidVersionCode != null">#{minAndroidVersionCode,jdbcType=INTEGER},</if>
|
| | | <if test="minIOSVersionCode != null">#{minIOSVersionCode,jdbcType=INTEGER},</if>
|
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
|
| | | </trim>
|
| | |
| | | #{state,jdbcType=BIGINT},b_show_type =
|
| | | #{showType,jdbcType=VARCHAR},b_remark =
|
| | | #{remark,jdbcType=VARCHAR},b_min_android_version_code = #{minAndroidVersionCode,jdbcType=INTEGER},b_min_ios_version_code = #{minIOSVersionCode,jdbcType=INTEGER},
|
| | | b_createtime =
|
| | | b_start_time = #{startTime,jdbcType=TIMESTAMP},b_end_time = #{endTime,jdbcType=TIMESTAMP},b_createtime =
|
| | | #{createtime,jdbcType=TIMESTAMP},b_updatetime =
|
| | | #{updatetime,jdbcType=TIMESTAMP},b_sex=#{sex,jdbcType=INTEGER} where
|
| | | b_id = #{id,jdbcType=BIGINT}</update>
|
| | |
| | | <if test="remark != null">b_remark=#{remark,jdbcType=VARCHAR},</if>
|
| | | <if test="minAndroidVersionCode != null">b_min_android_version_code=#{minAndroidVersionCode,jdbcType=INTEGER},</if>
|
| | | <if test="minIOSVersionCode != null">b_min_ios_version_code=#{minIOSVersionCode,jdbcType=INTEGER},</if>
|
| | | <if test="startTime != null">b_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="endTime != null">b_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="createtime != null">b_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updatetime != null">b_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | |
| | | AND pc.`sp_key` = #{placeKey}
|
| | | LIMIT 1)c ON sp.`b_card_id` = c.`cd_id`
|
| | | WHERE sp.`b_state` = 0
|
| | | AND IF(sp.b_start_time IS NULL,TRUE, sp.b_start_time<![CDATA[<=]]> NOW()) |
| | | AND IF(sp.b_end_time IS NULL,TRUE, sp.b_end_time <![CDATA[>=]]> NOW())
|
| | | <include refid="Sex_Screen" />
|
| | | </select>
|
| | | </mapper>
|
| | |
| | | FROM `yeshi_ec_user_system_coupon` cp |
| | | )A |
| | | GROUP BY A.usc_coupon_id)B ON p.`sc_id` = B.usc_coupon_id |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon') |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon' OR p.`sc_type` = 'freeCouponBuy' OR p.`sc_type` = 'freeCouponGive')
|
| | | ORDER BY |
| | | <if test="sort == null">p.sc_id</if> |
| | | <if test="sort == 1">B.notUse</if> |
| | |
| | | SELECT * FROM `yeshi_ec_user_system_coupon` uc |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | LEFT JOIN (SELECT * FROM `yeshi_ec_user_system_coupon_record` d WHERE d.`ucr_state` = 2 or d.`ucr_state` = 3 )A ON A.`ucr_user_coupon_id` = uc.`usc_id` |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon') |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon' OR p.`sc_type` = 'freeCouponBuy')
|
| | | <if test="state != null"> |
| | | AND uc.usc_state = #{state} |
| | | </if> |
| | |
| | | <select id="countFreeCoupon" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | WHERE (p.`sc_type` = 'freeCoupon' or p.`sc_type` = 'welfareFreeCoupon') |
| | | WHERE (p.`sc_type` = 'freeCoupon' or p.`sc_type` = 'welfareFreeCoupon' OR p.`sc_type` = 'freeCouponBuy')
|
| | | <if test="state != null"> |
| | | AND uc.usc_state = #{state} |
| | | </if> |
| | |
| | | SELECT * FROM `yeshi_ec_user_system_coupon_record` d |
| | | LEFT JOIN `yeshi_ec_user_system_coupon` uc ON d.`ucr_user_coupon_id` = uc.`usc_id` |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon') |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon' OR p.`sc_type` = 'freeCouponBuy')
|
| | | <if test="state != null"> |
| | | AND d.`ucr_state` = #{state} |
| | | </if> |
| | |
| | | SELECT IFNULL(count(d.`ucr_id`),0) FROM `yeshi_ec_user_system_coupon_record` d |
| | | LEFT JOIN `yeshi_ec_user_system_coupon` uc ON d.`ucr_user_coupon_id` = uc.`usc_id` |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | WHERE (p.`sc_type` = 'freeCoupon' or p.`sc_type` = 'welfareFreeCoupon') |
| | | WHERE (p.`sc_type` = 'freeCoupon' or p.`sc_type` = 'welfareFreeCoupon' OR p.`sc_type` = 'freeCouponBuy')
|
| | | <if test="state != null"> |
| | | AND d.`ucr_state` = #{state} |
| | | </if> |
| | |
| | | </if> |
| | | ORDER BY v2.`hb_get_time` |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="cgr_receive_id" property="receiveId" jdbcType="BIGINT"/> |
| | | <result column="cgr_receive_time" property="receiveTime" jdbcType="TIMESTAMP"/> |
| | | <result column="cgr_state" property="state" jdbcType="INTEGER"/> |
| | | |
| | | <result column="couponName" property="couponName" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">cgr_id,cgr_coupon_id,cgr_give_uid,cgr_give_time,cgr_end_time,cgr_receive_uid,cgr_receive_id,cgr_receive_time,cgr_state</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | |
| | | WHERE d.cgr_receive_id = #{receiveId} |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="listGiveRecord" resultMap="BaseResultMap" > |
| | | SELECT g.*,p.`sc_name` AS couponName FROM `yeshi_ec_user_system_coupon_give_record` g |
| | | LEFT JOIN yeshi_ec_user_system_coupon c ON c.`usc_id` = g.`cgr_coupon_id` |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id` = c.`usc_coupon_id` |
| | | WHERE 1=1 |
| | | <if test="type != null">AND p.`sc_type` = #{type} </if> |
| | | <if test="state != null">AND g.`cgr_state` = #{state} </if> |
| | | ORDER BY g.`cgr_give_time` DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countGiveRecord" resultType="Long"> |
| | | SELECT IFNULL(COUNT(g.`cgr_id`),0) FROM `yeshi_ec_user_system_coupon_give_record` g |
| | | LEFT JOIN yeshi_ec_user_system_coupon c ON c.`usc_id` = g.`cgr_coupon_id` |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id` = c.`usc_coupon_id` |
| | | WHERE 1=1 |
| | | <if test="type != null">AND p.`sc_type` = #{type} </if> |
| | | <if test="state != null">AND g.`cgr_state` = #{state} </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
|
| | |
| | | }
|
| | |
|
| | | for (SystemCouponVO systemCouponVO: list) {
|
| | | BigDecimal money = null;
|
| | | if (systemCouponVO.getType() != CouponTypeEnum.freeCouponGive) |
| | | money = userSystemCouponCountMapper.countFreeMoneyByCouponId(systemCouponVO.getId());
|
| | |
|
| | | BigDecimal money = userSystemCouponCountMapper.countFreeMoneyByCouponId(systemCouponVO.getId());
|
| | | if (money == null) {
|
| | | if (money == null) |
| | | money = new BigDecimal(0);
|
| | | }
|
| | | |
| | | systemCouponVO.setMoney(money);
|
| | | }
|
| | | return list;
|
| | |
| | | package com.yeshi.fanli.service.impl.homemodule;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.exception.homemodule.HomeNavbarException;
|
| | | import com.yeshi.fanli.exception.homemodule.SpecialException;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | |
| | | throw new SpecialException(1, "跳转参数非JSON格式");
|
| | | }
|
| | |
|
| | | String startTime_str = record.getStartTime_str();
|
| | | if (record.isTimeTask() && (startTime_str == null || startTime_str.length() == 0)) {
|
| | | throw new SpecialException(1, "控制时间不能为空");
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(jumpType)) {
|
| | | List<JumpDetailV2> listByType = jumpDetailV2Service.listByType(jumpType);
|
| | | if (listByType != null && listByType.size() > 0) {
|
| | | record.setJumpDetail(listByType.get(0));
|
| | | }
|
| | | }
|
| | | |
| | | // 时间转换
|
| | | conversionTime(record);
|
| | |
|
| | | Long state = record.getState();
|
| | | if (state == null) {
|
| | |
| | |
|
| | | record.setUpdatetime(new Date());
|
| | | specialMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * web段时间转换
|
| | | * @param record
|
| | | */
|
| | | public void conversionTime(Special record) throws SpecialException, Exception {
|
| | | // 是否时间控制
|
| | | if(!record.isTimeTask()) {
|
| | | record.setStartTime(null);
|
| | | record.setEndTime(null);
|
| | | } else {
|
| | | String startTime_str = record.getStartTime_str();
|
| | | String endTime_str = record.getEndTime_str();
|
| | | |
| | | if ((startTime_str == null|| startTime_str.trim().length() == 0) |
| | | && (endTime_str == null || endTime_str.trim().length() == 0)) {
|
| | | throw new HomeNavbarException(1, "请输入控制时间");
|
| | | } else {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
| | | if (startTime_str != null && startTime_str.trim().length() > 0) {
|
| | | startTime_str = startTime_str.replaceAll("T", " ");
|
| | | record.setStartTime(format.parse(startTime_str));
|
| | | }
|
| | | |
| | | if (endTime_str != null && endTime_str.trim().length() > 0) {
|
| | | endTime_str = endTime_str.replaceAll("T", " ");
|
| | | record.setEndTime(format.parse(endTime_str));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | // 跳转链接
|
| | | for (Special special : list) {
|
| | | |
| | | Date startTime = special.getStartTime();
|
| | | Date endTime = special.getEndTime();
|
| | | |
| | | if (startTime == null && endTime == null) {
|
| | | special.setTimeTask(false);
|
| | | special.setStartTime_str("");
|
| | | special.setEndTime_str("");
|
| | | } else {
|
| | | special.setTimeTask(true);
|
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
|
| | | if (startTime == null) {
|
| | | special.setStartTime_str("");
|
| | | } else {
|
| | | special.setStartTime_str(sdf.format(startTime));
|
| | | }
|
| | | |
| | | if (endTime == null) {
|
| | | special.setEndTime_str("");
|
| | | } else {
|
| | | special.setEndTime_str(sdf.format(endTime));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | String params = special.getParams();
|
| | | if (StringUtil.isNullOrEmpty(params)) {
|
| | | special.setParams("");
|
| | |
| | | }
|
| | |
|
| | | // 获取微信信息
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code);
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code);
|
| | | if (weiXinUser == null) {
|
| | | throw new UserInfoExtraException(1, "微信授权失败");
|
| | | }
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponGiveRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponGiveRecordService;
|
| | |
|
| | | @Service
|
| | |
| | | @Resource
|
| | | private UserSystemCouponGiveRecordMapper userSystemCouponGiveRecordMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Override
|
| | | public void insertSelective(UserSystemCouponGiveRecord record) {
|
| | |
| | | public UserSystemCouponGiveRecord getByReceiveId(Long receiveId) {
|
| | | return userSystemCouponGiveRecordMapper.getByReceiveId(receiveId);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<UserSystemCouponGiveRecord> listGiveRecord(long start, int count, String type, Integer state) {
|
| | | List<UserSystemCouponGiveRecord> list = userSystemCouponGiveRecordMapper.listGiveRecord(start, count, type, state);
|
| | | if (list == null || list.size() == 0) |
| | | return list;
|
| | | |
| | | for (UserSystemCouponGiveRecord giveRecord: list) {
|
| | | UserInfo giveUser = userInfoService.selectByPKey(giveRecord.getGiveUid());
|
| | | if (giveUser != null) |
| | | giveRecord.setGiveName(giveUser.getNickName());
|
| | | |
| | | Long receiveUid = giveRecord.getReceiveUid();
|
| | | if (receiveUid == null)
|
| | | continue;
|
| | | |
| | | UserInfo receiveUser = userInfoService.selectByPKey(receiveUid);
|
| | | if (receiveUser != null) |
| | | giveRecord.setReceiveName(receiveUser.getNickName());
|
| | | }
|
| | | return list;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public long countGiveRecord(String type, Integer state) {
|
| | | return userSystemCouponGiveRecordMapper.countGiveRecord(type, state);
|
| | | }
|
| | | }
|
| | |
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | UserSystemCouponGiveRecord getByReceiveId(Long receiveId);
|
| | | public UserSystemCouponGiveRecord getByReceiveId(Long receiveId);
|
| | |
|
| | | |
| | | /**
|
| | | * 查询赠送记录
|
| | | * @param start
|
| | | * @param count
|
| | | * @param type
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | public List<UserSystemCouponGiveRecord> listGiveRecord(long start, int count, String type, Integer state);
|
| | |
|
| | | public long countGiveRecord(String type, Integer state);
|
| | |
|
| | | }
|