| @@ -0,0 +1,2 @@ | |||||
| alter table wx_activity ADD COLUMN `send_msg` smallint(2) DEFAULT 0 COMMENT '是否发送短信1是0否'; | |||||
| alter table wx_activity_join ADD COLUMN `send_msg` smallint(2) DEFAULT 0 COMMENT '是否发送短信1是0否'; | |||||
| @@ -57,6 +57,7 @@ public class ActivitySchedule { | |||||
| wxActivityJoin.setTenantId(activity.getTenantId()); | wxActivityJoin.setTenantId(activity.getTenantId()); | ||||
| wxActivityJoin.setActivityId(activity.getId()); | wxActivityJoin.setActivityId(activity.getId()); | ||||
| wxActivityJoin.setStatus(EnumActivityJoinStatus.CONFIRMED.getCode()); | wxActivityJoin.setStatus(EnumActivityJoinStatus.CONFIRMED.getCode()); | ||||
| wxActivityJoin.setSendMsg(EnumSendMsg.YES.getCode()); | |||||
| List<WxActivityJoin> list = wxActivityJoinMapper.findList(wxActivityJoin); | List<WxActivityJoin> list = wxActivityJoinMapper.findList(wxActivityJoin); | ||||
| for (WxActivityJoin activityJoin : list) { | for (WxActivityJoin activityJoin : list) { | ||||
| send(activity, activityJoin); | send(activity, activityJoin); | ||||
| @@ -81,6 +81,9 @@ public class WxActivity extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "图片说明", name = "imgDetail") | @io.swagger.annotations.ApiModelProperty(value = "图片说明", name = "imgDetail") | ||||
| private String imgDetail; | private String imgDetail; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "是否发送短信1是0否", name = "sendMsg") | |||||
| private Integer sendMsg; | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "starttime") | @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "starttime") | ||||
| private Date starttime; | private Date starttime; | ||||
| @@ -11,6 +11,9 @@ import javax.persistence.Transient; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @Table(name = "wx_activity_join") | @Table(name = "wx_activity_join") | ||||
| @Data | @Data | ||||
| @ToString(callSuper = true) | @ToString(callSuper = true) | ||||
| @@ -76,6 +79,9 @@ public class WxActivityJoin extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateTime") | @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateTime") | ||||
| private Date updateTime; | private Date updateTime; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "是否发送短信1是0否", name = "sendMsg") | |||||
| private Integer sendMsg; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "图片", name = "imgUrl") | @io.swagger.annotations.ApiModelProperty(value = "图片", name = "imgUrl") | ||||
| private String img_url; | private String img_url; | ||||
| @@ -0,0 +1,35 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumSendMsg { | |||||
| YES(1, "已发送"), | |||||
| NO(0, "未发送"); | |||||
| public static EnumSendMsg getEnum(Integer code) { | |||||
| for (EnumSendMsg value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumSendMsg(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -4,6 +4,7 @@ import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxActivityJoin; | import com.iformall.domain.po.WxActivityJoin; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| @@ -14,4 +15,6 @@ public interface WxActivityJoinMapper extends CommonMapper<WxActivityJoin, Long> | |||||
| void cfindList(WxActivityJoin wxActivityJoin); | void cfindList(WxActivityJoin wxActivityJoin); | ||||
| void updateSendMsg(Map<String, Object> param); | |||||
| } | } | ||||
| @@ -108,11 +108,18 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||||
| @Override | @Override | ||||
| public ResultData sendMsg(WxActivityJoin wxActivityJoin) { | public ResultData sendMsg(WxActivityJoin wxActivityJoin) { | ||||
| WxActivity campaign = wxActivityMapper.selectByPrimaryKey(wxActivityJoin.getActivityId()); | |||||
| WxActivity activity = wxActivityMapper.selectByPrimaryKey(wxActivityJoin.getActivityId()); | |||||
| activity.setSendMsg(EnumSendMsg.YES.getCode()); | |||||
| activity.setUpdateTime(new Date()); | |||||
| wxActivityMapper.updateByPrimaryKeySelective(activity); | |||||
| List<WxActivityJoin> joinList = wxActivityJoinMapper.select(wxActivityJoin); | List<WxActivityJoin> joinList = wxActivityJoinMapper.select(wxActivityJoin); | ||||
| for (WxActivityJoin join : joinList) { | for (WxActivityJoin join : joinList) { | ||||
| sendMessage(join, campaign); | |||||
| sendMessage(join, activity); | |||||
| } | } | ||||
| Map<String, Object> param = new HashMap<>(2); | |||||
| param.put("sendMsg", EnumSendMsg.YES.getCode()); | |||||
| param.put("joinList", joinList); | |||||
| wxActivityJoinMapper.updateSendMsg(param); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -18,12 +18,13 @@ | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | ||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | ||||
| <result column="img_url" jdbcType="VARCHAR" property="img_url"/> | <result column="img_url" jdbcType="VARCHAR" property="img_url"/> | ||||
| <result column="send_msg" jdbcType="INTEGER" property="sendMsg"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`user_id`,`activity_id`,`name`,`nick_name`,`birthday`,`sex`,`phone`, | `id`,`tenant_id`,`user_id`,`activity_id`,`name`,`nick_name`,`birthday`,`sex`,`phone`, | ||||
| `address`,`answer`,`sign_in`,`status`,`create_time`,`update_time`,`img_url` | |||||
| `address`,`answer`,`sign_in`,`status`,`create_time`,`update_time`,`img_url`,`send_msg` | |||||
| </sql> | </sql> | ||||
| @@ -54,6 +55,9 @@ | |||||
| and `activity_id` = #{activityId} | and `activity_id` = #{activityId} | ||||
| </if> | </if> | ||||
| <if test=" null != sendMsg "> | |||||
| and `send_msg` = #{sendMsg} | |||||
| </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=")"> | ||||
| @@ -86,5 +90,12 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </select> | </select> | ||||
| <update id="updateSendMsg" parameterType="hashmap"> | |||||
| update wx_activity_join set send_msg = #{send_msg} where id in | |||||
| <foreach collection="joinList" index="index" item="join" open="(" separator="," close=")"> | |||||
| #{join.id} | |||||
| </foreach> | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||
| @@ -24,12 +24,14 @@ | |||||
| <result column="is_expired" jdbcType="INTEGER" property="isExpired"/> | <result column="is_expired" jdbcType="INTEGER" property="isExpired"/> | ||||
| <result column="use_img" jdbcType="INTEGER" property="useImg"/> | <result column="use_img" jdbcType="INTEGER" property="useImg"/> | ||||
| <result column="img_detail" jdbcType="VARCHAR" property="imgDetail"/> | <result column="img_detail" jdbcType="VARCHAR" property="imgDetail"/> | ||||
| <result column="send_msg" jdbcType="INTEGER" property="sendMsg"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`detail`,`html`,`person_limit`,`activity_start_time`,`activity_end_time`, | `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`detail`,`html`,`person_limit`,`activity_start_time`,`activity_end_time`, | ||||
| `use_credit`,`credit`,`type`,`status`,`start_time`,`end_time`,`question`,`is_expired`,`create_time`,`update_time`,`use_img`,`img_detail` | |||||
| `use_credit`,`credit`,`type`,`status`,`start_time`,`end_time`,`question`,`is_expired`,`create_time`,`update_time`,`use_img`, | |||||
| `img_detail`,`send_msg` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -82,6 +84,10 @@ | |||||
| and `create_time` between #{starttime} and #{endtime} | and `create_time` between #{starttime} and #{endtime} | ||||
| </if> | </if> | ||||
| <if test=" null != sendMsg "> | |||||
| and `send_msg` = #{sendMsg} | |||||
| </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=")"> | ||||
| @@ -101,7 +107,9 @@ | |||||
| <select id="queryNotify" parameterType="com.iformall.domain.po.WxActivity" | <select id="queryNotify" parameterType="com.iformall.domain.po.WxActivity" | ||||
| resultType="com.iformall.domain.po.WxActivity"> | resultType="com.iformall.domain.po.WxActivity"> | ||||
| select id,title,activity_start_time,tenant_id from wx_activity where status=${status} and DATEDIFF(activity_start_time,now())=3 | |||||
| select id,title,activity_start_time,tenant_id from wx_activity | |||||
| where status=${status} | |||||
| and DATEDIFF(activity_start_time,now())=3 | |||||
| </select> | </select> | ||||
| <update id="activityExipred" parameterType="com.iformall.domain.po.WxActivity"> | <update id="activityExipred" parameterType="com.iformall.domain.po.WxActivity"> | ||||