| @@ -92,6 +92,28 @@ public class WxCouponPasswordController extends BaseController { | |||||
| final PageInfo<WxCouponPasswordVo> page = wxCouponPasswordService.listVoAsPage(wxCouponPassword, pageNum, pageSize); | final PageInfo<WxCouponPasswordVo> page = wxCouponPasswordService.listVoAsPage(wxCouponPassword, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("启用/停用") | |||||
| @PostMapping("/startOrStop") | |||||
| @SystemControllerLog(description = "启用/停用") | |||||
| public ResultData startOrStop(@RequestBody WxCouponPassword wxCouponPassword) { | |||||
| // | |||||
| if (wxCouponPassword.getCouponId() == null) { | |||||
| logger.error("couponId不能为空: "); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCouponPassword couponPassword = new WxCouponPassword(); | |||||
| couponPassword.updateTenantInfo(getTenantInfo()); | |||||
| couponPassword.setCouponId(wxCouponPassword.getCouponId()); | |||||
| couponPassword.setExpireDate(wxCouponPassword.getExpireDate()); | |||||
| try { | |||||
| wxCouponPasswordService.postpone(couponPassword); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.COUPON_PASSWORD_POSTPONE_ERR); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||
| @@ -3,7 +3,7 @@ alter table wx_card_info add column c_user_id bigint(20) comment '购买用户 | |||||
| alter table wx_card_info add column owner_user_id bigint(20) comment '持有用户编码'; | alter table wx_card_info add column owner_user_id bigint(20) comment '持有用户编码'; | ||||
| alter table wx_card_info add column status int(1) not null default 0 comment '状态'; | alter table wx_card_info add column status int(1) not null default 0 comment '状态'; | ||||
| ###待做####### | |||||
| ###待做wx_card_info####### | |||||
| ##coupon_password_id,coupon_password,c_user_id,owner_user_id 刷数据,后两者不能为空 | ##coupon_password_id,coupon_password,c_user_id,owner_user_id 刷数据,后两者不能为空 | ||||
| # 转赠验证wx_coupon_order的c_user_id不变 | # 转赠验证wx_coupon_order的c_user_id不变 | ||||
| @@ -14,6 +14,9 @@ alter table wx_card_info add column status int(1) not null default 0 comment ' | |||||
| #set ci.c_user_id = co.c_user_id, ci.owner_user_id = co.owner_id | #set ci.c_user_id = co.c_user_id, ci.owner_user_id = co.owner_id | ||||
| alter table wx_coupon_password add column is_stop int(1) not null default 0 comment '是否已停止1-是,0-否'; | |||||
| @@ -17,7 +17,8 @@ public class WxCouponPassword extends TenantEntity { | |||||
| @Excel(name = "ID", width = 20, orderNum = "1") | @Excel(name = "ID", width = 20, orderNum = "1") | ||||
| protected Long id; | protected Long id; | ||||
| @TableField(exist = false) | |||||
| private String idLike; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卡券ID",name="couponId") | @io.swagger.annotations.ApiModelProperty(value="卡券ID",name="couponId") | ||||
| private Long couponId; | private Long couponId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="卡券短ID",name="couponShort") | @io.swagger.annotations.ApiModelProperty(value="卡券短ID",name="couponShort") | ||||
| @@ -25,6 +26,8 @@ public class WxCouponPassword extends TenantEntity { | |||||
| @Excel(name = "兑换码", width = 20, orderNum = "2") | @Excel(name = "兑换码", width = 20, orderNum = "2") | ||||
| @io.swagger.annotations.ApiModelProperty(value="商户名称",name="password") | @io.swagger.annotations.ApiModelProperty(value="商户名称",name="password") | ||||
| private String password; | private String password; | ||||
| @TableField(exist = false) | |||||
| private String passwordLike; | |||||
| @Excel(name = "状态", width = 20, replace = {"初始_0", "发送中_1", "已发出_2", "已使用_3", "不可用_4"}, orderNum = "4") | @Excel(name = "状态", width = 20, replace = {"初始_0", "发送中_1", "已发出_2", "已使用_3", "不可用_4"}, orderNum = "4") | ||||
| @io.swagger.annotations.ApiModelProperty(value="卡密状态: 0初始1信息发出中2信息已发出3已使用4已过期",name="status") | @io.swagger.annotations.ApiModelProperty(value="卡密状态: 0初始1信息发出中2信息已发出3已使用4已过期",name="status") | ||||
| private Integer status; | private Integer status; | ||||
| @@ -44,6 +47,9 @@ public class WxCouponPassword extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "发放ID", name = "presentId") | @io.swagger.annotations.ApiModelProperty(value = "发放ID", name = "presentId") | ||||
| private Long presentId; | private Long presentId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="是否已停止EnumYesOrNo",name="isStop") | |||||
| private Integer isStop; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String statusStr; | private String statusStr; | ||||
| @@ -75,4 +75,6 @@ public interface WxCouponPasswordService { | |||||
| List<WxCouponPassword> findList(WxCouponPassword wxCouponPassword); | List<WxCouponPassword> findList(WxCouponPassword wxCouponPassword); | ||||
| void postpone(WxCouponPassword wxCouponPassword); | void postpone(WxCouponPassword wxCouponPassword); | ||||
| void startOrStop(WxCouponPassword wxCouponPassword); | |||||
| } | } | ||||
| @@ -298,18 +298,9 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| wxCouponPasswordMapper.updatePostpone(wxCouponPassword); | wxCouponPasswordMapper.updatePostpone(wxCouponPassword); | ||||
| } | } | ||||
| /* | |||||
| public static void main(String[] args) { | |||||
| WxCouponPasswordServiceImpl ll = new WxCouponPasswordServiceImpl(); | |||||
| long startTime = System.currentTimeMillis(); | |||||
| System.out.println(startTime); | |||||
| ll.mkPasswords("456", 12345L, 100); | |||||
| long endTime = System.currentTimeMillis(); | |||||
| System.out.println(endTime); | |||||
| long usedTime = (endTime-startTime)/1000; | |||||
| System.out.println("耗时:" + usedTime + "s"); | |||||
| } | |||||
| */ | |||||
| @Override | |||||
| public void startOrStop(WxCouponPassword wxCouponPassword) { | |||||
| //如果当前卡密是已兑换的状态,则更新对应的电子卡状态即可 | |||||
| } | |||||
| } | } | ||||
| @@ -15,11 +15,11 @@ | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | ||||
| <result column="expire_date" jdbcType="TIMESTAMP" property="expireDate" /> | <result column="expire_date" jdbcType="TIMESTAMP" property="expireDate" /> | ||||
| <result column="present_id" jdbcType="TIMESTAMP" property="presentId"/> | <result column="present_id" jdbcType="TIMESTAMP" property="presentId"/> | ||||
| <result column="is_stop" jdbcType="INTEGER" property="isStop"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_short`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`,`expire_date`,`present_id` | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_short`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`,`expire_date`,`present_id`,`is_stop` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -27,6 +27,9 @@ | |||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and `id` = #{id} | and `id` = #{id} | ||||
| </if> | </if> | ||||
| <if test=" null != idLike and '' != idLike "> | |||||
| and `id` like concat('%',#{idLike},'%') | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -39,9 +42,12 @@ | |||||
| <if test=" null != couponShort "> | <if test=" null != couponShort "> | ||||
| and `coupon_short` = #{couponShort} | and `coupon_short` = #{couponShort} | ||||
| </if> | </if> | ||||
| <if test=" null != password "> | |||||
| <if test=" null != password and '' != password"> | |||||
| and `password` = #{password} | and `password` = #{password} | ||||
| </if> | |||||
| </if> | |||||
| <if test=" null != passwordLike and '' != passwordLike "> | |||||
| and `password` like concat('%',#{passwordLike},'%') | |||||
| </if> | |||||
| <if test=" null != status "> | <if test=" null != status "> | ||||
| and `status` = #{status} | and `status` = #{status} | ||||
| </if> | </if> | ||||
| @@ -65,6 +71,10 @@ | |||||
| and `present_id` = #{presentId} | and `present_id` = #{presentId} | ||||
| </if> | </if> | ||||
| <if test=" null != isStop "> | |||||
| and `is_stop` = #{isStop} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||