| @@ -5,9 +5,9 @@ import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxCampaignJoin; | |||||
| import com.iformall.domain.po.WxActivityJoin; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxCampaignJoinService; | |||||
| import com.iformall.service.WxActivityJoinService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -24,13 +24,13 @@ import javax.servlet.http.HttpServletResponse; | |||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCampaignJoin") | |||||
| @RequestMapping("wxActivityJoin") | |||||
| @Api(description = "活动参与信息") | @Api(description = "活动参与信息") | ||||
| public class WxCampaignJoinController extends BaseController { | |||||
| public class WxActivityJoinController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| private WxCampaignJoinService wxCampaignJoinService; | |||||
| private WxActivityJoinService wxActivityJoinService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -38,68 +38,70 @@ public class WxCampaignJoinController extends BaseController { | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| @SystemControllerLog(description = "活动参与信息-列表") | @SystemControllerLog(description = "活动参与信息-列表") | ||||
| public ResultData list(@ModelAttribute WxCampaignJoin wxCampaignJoin, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCampaignJoinController::list"); | |||||
| if (null == wxCampaignJoin) wxCampaignJoin = new WxCampaignJoin(); | |||||
| wxCampaignJoin.setTenantId(getTenantId()); | |||||
| wxCampaignJoin.setSortColumns(WxCampaignJoin.Field.Id_DESC); | |||||
| final PageInfo<WxCampaignJoin> page = wxCampaignJoinService.listAsPage(wxCampaignJoin, pageNum, pageSize); | |||||
| public ResultData list(@ModelAttribute WxActivityJoin wxActivityJoin, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxActivityJoinController::list"); | |||||
| if (null == wxActivityJoin) { | |||||
| wxActivityJoin = new WxActivityJoin(); | |||||
| } | |||||
| wxActivityJoin.setTenantId(getTenantId()); | |||||
| wxActivityJoin.setSortColumns(WxActivityJoin.Field.Id_DESC); | |||||
| final PageInfo<WxActivityJoin> page = wxActivityJoinService.listAsPage(wxActivityJoin, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("确认或取消报名") | @ApiOperation("确认或取消报名") | ||||
| @PostMapping("modifyStatus") | @PostMapping("modifyStatus") | ||||
| @SystemControllerLog(description = "活动参与信息-确认或取消报名") | @SystemControllerLog(description = "活动参与信息-确认或取消报名") | ||||
| public ResultData modifyStatus(@RequestBody WxCampaignJoin wxCampaignJoin) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCampaignJoinController::modifyStatus"); | |||||
| public ResultData modifyStatus(@RequestBody WxActivityJoin wxActivityJoin) { | |||||
| logger.debug("[" + getIpAddr() + "] WxActivityJoinController::modifyStatus"); | |||||
| if (wxCampaignJoin.getId() == null) { | |||||
| if (wxActivityJoin.getId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "id不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "id不能为空"); | ||||
| } | } | ||||
| if (wxCampaignJoin.getStatus() == null) { | |||||
| if (wxActivityJoin.getStatus() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "status不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "status不能为空"); | ||||
| } | } | ||||
| return wxCampaignJoinService.modifyStatus(wxCampaignJoin); | |||||
| return wxActivityJoinService.modifyStatus(wxActivityJoin); | |||||
| } | } | ||||
| @ApiOperation("导出报名表") | @ApiOperation("导出报名表") | ||||
| @RequestMapping("/exportData") | @RequestMapping("/exportData") | ||||
| @SystemControllerLog(description = "活动参与信息-导出报名表") | @SystemControllerLog(description = "活动参与信息-导出报名表") | ||||
| public void exportData(@ModelAttribute WxCampaignJoin wxCampaignJoin, HttpServletRequest request, HttpServletResponse response) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCampaignJoinController::exportData"); | |||||
| if (wxCampaignJoin.getCampaignId() == null) { | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "campaignId不能为空"); | |||||
| public void exportData(@ModelAttribute WxActivityJoin wxActivityJoin, HttpServletRequest request, HttpServletResponse response) { | |||||
| logger.debug("[" + getIpAddr() + "] WxActivityJoinController::exportData"); | |||||
| if (wxActivityJoin.getActivityId() == null) { | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空"); | |||||
| } | } | ||||
| wxCampaignJoin.setTenantId(getTenantId()); | |||||
| wxCampaignJoinService.exportData(request, response, wxCampaignJoin); | |||||
| wxActivityJoin.setTenantId(getTenantId()); | |||||
| wxActivityJoinService.exportData(request, response, wxActivityJoin); | |||||
| } | } | ||||
| @ApiOperation("查询报名总数") | @ApiOperation("查询报名总数") | ||||
| @GetMapping("queryJoinInfo") | @GetMapping("queryJoinInfo") | ||||
| @SystemControllerLog(description = "活动参与信息-查询报名总数") | @SystemControllerLog(description = "活动参与信息-查询报名总数") | ||||
| public ResultData queryJoinInfo(@ModelAttribute WxCampaignJoin wxCampaignJoin) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCampaignJoinController::queryJoinInfo"); | |||||
| public ResultData queryJoinInfo(@ModelAttribute WxActivityJoin wxActivityJoin) { | |||||
| logger.debug("[" + getIpAddr() + "] WxActivityJoinController::queryJoinInfo"); | |||||
| if (wxCampaignJoin.getCampaignId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "campaignId不能为空"); | |||||
| if (wxActivityJoin.getActivityId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空"); | |||||
| } | } | ||||
| wxCampaignJoin.setTenantId(getTenantId()); | |||||
| return wxCampaignJoinService.queryJoinInfo(wxCampaignJoin); | |||||
| wxActivityJoin.setTenantId(getTenantId()); | |||||
| return wxActivityJoinService.queryJoinInfo(wxActivityJoin); | |||||
| } | } | ||||
| @ApiOperation("发送短信") | @ApiOperation("发送短信") | ||||
| @GetMapping("sendMsg") | @GetMapping("sendMsg") | ||||
| @SystemControllerLog(description = "活动参与信息-发送短信") | @SystemControllerLog(description = "活动参与信息-发送短信") | ||||
| public ResultData sendMsg(@ModelAttribute WxCampaignJoin wxCampaignJoin) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCampaignJoinController::confirmCompletion"); | |||||
| public ResultData sendMsg(@ModelAttribute WxActivityJoin wxActivityJoin) { | |||||
| logger.debug("[" + getIpAddr() + "] WxActivityJoinController::confirmCompletion"); | |||||
| if (wxCampaignJoin.getCampaignId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "campaignId不能为空"); | |||||
| if (wxActivityJoin.getActivityId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "activityId不能为空"); | |||||
| } | } | ||||
| wxCampaignJoin.setTenantId(getTenantId()); | |||||
| return wxCampaignJoinService.sendMsg(wxCampaignJoin); | |||||
| wxActivityJoin.setTenantId(getTenantId()); | |||||
| return wxActivityJoinService.sendMsg(wxActivityJoin); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,25 @@ | |||||
| drop table if exists `wx_activity`; | |||||
| CREATE TABLE IF NOT EXISTS `wx_activity` ( | |||||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||||
| `tenant_id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||||
| `cover_img` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '封面图', | |||||
| `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '活动名称', | |||||
| `sub_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '副标题', | |||||
| `detail` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '活动正文', | |||||
| `html` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '富文本', | |||||
| `person_limit` int(11) NOT NULL COMMENT '报名人数', | |||||
| `activity_start_time` datetime NOT NULL COMMENT '活动开始时间', | |||||
| `activity_end_time` datetime NOT NULL COMMENT '活动开始时间', | |||||
| `useCredit` smallint(2) DEFAULT 0 COMMENT '使用积分1是0否', | |||||
| `credit` int(11) DEFAULT 0 COMMENT '消耗积分', | |||||
| `type` smallint(2) NOT NULL COMMENT '类型 1固定格式2自由图文', | |||||
| `status` smallint(2) NOT NULL COMMENT '状态0上线 1下线', | |||||
| `start_time` datetime NOT NULL COMMENT '活动报名开始时间', | |||||
| `end_time` datetime NOT NULL COMMENT '活动报名结束时间', | |||||
| `question` json NOT NULL COMMENT '问题', | |||||
| `is_expired` smallint(2) DEFAULT 1 COMMENT '是否过期1是0否', | |||||
| `create_time` datetime NOT NULL COMMENT '创建时间', | |||||
| `update_time` datetime NOT NULL COMMENT '更新时间', | |||||
| PRIMARY KEY (`id`), | |||||
| INDEX `id_index` USING BTREE (`id`) comment '' | |||||
| ) ENGINE=`InnoDB` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='活动表' CHECKSUM=0 DELAY_KEY_WRITE=0; | |||||
| @@ -1,11 +1,11 @@ | |||||
| package com.iformall.schedule; | package com.iformall.schedule; | ||||
| import com.iformall.domain.po.WxCampaign; | |||||
| import com.iformall.domain.po.WxCampaignJoin; | |||||
| import com.iformall.domain.po.WxActivity; | |||||
| import com.iformall.domain.po.WxActivityJoin; | |||||
| import com.iformall.domain.po.msg.WxMsgRecord; | import com.iformall.domain.po.msg.WxMsgRecord; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.WxCampaignJoinMapper; | |||||
| import com.iformall.mapper.WxCampaignMapper; | |||||
| import com.iformall.mapper.WxActivityJoinMapper; | |||||
| import com.iformall.mapper.WxActivityMapper; | |||||
| import com.iformall.mq.MqBaseProducer; | import com.iformall.mq.MqBaseProducer; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.apache.commons.collections.map.HashedMap; | import org.apache.commons.collections.map.HashedMap; | ||||
| @@ -23,15 +23,15 @@ import java.util.Map; | |||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @Component | @Component | ||||
| public class CampaginSchedule { | |||||
| public class ActivitySchedule { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| private WxCampaignMapper wxCampaignMapper; | |||||
| private WxActivityMapper wxActivityMapper; | |||||
| @Autowired | @Autowired | ||||
| private WxCampaignJoinMapper wxCampaignJoinMapper; | |||||
| private WxActivityJoinMapper wxActivityJoinMapper; | |||||
| @Autowired | @Autowired | ||||
| private MqBaseProducer mqBaseProducer; | private MqBaseProducer mqBaseProducer; | ||||
| @@ -42,34 +42,34 @@ public class CampaginSchedule { | |||||
| @Scheduled(cron = "0 0 12 * * ?") | @Scheduled(cron = "0 0 12 * * ?") | ||||
| public void sendMsg() { | public void sendMsg() { | ||||
| logger.info("限时活动参与提醒任务启动"); | logger.info("限时活动参与提醒任务启动"); | ||||
| WxCampaign wxCampaign = new WxCampaign(); | |||||
| wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||||
| List<WxCampaign> wxCampaigns = wxCampaignMapper.queryNotify(wxCampaign); | |||||
| WxCampaignJoin wxCampaignJoin = null; | |||||
| for (WxCampaign campaign : wxCampaigns) { | |||||
| wxCampaignJoin = new WxCampaignJoin(); | |||||
| wxCampaignJoin.setTenantId(campaign.getTenantId()); | |||||
| wxCampaignJoin.setCampaignId(campaign.getId()); | |||||
| wxCampaignJoin.setStatus(EnumCampaignJoinStatus.CONFIRMED.getCode()); | |||||
| List<WxCampaignJoin> list = wxCampaignJoinMapper.findList(wxCampaignJoin); | |||||
| for (WxCampaignJoin campaignJoin : list) { | |||||
| send(campaign, campaignJoin); | |||||
| WxActivity wxActivity = new WxActivity(); | |||||
| wxActivity.setStatus(EnumActivityStatus.STATUS_THROW_IN.getCode()); | |||||
| List<WxActivity> wxActivitys = wxActivityMapper.queryNotify(wxActivity); | |||||
| WxActivityJoin wxActivityJoin = null; | |||||
| for (WxActivity activity : wxActivitys) { | |||||
| wxActivityJoin = new WxActivityJoin(); | |||||
| wxActivityJoin.setTenantId(activity.getTenantId()); | |||||
| wxActivityJoin.setActivityId(activity.getId()); | |||||
| wxActivityJoin.setStatus(EnumActivityJoinStatus.CONFIRMED.getCode()); | |||||
| List<WxActivityJoin> list = wxActivityJoinMapper.findList(wxActivityJoin); | |||||
| for (WxActivityJoin activityJoin : list) { | |||||
| send(activity, activityJoin); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| private void send(WxCampaign campaign, WxCampaignJoin campaignJoin) { | |||||
| private void send(WxActivity activity, WxActivityJoin activityJoin) { | |||||
| logger.info("限时活动参与提醒短信发送开始"); | logger.info("限时活动参与提醒短信发送开始"); | ||||
| String phone = campaignJoin.getPhone(); | |||||
| String person = campaignJoin.getName(); | |||||
| String phone = activityJoin.getPhone(); | |||||
| String person = activityJoin.getName(); | |||||
| person = StringUtils.isNotEmpty(person) ? person : ""; | person = StringUtils.isNotEmpty(person) ? person : ""; | ||||
| String time = DateUtils.date2String(campaign.getActivityStartTime()); | |||||
| String party = campaign.getTitle(); | |||||
| String time = DateUtils.date2String(activity.getActivityStartTime()); | |||||
| String party = activity.getTitle(); | |||||
| WxMsgRecord wxMsgRecord = new WxMsgRecord(); | WxMsgRecord wxMsgRecord = new WxMsgRecord(); | ||||
| wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); | wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); | ||||
| wxMsgRecord.setModelType(EnumMsgModel.TIME_LIMIT_CAMPAIGN_NOTIFY.getCode()); | wxMsgRecord.setModelType(EnumMsgModel.TIME_LIMIT_CAMPAIGN_NOTIFY.getCode()); | ||||
| wxMsgRecord.setReceiver(phone); | wxMsgRecord.setReceiver(phone); | ||||
| wxMsgRecord.setTenantId(campaignJoin.getTenantId()); | |||||
| wxMsgRecord.setTenantId(activityJoin.getTenantId()); | |||||
| Map<String, String> map = new HashedMap(); | Map<String, String> map = new HashedMap(); | ||||
| map.put("person", person); | map.put("person", person); | ||||
| map.put("party", party); | map.put("party", party); | ||||
| @@ -84,23 +84,23 @@ public class CampaginSchedule { | |||||
| * 5分钟一次 | * 5分钟一次 | ||||
| */ | */ | ||||
| @Scheduled(cron = "0 */5 * * * ?") | @Scheduled(cron = "0 */5 * * * ?") | ||||
| public void campaignExipred() { | |||||
| public void activityExipred() { | |||||
| logger.info("活动报名结束任务"); | logger.info("活动报名结束任务"); | ||||
| WxCampaign campaign = new WxCampaign(); | |||||
| campaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||||
| campaign.setIsExpired(EnumCampaignExpired.YES.getCode()); | |||||
| wxCampaignMapper.campaignExipred(campaign); | |||||
| WxActivity activity = new WxActivity(); | |||||
| activity.setStatus(EnumActivityStatus.STATUS_THROW_IN.getCode()); | |||||
| activity.setIsExpired(EnumActivityExpired.YES.getCode()); | |||||
| wxActivityMapper.activityExipred(activity); | |||||
| } | } | ||||
| /** | /** | ||||
| * 5分钟一次 | * 5分钟一次 | ||||
| */ | */ | ||||
| @Scheduled(cron = "0 */5 * * * ?") | @Scheduled(cron = "0 */5 * * * ?") | ||||
| public void campaignCompletion() { | |||||
| public void activityCompletion() { | |||||
| logger.info("活动结束任务"); | logger.info("活动结束任务"); | ||||
| WxCampaign campaign = new WxCampaign(); | |||||
| campaign.setStatus(EnumCampaignStatus.STATUS_TAKE_OFFF.getCode()); | |||||
| wxCampaignMapper.campaignCompletion(campaign); | |||||
| WxActivity activity = new WxActivity(); | |||||
| activity.setStatus(EnumActivityStatus.STATUS_TAKE_OFFF.getCode()); | |||||
| wxActivityMapper.activityCompletion(activity); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,158 @@ | |||||
| package com.iformall.domain.po; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_activity") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxActivity extends BaseEntity { | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| @Override | |||||
| public String getSortColumns() { | |||||
| super.setSortColumns(this.sortColumns); | |||||
| return super.getSortColumns(); | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租户", name = "tenantId") | |||||
| private String tenantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "封面图", name = "coverImg") | |||||
| private String coverImg; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "主标题", name = "title") | |||||
| private String title; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "副标题", name = "subTitle") | |||||
| private String subTitle; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "使用积分1是0否", name = "useCredit") | |||||
| private Integer useCredit; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "消耗积分", name = "credit") | |||||
| private Integer credit; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动人数", name = "personLimit") | |||||
| private Integer personLimit; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动正文", name = "detail") | |||||
| private String detail; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动开始报名时间", name = "startTime") | |||||
| private Date startTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动结束报名时间", name = "endTime") | |||||
| private Date endTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "类型 1固定格式2自由图文", name = "type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "0上线 1下线", name = "status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createTime") | |||||
| private Date createTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateTime") | |||||
| private Date updateTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "富文本", name = "html") | |||||
| private String html; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "问题", name = "question") | |||||
| private String question; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否过期1是0否", name = "isExpired") | |||||
| private Integer isExpired; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动开始时间", name = "activityStartTime") | |||||
| private Date activityStartTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动结束时间", name = "activityEndTime") | |||||
| private Date activityEndTime; | |||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "starttime") | |||||
| protected Date starttime; | |||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime") | |||||
| protected Date endtime; | |||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "小程序路径", name = "weappPath") | |||||
| protected String weappPath; | |||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "小程序二维码Scene", name = "weappScene") | |||||
| protected String weappScene; | |||||
| public String getWeappPath() { | |||||
| if (type == null) | |||||
| return "pages/index/index"; | |||||
| return "pages/index/index?type=bd&bt=" + type + "&id=" + id; | |||||
| } | |||||
| public String getWeappScene() { | |||||
| if (type == null) | |||||
| return ""; | |||||
| return "t:bd:" + type + ":" + id; | |||||
| } | |||||
| public static enum Field { | |||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), CoverImg_ASC("`cover_img` ASC"), CoverImg_DESC("`cover_img` DESC"), Title_ASC("`title` ASC"), Title_DESC("`title` DESC"), SubTitle_ASC("`sub_title` ASC"), SubTitle_DESC("`sub_title` DESC"), StartTime_ASC("`start_time` ASC"), StartTime_DESC("`start_time` DESC"), EndTime_ASC("`end_time` ASC"), EndTime_DESC("`end_time` DESC"), Type_ASC("`type` ASC"), Type_DESC("`type` DESC"), Status_ASC("`status` ASC"), Status_DESC("`status` DESC"), ActivityTime_ASC("`activity_start_time` ASC"), ActivityTime_DESC("`activity_start_time` DESC"), CreateTime_ASC("`create_time` ASC"), CreateTime_DESC("`create_time` DESC"), UpdateTime_ASC("`update_time` ASC"), UpdateTime_DESC("`update_time` DESC"); | |||||
| private String value; | |||||
| Field(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxActivity.Field... fields) { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| this.sortColumns = sb.toString(); | |||||
| } | |||||
| public void setSortColumns(String sortColumns) { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| List<Field> fList = new java.util.ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -11,11 +11,11 @@ import javax.persistence.Transient; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| @Table(name = "wx_campaign_join") | |||||
| @Table(name = "wx_activity_join") | |||||
| @Data | @Data | ||||
| @ToString(callSuper = true) | @ToString(callSuper = true) | ||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
| public class WxCampaignJoin extends BaseEntity { | |||||
| public class WxActivityJoin extends BaseEntity { | |||||
| @Id | @Id | ||||
| protected Long id; | protected Long id; | ||||
| @@ -36,8 +36,8 @@ public class WxCampaignJoin extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "C端用户ID", name = "userId") | @io.swagger.annotations.ApiModelProperty(value = "C端用户ID", name = "userId") | ||||
| private Long userId; | private Long userId; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "活动ID", name = "campaignId") | |||||
| private Long campaignId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动ID", name = "activityId") | |||||
| private Long activityId; | |||||
| @Excel(name = "姓名", width = 10, orderNum = "1") | @Excel(name = "姓名", width = 10, orderNum = "1") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "姓名", name = "name") | @io.swagger.annotations.ApiModelProperty(value = "姓名", name = "name") | ||||
| @@ -99,7 +99,7 @@ public class WxCampaignJoin extends BaseEntity { | |||||
| } | } | ||||
| } | } | ||||
| public void setSortColumns(WxCampaignJoin.Field... fields) { | |||||
| public void setSortColumns(WxActivityJoin.Field... fields) { | |||||
| if (fields == null || fields.length == 0) { | if (fields == null || fields.length == 0) { | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -116,6 +116,7 @@ public class WxCampaignJoin extends BaseEntity { | |||||
| this.sortColumns = sb.toString(); | this.sortColumns = sb.toString(); | ||||
| } | } | ||||
| @Override | |||||
| public void setSortColumns(String sortColumns) { | public void setSortColumns(String sortColumns) { | ||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | if (sortColumns == null || "".equals(sortColumns.trim())) { | ||||
| return; | return; | ||||
| @@ -75,23 +75,6 @@ public class WxCampaign extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="富文本,类型2适用",name="html") | @io.swagger.annotations.ApiModelProperty(value="富文本,类型2适用",name="html") | ||||
| private String html; | private String html; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "报名人数", name = "personLimit") | |||||
| private Integer personLimit; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动开始时间", name = "activityStartTime") | |||||
| private Date activityStartTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动结束时间", name = "activityEndTime") | |||||
| private Date activityEndTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "使用积分1是0否", name = "useCredit") | |||||
| private Integer useCredit; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "消耗积分", name = "credit") | |||||
| private Integer credit; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "问题", name = "question") | |||||
| private String question; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否过期1是0否", name = "isExpired") | |||||
| private Integer isExpired; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "活动类型1直接投放2限时投放", name = "activityType") | |||||
| private Integer activityType; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "产品类型,类型3适用(1-券,2-报名)", name = "produceType") | @io.swagger.annotations.ApiModelProperty(value = "产品类型,类型3适用(1-券,2-报名)", name = "produceType") | ||||
| private Integer produceType; | private Integer produceType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "产品ID,类型3适用", name = "produceId") | @io.swagger.annotations.ApiModelProperty(value = "产品ID,类型3适用", name = "produceId") | ||||
| @@ -101,14 +84,6 @@ public class WxCampaign extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "小程序跳转二维码,类型3适用", name = "pageScene") | @io.swagger.annotations.ApiModelProperty(value = "小程序跳转二维码,类型3适用", name = "pageScene") | ||||
| private String pageScene; | private String pageScene; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "starttime") | |||||
| protected Date starttime; | |||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endtime") | |||||
| protected Date endtime; | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value="营销物料-小程序路径",name="weappPath") | @io.swagger.annotations.ApiModelProperty(value="营销物料-小程序路径",name="weappPath") | ||||
| protected String weappPath; | protected String weappPath; | ||||
| @@ -3,14 +3,14 @@ package com.iformall.enums; | |||||
| /** | /** | ||||
| * Created by Stormeye on 2018/08/09. | * Created by Stormeye on 2018/08/09. | ||||
| */ | */ | ||||
| public enum EnumCampaignExpired { | |||||
| public enum EnumActivityExpired { | |||||
| YES(1, "过期"), | YES(1, "过期"), | ||||
| NO(0, "未到期"),; | NO(0, "未到期"),; | ||||
| public static EnumCampaignExpired getEnum(Integer code) { | |||||
| for (EnumCampaignExpired value : values()) { | |||||
| public static EnumActivityExpired getEnum(Integer code) { | |||||
| for (EnumActivityExpired value : values()) { | |||||
| if (value.getCode().equals(code)) { | if (value.getCode().equals(code)) { | ||||
| return value; | return value; | ||||
| } | } | ||||
| @@ -21,7 +21,7 @@ public enum EnumCampaignExpired { | |||||
| private Integer code; | private Integer code; | ||||
| private String message; | private String message; | ||||
| EnumCampaignExpired(Integer code, String message) { | |||||
| EnumActivityExpired(Integer code, String message) { | |||||
| this.code = code; | this.code = code; | ||||
| this.message = message; | this.message = message; | ||||
| } | } | ||||
| @@ -4,13 +4,13 @@ package com.iformall.enums; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public enum EnumCampaignJoinSignStatus { | |||||
| public enum EnumActivityJoinSignStatus { | |||||
| YES(1, "签到"), | YES(1, "签到"), | ||||
| NO(0, "未签到"),; | NO(0, "未签到"),; | ||||
| public static EnumCampaignJoinSignStatus getEnum(Integer code) { | |||||
| for (EnumCampaignJoinSignStatus value : values()) { | |||||
| public static EnumActivityJoinSignStatus getEnum(Integer code) { | |||||
| for (EnumActivityJoinSignStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | if (value.getCode().equals(code)) { | ||||
| return value; | return value; | ||||
| } | } | ||||
| @@ -21,7 +21,7 @@ public enum EnumCampaignJoinSignStatus { | |||||
| private Integer code; | private Integer code; | ||||
| private String message; | private String message; | ||||
| EnumCampaignJoinSignStatus(Integer code, String message) { | |||||
| EnumActivityJoinSignStatus(Integer code, String message) { | |||||
| this.code = code; | this.code = code; | ||||
| this.message = message; | this.message = message; | ||||
| } | } | ||||
| @@ -4,15 +4,15 @@ package com.iformall.enums; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| public enum EnumCampaignJoinStatus { | |||||
| public enum EnumActivityJoinStatus { | |||||
| NOT_CONFIRMED(0, "未确认"), | NOT_CONFIRMED(0, "未确认"), | ||||
| CONFIRMED(1, "已确认"), | CONFIRMED(1, "已确认"), | ||||
| CANCEL(2, "已取消"), | CANCEL(2, "已取消"), | ||||
| EXPIRED(3, "活动过期"),; | EXPIRED(3, "活动过期"),; | ||||
| public static EnumCampaignJoinStatus getEnum(Integer code) { | |||||
| for (EnumCampaignJoinStatus value : values()) { | |||||
| public static EnumActivityJoinStatus getEnum(Integer code) { | |||||
| for (EnumActivityJoinStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | if (value.getCode().equals(code)) { | ||||
| return value; | return value; | ||||
| } | } | ||||
| @@ -23,7 +23,7 @@ public enum EnumCampaignJoinStatus { | |||||
| private Integer code; | private Integer code; | ||||
| private String message; | private String message; | ||||
| EnumCampaignJoinStatus(Integer code, String message) { | |||||
| EnumActivityJoinStatus(Integer code, String message) { | |||||
| this.code = code; | this.code = code; | ||||
| this.message = message; | this.message = message; | ||||
| } | } | ||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumActivityStatus { | |||||
| // 0-已上架;1-已下架; | |||||
| STATUS_THROW_IN(0, "已上架"), | |||||
| STATUS_TAKE_OFFF(1, "已下架"),; | |||||
| public static EnumActivityStatus getEnum(Integer code) { | |||||
| for (EnumActivityStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumActivityStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,12 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxActivityJoin; | |||||
| import java.util.List; | |||||
| public interface WxActivityJoinMapper extends CommonMapper<WxActivityJoin, Long> { | |||||
| List<WxActivityJoin> findList(WxActivityJoin params); | |||||
| } | |||||
| @@ -0,0 +1,20 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxActivity; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxActivityMapper extends CommonMapper<WxActivity, Long> { | |||||
| List<WxActivity> findList(WxActivity wxActivity); | |||||
| List<WxActivity> queryNotify(WxActivity wxActivity); | |||||
| void activityExipred(WxActivity activity); | |||||
| void activityCompletion(WxActivity activity); | |||||
| } | |||||
| @@ -1,12 +0,0 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxCampaignJoin; | |||||
| import java.util.List; | |||||
| public interface WxCampaignJoinMapper extends CommonMapper<WxCampaignJoin, Long> { | |||||
| List<WxCampaignJoin> findList(WxCampaignJoin params); | |||||
| } | |||||
| @@ -0,0 +1,25 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxActivityJoin; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxActivityJoinService { | |||||
| PageInfo<WxActivityJoin> listAsPage(WxActivityJoin wxActivityJoin, Integer pageNum, Integer pageSize); | |||||
| ResultData modifyStatus(WxActivityJoin wxActivityJoin); | |||||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxActivityJoin wxActivityJoin); | |||||
| ResultData queryJoinInfo(WxActivityJoin wxActivityJoin); | |||||
| ResultData sendMsg(WxActivityJoin wxActivityJoin); | |||||
| } | |||||
| @@ -1,25 +0,0 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCampaignJoin; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxCampaignJoinService { | |||||
| PageInfo<WxCampaignJoin> listAsPage(WxCampaignJoin wxCampaignJoin, Integer pageNum, Integer pageSize); | |||||
| ResultData modifyStatus(WxCampaignJoin wxCampaignJoin); | |||||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxCampaignJoin wxCampaignJoin); | |||||
| ResultData queryJoinInfo(WxCampaignJoin wxCampaignJoin); | |||||
| ResultData sendMsg(WxCampaignJoin wxCampaignJoin); | |||||
| } | |||||
| @@ -4,16 +4,16 @@ import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCampaign; | |||||
| import com.iformall.domain.po.WxCampaignJoin; | |||||
| import com.iformall.domain.po.WxActivity; | |||||
| import com.iformall.domain.po.WxActivityJoin; | |||||
| import com.iformall.domain.po.msg.WxMsgRecord; | import com.iformall.domain.po.msg.WxMsgRecord; | ||||
| import com.iformall.domain.vo.WxBillDailyVo; | import com.iformall.domain.vo.WxBillDailyVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.WxCampaignJoinMapper; | |||||
| import com.iformall.mapper.WxCampaignMapper; | |||||
| import com.iformall.mapper.WxActivityJoinMapper; | |||||
| import com.iformall.mapper.WxActivityMapper; | |||||
| import com.iformall.mq.MqBaseProducer; | import com.iformall.mq.MqBaseProducer; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxCampaignJoinService; | |||||
| import com.iformall.service.WxActivityJoinService; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -31,14 +31,14 @@ import java.util.Map; | |||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @Service | @Service | ||||
| public class WxCampaignJoinServiceImpl implements WxCampaignJoinService { | |||||
| public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| WxCampaignJoinMapper wxCampaignJoinMapper; | |||||
| WxActivityJoinMapper wxActivityJoinMapper; | |||||
| @Autowired | @Autowired | ||||
| WxCampaignMapper wxCampaignMapper; | |||||
| WxActivityMapper wxActivityMapper; | |||||
| @Autowired | @Autowired | ||||
| ExcelService excelService; | ExcelService excelService; | ||||
| @@ -47,34 +47,34 @@ public class WxCampaignJoinServiceImpl implements WxCampaignJoinService { | |||||
| private MqBaseProducer mqBaseProducer; | private MqBaseProducer mqBaseProducer; | ||||
| @Override | @Override | ||||
| public PageInfo<WxCampaignJoin> listAsPage(WxCampaignJoin record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignJoinMapper.findList(record)); | |||||
| public PageInfo<WxActivityJoin> listAsPage(WxActivityJoin record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxActivityJoinMapper.findList(record)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData modifyStatus(WxCampaignJoin wxCampaignJoin) { | |||||
| wxCampaignJoinMapper.updateByPrimaryKeySelective(wxCampaignJoin); | |||||
| public ResultData modifyStatus(WxActivityJoin wxActivityJoin) { | |||||
| wxActivityJoinMapper.updateByPrimaryKeySelective(wxActivityJoin); | |||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxCampaignJoin wxCampaignJoin) { | |||||
| WxCampaign wxCampaign = wxCampaignMapper.selectByPrimaryKey(wxCampaignJoin.getCampaignId()); | |||||
| String title = wxCampaign.getTitle(); | |||||
| List<WxCampaignJoin> list = wxCampaignJoinMapper.findList(wxCampaignJoin); | |||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxActivityJoin wxActivityJoin) { | |||||
| WxActivity wxActivity = wxActivityMapper.selectByPrimaryKey(wxActivityJoin.getActivityId()); | |||||
| String title = wxActivity.getTitle(); | |||||
| List<WxActivityJoin> list = wxActivityJoinMapper.findList(wxActivityJoin); | |||||
| excelService.exportExcel(list, null, title, WxBillDailyVo.class, "报名表.xlsx", response, false); | excelService.exportExcel(list, null, title, WxBillDailyVo.class, "报名表.xlsx", response, false); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData queryJoinInfo(WxCampaignJoin wxCampaignJoin) { | |||||
| WxCampaign wxCampaign = wxCampaignMapper.selectByPrimaryKey(wxCampaignJoin.getCampaignId()); | |||||
| public ResultData queryJoinInfo(WxActivityJoin wxActivityJoin) { | |||||
| WxActivity wxActivity = wxActivityMapper.selectByPrimaryKey(wxActivityJoin.getActivityId()); | |||||
| //活动人数 | //活动人数 | ||||
| Integer personLimit = wxCampaign.getPersonLimit(); | |||||
| Integer personLimit = wxActivity.getPersonLimit(); | |||||
| //总人数 | //总人数 | ||||
| int total = wxCampaignJoinMapper.selectCount(wxCampaignJoin); | |||||
| wxCampaignJoin.setStatus(EnumCampaignJoinStatus.CONFIRMED.getCode()); | |||||
| int total = wxActivityJoinMapper.selectCount(wxActivityJoin); | |||||
| wxActivityJoin.setStatus(EnumActivityJoinStatus.CONFIRMED.getCode()); | |||||
| //确认数 | //确认数 | ||||
| int confirm = wxCampaignJoinMapper.selectCount(wxCampaignJoin); | |||||
| int confirm = wxActivityJoinMapper.selectCount(wxActivityJoin); | |||||
| Map<String, Object> data = new HashMap<>(); | Map<String, Object> data = new HashMap<>(); | ||||
| data.put("personLimit", personLimit); | data.put("personLimit", personLimit); | ||||
| data.put("confirm", confirm); | data.put("confirm", confirm); | ||||
| @@ -83,16 +83,16 @@ public class WxCampaignJoinServiceImpl implements WxCampaignJoinService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData sendMsg(WxCampaignJoin wxCampaignJoin) { | |||||
| WxCampaign campaign = wxCampaignMapper.selectByPrimaryKey(wxCampaignJoin.getCampaignId()); | |||||
| List<WxCampaignJoin> joinList = wxCampaignJoinMapper.select(wxCampaignJoin); | |||||
| for (WxCampaignJoin join : joinList) { | |||||
| public ResultData sendMsg(WxActivityJoin wxActivityJoin) { | |||||
| WxActivity campaign = wxActivityMapper.selectByPrimaryKey(wxActivityJoin.getActivityId()); | |||||
| List<WxActivityJoin> joinList = wxActivityJoinMapper.select(wxActivityJoin); | |||||
| for (WxActivityJoin join : joinList) { | |||||
| sendMessage(join, campaign); | sendMessage(join, campaign); | ||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| private void sendMessage(WxCampaignJoin join, WxCampaign campaign) { | |||||
| private void sendMessage(WxActivityJoin join, WxActivity activity) { | |||||
| logger.info("》》》》》》》》》》》"); | logger.info("》》》》》》》》》》》"); | ||||
| logger.info("活动发送短信开始"); | logger.info("活动发送短信开始"); | ||||
| logger.info("》》》》》》》》》》》"); | logger.info("》》》》》》》》》》》"); | ||||
| @@ -102,8 +102,8 @@ public class WxCampaignJoinServiceImpl implements WxCampaignJoinService { | |||||
| //找出用户手机号 | //找出用户手机号 | ||||
| String phone = join.getPhone(); | String phone = join.getPhone(); | ||||
| //活动名 | //活动名 | ||||
| String party = campaign.getTitle(); | |||||
| String time = DateUtils.date2String(campaign.getActivityStartTime()); | |||||
| String party = activity.getTitle(); | |||||
| String time = DateUtils.date2String(activity.getActivityStartTime()); | |||||
| Map<String, String> msgReplaceMap = new HashMap(); | Map<String, String> msgReplaceMap = new HashMap(); | ||||
| msgReplaceMap.put("person", person); | msgReplaceMap.put("person", person); | ||||
| msgReplaceMap.put("party", party); | msgReplaceMap.put("party", party); | ||||
| @@ -1,11 +1,11 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.iformall.mapper.WxCampaignJoinMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCampaignJoin"> | |||||
| <mapper namespace="com.iformall.mapper.WxActivityJoinMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxActivityJoin"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | ||||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | <result column="user_id" jdbcType="BIGINT" property="userId"/> | ||||
| <result column="campaign_id" jdbcType="BIGINT" property="campaignId"/> | |||||
| <result column="activity_id" jdbcType="BIGINT" property="activityId"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | <result column="name" jdbcType="VARCHAR" property="name"/> | ||||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | ||||
| <result column="birthday" jdbcType="TIMESTAMP" property="birthday"/> | <result column="birthday" jdbcType="TIMESTAMP" property="birthday"/> | ||||
| @@ -22,7 +22,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`user_id`,`campaign_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` | ||||
| </sql> | </sql> | ||||
| @@ -63,7 +63,7 @@ | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCampaignJoin" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxCampaignJoin" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_campaign_join | |||||
| from wx_activity_join | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| @@ -0,0 +1,114 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxActivityMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxActivity"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/> | |||||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||||
| <result column="html" jdbcType="VARCHAR" property="html"/> | |||||
| <result column="person_limit" jdbcType="INTEGER" property="personLimit"/> | |||||
| <result column="activity_start_time" jdbcType="TIMESTAMP" property="activityStartTime"/> | |||||
| <result column="activity_end_time" jdbcType="TIMESTAMP" property="activityEndTime"/> | |||||
| <result column="use_credit" jdbcType="INTEGER" property="useCredit"/> | |||||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||||
| <result column="question" jdbcType="VARCHAR" property="question"/> | |||||
| <result column="is_expired" jdbcType="INTEGER" property="isExpired"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`detail`,`html`,`person_limit`,`activity_start_time`,`activity_end_time`, | |||||
| `useCredit`,`credit`,`type`,`status`,`start_time`,`end_time`,`question`,`is_expired`,`create_time`,`update_time`, | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != title "> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != subTitle "> | |||||
| and `sub_title` like concat('%', #{subTitle},'%') | |||||
| </if> | |||||
| <if test=" null != detail "> | |||||
| and `detail` like concat('%', #{detail},'%') | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != createTime "> | |||||
| and `create_time` = #{createTime} | |||||
| </if> | |||||
| <if test=" null != updateTime "> | |||||
| and `update_time` = #{updateTime} | |||||
| </if> | |||||
| <if test=" null != useCredit "> | |||||
| and `use_credit` = #{useCredit} | |||||
| </if> | |||||
| <if test=" null != isExpired "> | |||||
| and `is_expired` = #{isExpired} | |||||
| </if> | |||||
| <if test=" null != starttime and null!=endtime "> | |||||
| and `create_time` between #{starttime} and #{endtime} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCampaign" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_activity | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="queryNotify" parameterType="com.iformall.domain.po.WxCampaign" | |||||
| resultType="com.iformall.domain.po.WxCampaign"> | |||||
| select id,title,activity_start_time,tenant_id from wx_activity where status=${status} and DATEDIFF(activity_start_time,now())=3 | |||||
| </select> | |||||
| <update id="activityExipred" parameterType="com.iformall.domain.po.WxCampaign"> | |||||
| update wx_activity set is_expired=${isExpired} where status=${status} and now()>end_time | |||||
| </update> | |||||
| <update id="activityCompletion" parameterType="com.iformall.domain.po.WxCampaign"> | |||||
| update wx_activity set status#{status} where status!=${status} and now()>activity_end_time | |||||
| </update> | |||||
| </mapper> | |||||
| @@ -22,22 +22,11 @@ | |||||
| <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="html" jdbcType="VARCHAR" property="html"/> | <result column="html" jdbcType="VARCHAR" property="html"/> | ||||
| <result column="person_limit" jdbcType="INTEGER" property="personLimit"/> | |||||
| <result column="activity_start_time" jdbcType="TIMESTAMP" property="activityStartTime"/> | |||||
| <result column="activity_end_time" jdbcType="TIMESTAMP" property="activityEndTime"/> | |||||
| <result column="use_credit" jdbcType="INTEGER" property="useCredit"/> | |||||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||||
| <result column="question" jdbcType="VARCHAR" property="question"/> | |||||
| <result column="is_expired" jdbcType="INTEGER" property="isExpired"/> | |||||
| <result column="activity_type" jdbcType="INTEGER" property="activityType"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`, | `id`,`tenant_id`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`, | ||||
| `mechant_id`,`sort_num`,`status`,`create_time`,`update_time`,`html`, | |||||
| `person_limit`,`activity_start_time`,`activity_end_time`,`use_credit`,`credit`,`question`,`is_expired`,`activity_type` | |||||
| `mechant_id`,`sort_num`,`status`,`create_time`,`update_time`,`html` | |||||
| </sql> | </sql> | ||||
| <sql id="allCHeadColumns"> | <sql id="allCHeadColumns"> | ||||
| @@ -124,21 +113,6 @@ | |||||
| <if test=" null != updateTime "> | <if test=" null != updateTime "> | ||||
| and `update_time` = #{updateTime} | and `update_time` = #{updateTime} | ||||
| </if> | </if> | ||||
| <if test=" null != useCredit "> | |||||
| and `use_credit` = #{useCredit} | |||||
| </if> | |||||
| <if test=" null != isExpired "> | |||||
| and `is_expired` = #{isExpired} | |||||
| </if> | |||||
| <if test=" null != activityType "> | |||||
| and `activity_type` = #{activityType} | |||||
| </if> | |||||
| <if test=" null != starttime and null!=endtime "> | |||||
| and `create_time` between #{starttime} and #{endtime} | |||||
| </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=")"> | ||||
| @@ -165,19 +139,5 @@ | |||||
| <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer"> | <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer"> | ||||
| select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId} | select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId} | ||||
| </select> | </select> | ||||
| <select id="queryNotify" parameterType="com.iformall.domain.po.WxCampaign" | |||||
| resultType="com.iformall.domain.po.WxCampaign"> | |||||
| select id,title,activity_start_time,tenant_id from wx_campaign where status=${status} and DATEDIFF(activity_start_time,now())=3 | |||||
| </select> | |||||
| <update id="campaignExipred" parameterType="com.iformall.domain.po.WxCampaign"> | |||||
| update wx_campaign set is_expired=${isExpired} where status=${status} and now()>valid_end_date | |||||
| </update> | |||||
| <update id="campaignCompletion" parameterType="com.iformall.domain.po.WxCampaign"> | |||||
| update wx_campaign set status=#{status} where status!=${status} and now()>activity_end_time | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||