| @@ -41,6 +41,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_level_config", | |||
| "wx_c_user_basic_info", | |||
| "wx_c_user_basic_child", | |||
| "wx_c_user_basic_sign", | |||
| "wx_credit_history", | |||
| "wx_score_history", | |||
| "wx_c_user_tags", | |||
| @@ -73,6 +74,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_weapp_release_status", | |||
| "wx_c_user_basic_info", | |||
| "wx_c_user_basic_child", | |||
| "wx_c_user_basic_sign", | |||
| "mem_coupon_from_dsp", | |||
| "wx_msg_validationcode_model", | |||
| "sys_notice", | |||
| @@ -1,11 +1,11 @@ | |||
| --type=2 积分规则,追加签到规则 | |||
| update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 17, "desc": "每日签到", "step": 1, "limit": 1, "score": 0}' AS JSON)) | |||
| where type = 2; | |||
| update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 18, "desc": "连续签到7天", "step": 1, "limit": 1, "score": 0}' AS JSON)) | |||
| update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 18, "desc": "连续签到7天奖励", "step": 1, "limit": 1, "score": 0}' AS JSON)) | |||
| where type = 2; | |||
| update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 19, "desc": "连续签到14天", "step": 1, "limit": 1, "score": 0}' AS JSON)) | |||
| update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 19, "desc": "连续签到14天奖励", "step": 1, "limit": 1, "score": 0}' AS JSON)) | |||
| where type = 2; | |||
| update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 20, "desc": "连续签到28天", "step": 1, "limit": 1, "score": 0}' AS JSON)) | |||
| update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 20, "desc": "连续签到28天奖励", "step": 1, "limit": 1, "score": 0}' AS JSON)) | |||
| where type = 2; | |||
| --type=2 积分规则,每日登陆去掉-- 缓存--缓存--缓存 | |||
| @@ -0,0 +1,28 @@ | |||
| update wx_miniapp_theme_deploy set default_icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/new_kanjia.png" where id = 4444; | |||
| update wx_miniapp_theme_deploy set default_icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/new_pintuan.png" where id = 4455; | |||
| update wx_miniapp_theme_deploy set default_icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/zhibo.png" where id = 4466; | |||
| update wx_miniapp_theme_deploy set default_icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/new_xiaofeika.png" where id = 4477; | |||
| update wx_miniapp_theme_deploy set default_icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/jifen.png" where id = 4488; | |||
| INSERT INTO `wx_miniapp_theme_deploy`(`id`, `name`, `remarks`, `theme_type`, `default_icon`, `default_style`) VALUES (4499, "sy_qd", "首页签到图标", 2, "https://formall.oss-accelerate.aliyuncs.com/cimg/qiandao.png", NULL); | |||
| INSERT INTO `wx_miniapp_theme_deploy`(`id`, `name`, `remarks`, `theme_type`, `default_icon`, `default_style`) VALUES (5500, "sy_hd", "首页活动图标", 2, "https://formall.oss-accelerate.aliyuncs.com/cimg/huodong.png", NULL); | |||
| INSERT INTO `wx_miniapp_theme_deploy`(`id`, `name`, `remarks`, `theme_type`, `default_icon`, `default_style`) VALUES (5511, "sy_yx", "首页游戏图标", 2, "https://formall.oss-accelerate.aliyuncs.com/cimg/youxi.png", NULL); | |||
| INSERT INTO `wx_miniapp_theme_value`(`id`, `miniapp_theme_id`, `miniapp_deploy_id`, `icon`, `style_class`) VALUES (1010, 2, 4499, NULL, NULL); | |||
| INSERT INTO `wx_miniapp_theme_value`(`id`, `miniapp_theme_id`, `miniapp_deploy_id`, `icon`, `style_class`) VALUES (1020, 2, 5500, NULL, NULL); | |||
| INSERT INTO `wx_miniapp_theme_value`(`id`, `miniapp_theme_id`, `miniapp_deploy_id`, `icon`, `style_class`) VALUES (1030, 2, 5511, NULL, NULL); | |||
| INSERT INTO `wx_miniapp_theme_value`(`id`, `miniapp_theme_id`, `miniapp_deploy_id`, `icon`, `style_class`) VALUES (3010, 3, 4499, NULL, NULL); | |||
| INSERT INTO `wx_miniapp_theme_value`(`id`, `miniapp_theme_id`, `miniapp_deploy_id`, `icon`, `style_class`) VALUES (3020, 3, 5500, NULL, NULL); | |||
| INSERT INTO `wx_miniapp_theme_value`(`id`, `miniapp_theme_id`, `miniapp_deploy_id`, `icon`, `style_class`) VALUES (3030, 3, 5511, NULL, NULL); | |||
| update wx_miniapp_theme_value set icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/new_kanjia_red.png" where miniapp_theme_id = 3 and miniapp_deploy_id = 4444; | |||
| update wx_miniapp_theme_value set icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/new_pintuan_red.png" where miniapp_theme_id = 3 and miniapp_deploy_id = 4455; | |||
| update wx_miniapp_theme_value set icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/zhibo_red.png" where miniapp_theme_id = 3 and miniapp_deploy_id = 4466; | |||
| update wx_miniapp_theme_value set icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/new_xiaofeika_red.png" where miniapp_theme_id = 3 and miniapp_deploy_id = 4477; | |||
| update wx_miniapp_theme_value set icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/jifen_red.png" where miniapp_theme_id = 3 and miniapp_deploy_id = 4488; | |||
| update wx_miniapp_theme_value set icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/qiandao_red.png" where miniapp_theme_id = 3 and miniapp_deploy_id = 4499; | |||
| update wx_miniapp_theme_value set icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/huodong_red.png" where miniapp_theme_id = 3 and miniapp_deploy_id = 5500; | |||
| update wx_miniapp_theme_value set icon = "https://formall.oss-accelerate.aliyuncs.com/cimg/youxi_red.png" where miniapp_theme_id = 3 and miniapp_deploy_id = 5511; | |||
| @@ -0,0 +1,7 @@ | |||
| ALTER TABLE `wx_activity` | |||
| ADD COLUMN `activity_type` smallint(2) NOT NULL DEFAULT 1 COMMENT '活动类型(是否需要报名1是0否)' AFTER `html`, | |||
| ADD COLUMN `signup_examine` smallint(2) NOT NULL DEFAULT 1 COMMENT '报名审核 1是0否(activity_type=1时必填)' AFTER `person_limit`, | |||
| MODIFY COLUMN `person_limit` int(11) COMMENT '报名人数(activity_type=1时必填)' AFTER `activity_type`, | |||
| MODIFY COLUMN `start_time` datetime(0) COMMENT '活动报名开始时间(activity_type=1时必填)' AFTER `status`, | |||
| MODIFY COLUMN `end_time` datetime(0) COMMENT '活动报名结束时间(activity_type=1时必填)' AFTER `start_time`, | |||
| MODIFY COLUMN `question` json COMMENT '问题' AFTER `end_time`; | |||
| @@ -36,6 +36,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_level_config", | |||
| "wx_c_user_basic_info", | |||
| "wx_c_user_basic_child", | |||
| "wx_c_user_basic_sign", | |||
| "wx_credit_history", | |||
| "wx_score_history", | |||
| "wx_c_user_tags", | |||
| @@ -50,6 +51,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_c_user", | |||
| "wx_c_user_basic_info", | |||
| "wx_c_user_basic_child", | |||
| "wx_c_user_basic_sign", | |||
| "wx_c_user_car", | |||
| "wx_c_user_from_b", | |||
| "wx_c_user_tags", | |||
| @@ -45,7 +45,7 @@ public class WxActivityController extends BaseController { | |||
| public ResultData list(@ModelAttribute WxActivity wxActivity, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxActivityController::list"); | |||
| if (null == wxActivity) wxActivity = new WxActivity(); | |||
| wxActivity.setStatus(EnumActivityStatus.INJECT_ONLINE.getCode()); | |||
| wxActivity.setStatus(EnumActivityStatus.INJECT_ONLINES.getCode()); | |||
| wxActivity.updateTenantInfo(getTenantInfo()); | |||
| wxActivity.setSortColumns(BaseEntity.SortField.ActivityStartTime_DESC,BaseEntity.SortField.Id_DESC); | |||
| final PageInfo<WxActivity> page = wxActivityService.listAsPage(wxActivity, pageNum, pageSize); | |||
| @@ -60,7 +60,7 @@ public class WxActivityController extends BaseController { | |||
| public ResultData listStatus(@ModelAttribute WxActivity wxActivity) { | |||
| logger.debug("[" + getIpAddr() + "] WxActivityController::list"); | |||
| if (null == wxActivity) wxActivity = new WxActivity(); | |||
| wxActivity.setStatus(EnumActivityStatus.INJECT_ONLINE.getCode()); | |||
| wxActivity.setStatus(EnumActivityStatus.INJECT_ONLINES.getCode()); | |||
| wxActivity.updateTenantInfo(getTenantInfo()); | |||
| wxActivity.setSortColumns(BaseEntity.SortField.ActivityStartTime_DESC,BaseEntity.SortField.Id_DESC); | |||
| if(wxActivity.getStartDate() == null || wxActivity.getEndDate() == null){ | |||
| @@ -1,18 +1,14 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.RedisCache; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMiniappTheme; | |||
| import com.iformall.domain.po.WxMiniappThemeValue; | |||
| import com.iformall.domain.po.WxThemeMall; | |||
| import com.iformall.enums.EnumThemeType; | |||
| import com.iformall.service.WxMiniappThemeService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -36,6 +36,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_level_config", | |||
| "wx_c_user_basic_info", | |||
| "wx_c_user_basic_child", | |||
| "wx_c_user_basic_sign", | |||
| "wx_credit_history", | |||
| "wx_score_history", | |||
| "wx_c_user_tags", | |||
| @@ -50,6 +51,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_c_user", | |||
| "wx_c_user_basic_info", | |||
| "wx_c_user_basic_child", | |||
| "wx_c_user_basic_sign", | |||
| "wx_c_user_car", | |||
| "wx_c_user_from_b", | |||
| "wx_c_user_tags", | |||
| @@ -541,6 +541,14 @@ public enum ErrorCode{ | |||
| ACTIVITY_WAIT_CONFIRMED(30006, "您报名的活动还在审核中"), | |||
| ACTIVITY_EXPIRED(30007, "您报名的活动已过期"), | |||
| ACTIVITY_SEND_ERROR_NOONLINE(30008, "活动投放到宣传页失败,活动未上线!"), | |||
| ACTIVITY_NOT_FOND(30009, "活动未找到!"), | |||
| ACTIVITY_JOIN_TIME_START(30010, "活动报名时间未开始!"), | |||
| ACTIVITY_JOIN_END_TIME_BEFORE(30011, "活动报名结束时间不能小于当前时间"), | |||
| ACTIVITY_END_TIME_BEFORE(30012, "活动结束时间不能小于当前时间"), | |||
| ACTIVITY_NOT_JOIN(30013, "该活动不需要报名!"), | |||
| ACTIVITY_JOIN_IS_SIGNIN(30014, "用户已签到!"), | |||
| ACTIVITY_JOIN_NOT_FOND(30015, "活动报名未找到!"), | |||
| ACTIVITY_NOT_UPDATE(30016, "下线状态,不允许修改!"), | |||
| /** | |||
| * 文件上传 | |||
| @@ -35,6 +35,13 @@ public class WxActivity extends TenantEntity { | |||
| private Integer personLimit; | |||
| @io.swagger.annotations.ApiModelProperty(value = "活动正文", name = "detail") | |||
| private String detail; | |||
| @io.swagger.annotations.ApiModelProperty(value = "活动类型(是否需要报名1是0否)", name = "activityType") | |||
| private Integer activityType; | |||
| @io.swagger.annotations.ApiModelProperty(value = "报名审核 1是0否(activity_type=1时必填)", name = "signupExamine") | |||
| private Integer signupExamine; | |||
| @io.swagger.annotations.ApiModelProperty(value = "活动开始报名时间", name = "startTime") | |||
| private Date startTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "活动结束报名时间", name = "endTime") | |||
| @@ -115,5 +122,9 @@ public class WxActivity extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "常见问题选择", name = "selectques") | |||
| private String selectques; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "报名状态", name = "joinStatus") | |||
| private Integer joinStatus; | |||
| } | |||
| @@ -52,6 +52,7 @@ public class WxCUserBasicSign extends TenantEntity { | |||
| private String mark; | |||
| @TableField(exist = false) | |||
| private Date startDate; | |||
| @@ -64,4 +65,7 @@ public class WxCUserBasicSign extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private Integer limit; | |||
| @TableField(exist = false) | |||
| private Integer credit; | |||
| } | |||
| @@ -27,7 +27,7 @@ public class BaseTenantEntity extends BaseEntity { | |||
| protected String finalTenantId; | |||
| public String getFinalTenantId() { | |||
| if (!StringUtils.isBlank(parentTenantId)) { | |||
| if (StringUtils.isNotBlank(parentTenantId)) { | |||
| return parentTenantId; | |||
| } | |||
| return tenantId; | |||
| @@ -42,8 +42,8 @@ public class BaseTenantEntity extends BaseEntity { | |||
| protected String shardFinalTableSuffix; | |||
| public String getShardFinalTableSuffix(){ | |||
| if(StringUtils.isNotBlank(finalTenantId)){ | |||
| shardFinalTableSuffix = "_" + Integer.parseInt(finalTenantId)%100; | |||
| if(StringUtils.isNotBlank(getFinalTenantId())){ | |||
| shardFinalTableSuffix = "_" + Integer.parseInt(getFinalTenantId())%100; | |||
| } | |||
| return shardFinalTableSuffix; | |||
| } | |||
| @@ -9,7 +9,8 @@ public enum EnumActivityStatus { | |||
| STATUS_THROW_IN(0, "已保存"), | |||
| STATUS_TAKE_OFFF(1, "已下线"), | |||
| INJECT_CAMPAIGN(2, "已投放"), | |||
| INJECT_ONLINE(3, "已上线"),; | |||
| INJECT_ONLINE(3, "已上线"), | |||
| INJECT_ONLINES(4, "上过线"),;//查询状态 | |||
| public static EnumActivityStatus getEnum(Integer code) { | |||
| for (EnumActivityStatus value : values()) { | |||
| @@ -18,7 +18,7 @@ public interface WxActivityJoinMapper extends CommonMapper<WxActivityJoin, Long> | |||
| void updateSendMsg(Map<String, Object> param); | |||
| void updateStatus(List<WxActivity> wxActivity); | |||
| // void updateStatus(List<WxActivity> wxActivity); | |||
| void activityExpired(); | |||
| } | |||
| @@ -25,7 +25,7 @@ public interface WxCUserBasicSignService { | |||
| Map<String,Integer> getLastSignIn(WxCUserBasicSign record); | |||
| void signInCreditHistory(WxCUserBasicSign record, EnumScoreType enumScoreType); | |||
| int signInCreditHistory(WxCUserBasicSign record, EnumScoreType enumScoreType); | |||
| ResultData getListStatus(WxCUserBasicSign wxCUserBasicSign); | |||
| } | |||
| @@ -73,6 +73,10 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||
| @Override | |||
| public ResultData modifyStatus(WxActivityJoin wxActivityJoin) { | |||
| WxActivityJoin wxActivityJoin1 = wxActivityJoinMapper.selectById(wxActivityJoin.getId()); | |||
| if(wxActivityJoin1 == null){ | |||
| return new ResultData(ErrorCode.ACTIVITY_JOIN_NOT_FOND); | |||
| } | |||
| if (wxActivityJoin.getStatus().equals(EnumActivityJoinStatus.CONFIRMED.getCode())) { | |||
| WxActivity wxActivity = wxActivityMapper.selectById(wxActivityJoin.getActivityId()); | |||
| Integer personLimit = wxActivity.getPersonLimit(); | |||
| @@ -84,7 +88,12 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||
| if (personLimit.equals(count)) { | |||
| return new ResultData(ErrorCode.ACTIVITY_PERSON_LIMITED, count); | |||
| } | |||
| }else{ | |||
| if(wxActivityJoin1.getSignIn().equals(EnumActivityJoinSignStatus.YES.getCode())){ | |||
| return new ResultData(ErrorCode.ACTIVITY_JOIN_IS_SIGNIN); | |||
| } | |||
| } | |||
| wxActivityJoinMapper.updateById(wxActivityJoin); | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| } | |||
| @@ -166,6 +175,24 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||
| @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData join(WxActivityJoin wxActivityJoin) { | |||
| WxActivity wxActivity = wxActivityMapper.selectById(wxActivityJoin.getActivityId()); | |||
| if(wxActivity == null){ | |||
| return new ResultData(ErrorCode.ACTIVITY_NOT_FOND); | |||
| } | |||
| Date date = new Date(); | |||
| if(wxActivity.getActivityType().equals(EnumDelFlag.YES.getCode())){ | |||
| if(date.getTime() < wxActivity.getStartTime().getTime()){ | |||
| return new ResultData(ErrorCode.ACTIVITY_JOIN_TIME_START); | |||
| } | |||
| if(date.getTime() > wxActivity.getEndTime().getTime()){ | |||
| return new ResultData(ErrorCode.ACTIVITY_JOIN_TIME_END); | |||
| } | |||
| }else{ | |||
| return new ResultData(ErrorCode.ACTIVITY_NOT_JOIN); | |||
| } | |||
| WxActivityJoin joinQuery = new WxActivityJoin(); | |||
| joinQuery.setUserId(wxActivityJoin.getUserId()); | |||
| joinQuery.setActivityId(wxActivityJoin.getActivityId()); | |||
| @@ -173,10 +200,22 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.ACTIVITY_JOINED); | |||
| } | |||
| if(wxActivity.getSignupExamine().equals(EnumDelFlag.YES.getCode())){ | |||
| wxActivityJoin.setStatus(EnumActivityJoinStatus.NOT_CONFIRMED.getCode()); | |||
| }else{ | |||
| WxActivityJoin params = new WxActivityJoin(); | |||
| params.updateTenantInfo(wxActivity); | |||
| params.setActivityId(wxActivity.getId()); | |||
| params.setStatus(EnumActivityJoinStatus.CONFIRMED.getCode()); | |||
| int joinCount = wxActivityJoinMapper.selectCount(new QueryWrapper(params)); | |||
| if (joinCount >= wxActivity.getPersonLimit().intValue()) { | |||
| return new ResultData(ErrorCode.ACTIVITY_PERSON_LIMITED, joinCount); | |||
| } | |||
| wxActivityJoin.setStatus(EnumActivityJoinStatus.CONFIRMED.getCode()); | |||
| } | |||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(wxActivityJoin.getUserId(),wxActivityJoin.getFinalTenantId()); | |||
| //查询是否消耗积分 | |||
| WxActivity wxActivity = wxActivityMapper.selectById(wxActivityJoin.getActivityId()); | |||
| Date date = new Date(); | |||
| if (wxActivity.getUseCredit().equals(EnumActivityUseCreditStatus.YES.getCode())) { | |||
| Integer credit = wxActivity.getCredit(); | |||
| //积分历史 | |||
| @@ -192,6 +231,7 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||
| wxCreditHistory.setOperatorId(wxActivityJoin.getUserId()); | |||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxActivity.getTenantId()); | |||
| } | |||
| //保存到报名表中 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxActivityJoin.setId(idWorker.nextId()); | |||
| @@ -93,23 +93,59 @@ public class WxActivityServiceImpl implements WxActivityService { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "图文内容过大无法保存"); | |||
| } | |||
| } else { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"type"); | |||
| } | |||
| wxActivity.setStatus(EnumActivityStatus.STATUS_THROW_IN.getCode()); | |||
| if (wxActivity.getEndTime().before(new Date())) { | |||
| throw new MallinkException(ErrorCode.ACTIVITY_JOIN_TIME_END); | |||
| if(wxActivity.getActivityStartTime() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "活动开始时间不能为空"); | |||
| } | |||
| if(wxActivity.getActivityEndTime() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "活动结束时间不能为空"); | |||
| } | |||
| if (wxActivity.getEndTime().after(wxActivity.getActivityEndTime())) { | |||
| throw new MallinkException(ErrorCode.ACTIVITY_TIME_ERROR); | |||
| if(wxActivity.getActivityType() == null){ | |||
| wxActivity.setActivityType(EnumDelFlag.YES.getCode()); | |||
| } | |||
| if(wxActivity.getActivityType().equals(EnumDelFlag.YES.getCode())){ | |||
| if(wxActivity.getSignupExamine() == null){ | |||
| wxActivity.setSignupExamine(EnumDelFlag.YES.getCode()); | |||
| } | |||
| if(wxActivity.getPersonLimit() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "报名人数不能为空"); | |||
| } | |||
| if(wxActivity.getStartTime() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "报名开始时间不能为空"); | |||
| } | |||
| if(wxActivity.getEndTime() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "报名结束时间不能为空"); | |||
| } | |||
| if (wxActivity.getEndTime().before(new Date())) { | |||
| throw new MallinkException(ErrorCode.ACTIVITY_JOIN_END_TIME_BEFORE); | |||
| } | |||
| if (wxActivity.getEndTime().after(wxActivity.getActivityEndTime())) { | |||
| throw new MallinkException(ErrorCode.ACTIVITY_TIME_ERROR); | |||
| } | |||
| }else if(wxActivity.getActivityType().equals(EnumDelFlag.NO.getCode())){ | |||
| if (wxActivity.getActivityEndTime().before(new Date())) { | |||
| throw new MallinkException(ErrorCode.ACTIVITY_END_TIME_BEFORE); | |||
| } | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"activityType"); | |||
| } | |||
| wxActivity.setStatus(EnumActivityStatus.STATUS_THROW_IN.getCode()); | |||
| Date date = new Date(); | |||
| wxActivity.setCreateTime(date); | |||
| wxActivity.setUpdateTime(date); | |||
| if (wxActivity.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxActivity.setId(idWorker.nextId()); | |||
| wxActivity.setCreateTime(date); | |||
| wxActivityMapper.insert(wxActivity); | |||
| } else { | |||
| WxActivity wxActivity1 = wxActivityMapper.selectById(wxActivity.getId()); | |||
| if(wxActivity1.getStatus().equals(EnumActivityStatus.STATUS_TAKE_OFFF.getCode())){ | |||
| return new ResultData(ErrorCode.ACTIVITY_NOT_UPDATE); | |||
| } | |||
| wxActivityMapper.updateById(wxActivity); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| @@ -226,7 +262,8 @@ public class WxActivityServiceImpl implements WxActivityService { | |||
| return EnumActivityEnrollStatus.NOT_START.getCode(); | |||
| } | |||
| Date date = new Date(); | |||
| if (wxActivity.getStatus().equals(EnumActivityStatus.INJECT_CAMPAIGN.getCode())) { | |||
| if (wxActivity.getStatus().equals(EnumActivityStatus.INJECT_CAMPAIGN.getCode()) | |||
| || wxActivity.getStatus().equals(EnumActivityStatus.INJECT_ONLINE.getCode())) { | |||
| //报名未开始 | |||
| if (wxActivity.getStartTime().after(date)) { | |||
| return EnumActivityEnrollStatus.NOT_START.getCode(); | |||
| @@ -269,17 +306,21 @@ public class WxActivityServiceImpl implements WxActivityService { | |||
| if(activityList != null){ | |||
| for (WxActivity activity:activityList) { | |||
| Date start = activity.getActivityStartTime(); | |||
| Date end = activity.getActivityEndTime(); | |||
| Date start = DateUtils.getDateZero(activity.getActivityStartTime()); | |||
| Date end = DateUtils.getDateZero(activity.getActivityEndTime()); | |||
| Calendar dd = Calendar.getInstance(); | |||
| dd.setTime(start); | |||
| while (start.getTime() < end.getTime()) { | |||
| Map map = new HashMap<>(); | |||
| map.put("yyyy", DateUtils.getYear(start)); | |||
| map.put("mm", DateUtils.getMonth(start)); | |||
| map.put("dd", DateUtils.getMonthOfDate(start)); | |||
| list.add(map); | |||
| while (start.getTime() <= end.getTime()) { | |||
| if(start.getTime() >= wxActivity.getStartDate().getTime() | |||
| && start.getTime() <= wxActivity.getEndDate().getTime()){ | |||
| Map map = new HashMap<>(); | |||
| map.put("yyyy", DateUtils.getYear(start)); | |||
| map.put("mm", DateUtils.getMonth(start)); | |||
| map.put("dd", DateUtils.getMonthOfDate(start)); | |||
| list.add(map); | |||
| } | |||
| // 天数加上1 | |||
| dd.add(Calendar.DAY_OF_MONTH, 1); | |||
| start = dd.getTime(); | |||
| @@ -113,8 +113,9 @@ public class WxCUserBasicSignServiceImpl implements WxCUserBasicSignService { | |||
| } | |||
| wxCUserBasicSignMapper.insert(record); | |||
| } | |||
| signInCreditHistory(record,EnumScoreType.SIGN_IN_DAY); | |||
| continueSignInAddCredit(record); | |||
| int inCredit = signInCreditHistory(record, EnumScoreType.SIGN_IN_DAY); | |||
| int continueIn = continueSignInAddCredit(record); | |||
| record.setCredit(inCredit + continueIn); | |||
| return record; | |||
| }else{ | |||
| //补签 | |||
| @@ -157,7 +158,11 @@ public class WxCUserBasicSignServiceImpl implements WxCUserBasicSignService { | |||
| long daysL = DateUtils.startToEnd(lastSignIn.getSigninDate(), new Date()); | |||
| int daysI = new Long(daysL).intValue(); | |||
| if(daysI == 0){ | |||
| map.put("continueSign",lastSignIn.getContinueSign()%28); | |||
| int i = lastSignIn.getContinueSign() % 28; | |||
| if(i == 0){ | |||
| i=28; | |||
| } | |||
| map.put("continueSign",i); | |||
| map.put("signInDay",1);//今日已签到 | |||
| }else if(daysI == 1){ | |||
| map.put("continueSign",lastSignIn.getContinueSign()%28); | |||
| @@ -213,7 +218,7 @@ public class WxCUserBasicSignServiceImpl implements WxCUserBasicSignService { | |||
| } | |||
| @Override | |||
| public void signInCreditHistory(WxCUserBasicSign record, EnumScoreType enumScoreType){ | |||
| public int signInCreditHistory(WxCUserBasicSign record, EnumScoreType enumScoreType){ | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setCUserId(record.getUserId()); | |||
| wxCreditHistory.setTenantId(record.getFinalTenantId()); | |||
| @@ -222,7 +227,11 @@ public class WxCUserBasicSignServiceImpl implements WxCUserBasicSignService { | |||
| wxCreditHistory.setChangePurpose(enumScoreType.getMessage()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | |||
| wxCreditHistory.setOperatorId(record.getUserId()); | |||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,null); | |||
| WxCreditHistory wxCreditHistory1 = wxCreditHistoryService.saveOrUpdate(wxCreditHistory, null); | |||
| if(wxCreditHistory1.getCreditNum() == null){ | |||
| return 0; | |||
| } | |||
| return wxCreditHistory1.getCreditNum(); | |||
| } | |||
| @Override | |||
| @@ -241,15 +250,16 @@ public class WxCUserBasicSignServiceImpl implements WxCUserBasicSignService { | |||
| return new ResultData(list); | |||
| } | |||
| private void continueSignInAddCredit(WxCUserBasicSign record){ | |||
| private int continueSignInAddCredit(WxCUserBasicSign record){ | |||
| int i = record.getContinueSign() % 28; | |||
| if(record.getContinueSign() > 0 && i == 0){ | |||
| signInCreditHistory(record,EnumScoreType.SIGN_IN_TEDAY); | |||
| return signInCreditHistory(record, EnumScoreType.SIGN_IN_TEDAY); | |||
| }else if(i == 7){ | |||
| signInCreditHistory(record,EnumScoreType.SIGN_IN_SEVENDAY); | |||
| return signInCreditHistory(record,EnumScoreType.SIGN_IN_SEVENDAY); | |||
| }else if(i == 14){ | |||
| signInCreditHistory(record,EnumScoreType.SIGN_IN_FTDAY); | |||
| return signInCreditHistory(record,EnumScoreType.SIGN_IN_FTDAY); | |||
| } | |||
| return 0; | |||
| } | |||
| } | |||
| @@ -1374,6 +1374,7 @@ public class DateUtils { | |||
| cal.set(Calendar.HOUR_OF_DAY, 0); | |||
| cal.set(Calendar.MINUTE, 0); | |||
| cal.set(Calendar.SECOND, 0); | |||
| cal.set(Calendar.MILLISECOND, 0); | |||
| return cal.getTime(); | |||
| } | |||
| @@ -80,7 +80,7 @@ | |||
| <select id="cfindList" parameterType="com.iformall.domain.po.WxActivityJoin" | |||
| resultType="com.iformall.domain.po.WxActivity"> | |||
| select a.id,a.cover_img,a.title,a.activity_start_time,a.activity_end_time,aj.`status` | |||
| select a.id,a.cover_img,a.title,a.activity_start_time,a.activity_end_time,aj.`status` join_status,a.`status` | |||
| from wx_activity_join aj left join wx_activity a on aj.activity_id=a.id | |||
| where aj.user_id=#{userId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| @@ -89,11 +89,17 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and aj.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != statusStr and ''!=statusStr"> | |||
| and aj.`status` in (${statusStr}) and a.`status`=2 | |||
| <if test=" null != statusStr and '' != statusStr"> | |||
| and a.`status` in (${statusStr}) | |||
| </if> | |||
| <!-- <if test=" null != statusStr and ''!=statusStr">--> | |||
| <!-- and aj.`status` in (${statusStr}) and a.`status`=2--> | |||
| <!-- </if>--> | |||
| <!-- <if test=" null != status">--> | |||
| <!-- and a.`status`= 1--> | |||
| <!-- </if>--> | |||
| <if test=" null != status"> | |||
| and a.`status`= 1 | |||
| and aj.`status`= #{status} | |||
| </if> | |||
| <if test=" null != sortColumns">order by aj.${sortColumns}</if> | |||
| </select> | |||
| @@ -17,6 +17,8 @@ | |||
| <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_type" jdbcType="INTEGER" property="activityType"/> | |||
| <result column="signup_examine" jdbcType="INTEGER" property="signupExamine"/> | |||
| <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"/> | |||
| @@ -31,7 +33,7 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`cover_img`,`title`,`sub_title`,`detail`,`html`,`person_limit`,`activity_start_time`,`activity_end_time`, | |||
| `id`,`tenant_id`,`parent_tenant_id`,`cover_img`,`title`,`sub_title`,`detail`,`html`,`activity_type`,`signup_examine`,`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`,`send_msg`,`selectques` | |||
| </sql> | |||
| @@ -65,14 +67,25 @@ | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != activityType "> | |||
| and `activity_type` = #{activityType} | |||
| </if> | |||
| <if test=" null != signupExamine "> | |||
| and `signup_examine` = #{signupExamine} | |||
| </if> | |||
| <if test=" null != status and status != 3"> | |||
| <if test=" null != status and status lt 3"> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != status and status == 3"> | |||
| and `status` >= 2 and `status` <= 3 | |||
| </if> | |||
| <if test=" null != status and status == 4"> | |||
| and `status` > 0 | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| @@ -94,8 +107,10 @@ | |||
| <!-- </if>--> | |||
| <if test=" null != startDate and null != endDate "> | |||
| and ((`activity_start_time` >= #{startDate} and `activity_start_time` <= #{endDate}) | |||
| or (`activity_end_time` >= #{startDate} and `activity_end_time` <= #{endDate})) | |||
| and not(`activity_end_time` < #{startDate, jdbcType=TIMESTAMP} or `activity_start_time` > #{endDate, jdbcType=TIMESTAMP}) | |||
| <!-- and ((`activity_start_time` >= #{startDate} and `activity_start_time` <= #{endDate}) | |||
| or (`activity_end_time` >= #{startDate} and `activity_end_time` <= #{endDate}) | |||
| or (`activity_start_time` <= #{startDate} and `activity_end_time` >= #{endDate}))--> | |||
| </if> | |||
| <if test=" null != sendMsg "> | |||