12个文件已删除
11个文件已修改
54个文件已添加
| | |
| | | <artifactId>service-daylucky</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>service-daylucky</name> |
| | | <description>抽奖服务</description> |
| | | <description>天天抽奖服务</description> |
| | | |
| | | <packaging>war</packaging> |
| | | |
| | |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | <!-- MyBatis插件 --> |
| | | <!--<plugin>--> |
| | | <!--<groupId>org.mybatis.generator</groupId>--> |
| | | <!--<artifactId>mybatis-generator-maven-plugin</artifactId>--> |
| | | <!--<version>1.3.2</version>--> |
| | | <!--<configuration>--> |
| | | <!--<!–配置文件的位置–>--> |
| | | <!--<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>--> |
| | | <!--<verbose>true</verbose>--> |
| | | <!--<overwrite>true</overwrite>--> |
| | | <!--</configuration>--> |
| | | <!--<executions>--> |
| | | <!--<execution>--> |
| | | <!--<id>Generate MyBatis Artifacts</id>--> |
| | | <!--<goals>--> |
| | | <!--<goal>generate</goal>--> |
| | | <!--</goals>--> |
| | | <!--</execution>--> |
| | | <!--</executions>--> |
| | | <!--<dependencies>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.mybatis.generator</groupId>--> |
| | | <!--<artifactId>mybatis-generator-core</artifactId>--> |
| | | <!--<version>1.3.2</version>--> |
| | | <!--</dependency>--> |
| | | <!--</dependencies>--> |
| | | <!--</plugin>--> |
| | | <plugin> |
| | | <groupId>org.mybatis.generator</groupId> |
| | | <artifactId>mybatis-generator-maven-plugin</artifactId> |
| | | <version>1.3.2</version> |
| | | <configuration> |
| | | <!--配置文件的位置--> |
| | | <configurationFile>src/main/resources/generatorConfig.xml</configurationFile> |
| | | <verbose>true</verbose> |
| | | <overwrite>true</overwrite> |
| | | </configuration> |
| | | <executions> |
| | | <execution> |
| | | <id>Generate MyBatis Artifacts</id> |
| | | <goals> |
| | | <goal>generate</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.mybatis.generator</groupId> |
| | | <artifactId>mybatis-generator-core</artifactId> |
| | | <version>1.3.2</version> |
| | | </dependency> |
| | | </dependencies> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | |
| | | package com.ks.daylucky.config; |
| | | |
| | | import com.ks.daylucky.util.mq.CMQConsumeRunner; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | |
| | | Logger log = LoggerFactory.getLogger(CMQConsumeConfig.class); |
| | | |
| | | |
| | | @Bean(initMethod = "start", destroyMethod = "destroy") |
| | | public CMQConsumeRunner xxlJobExecutor() { |
| | | CMQConsumeRunner runner =null; //new AcitivtyConsumer(); |
| | | return runner; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class AnnouncementException extends BaseException { |
| | | |
| | | |
| | | public AnnouncementException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class AppConfigException extends BaseException { |
| | | |
| | | |
| | | public AppConfigException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class MsgTypeConfigException extends BaseException { |
| | | |
| | | |
| | | public MsgTypeConfigException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class UserInfoException extends BaseException { |
| | | |
| | | |
| | | public UserInfoException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class UserMsgException extends BaseException { |
| | | |
| | | |
| | | public UserMsgException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.mapper; |
| | | |
| | | import com.ks.daylucky.pojo.DO.ActivityScanRecord; |
| | | import com.ks.daylucky.query.ActivityScanQuery; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ActivityScanRecordMapper extends BaseMapper<ActivityScanRecord> { |
| | | |
| | | List<ActivityScanRecord> list(ActivityScanQuery query); |
| | | |
| | | long count(ActivityScanQuery query); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.mapper; |
| | | |
| | | import com.ks.daylucky.pojo.DO.ActivityTag; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ActivityTagMapper extends BaseMapper<ActivityTag> { |
| | | |
| | | List<ActivityTag> listByActivityId(Long activityId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.mapper; |
| | | |
| | | import com.ks.daylucky.pojo.DO.Announcement; |
| | | import com.ks.daylucky.query.AnnouncementQuery; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface AnnouncementMapper extends BaseMapper<Announcement> { |
| | | |
| | | List<Announcement> list(AnnouncementQuery query); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.mapper; |
| | | |
| | | import com.ks.daylucky.pojo.DO.AppConfig; |
| | | import com.ks.daylucky.query.AppConfigQuery; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface AppConfigMapper extends BaseMapper<AppConfig> { |
| | | |
| | | List<AppConfig> list(AppConfigQuery query); |
| | | |
| | | long count(AppConfigQuery query); |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.mapper; |
| | | |
| | | import com.ks.daylucky.pojo.DO.MsgTypeConfig; |
| | | import com.ks.daylucky.query.MsgTypeConfigQuery; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface MsgTypeConfigMapper extends BaseMapper<MsgTypeConfig> { |
| | | |
| | | List<MsgTypeConfig> list(MsgTypeConfigQuery query); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.mapper; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserInfoExtra; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | |
| | | public interface UserInfoExtraMapper extends BaseMapper<UserInfoExtra> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.mapper; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | |
| | | public interface UserInfoMapper extends BaseMapper<UserInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.mapper; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.daylucky.query.UserMsgQuery; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface UserMsgMapper extends BaseMapper<UserMsg> { |
| | | |
| | | List<UserMsg> list(UserMsgQuery query); |
| | | |
| | | long count(UserMsgQuery query); |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DO; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | public class ActivityScanRecord { |
| | | private Long id; |
| | | |
| | | @NotNull(message = "用户ID不能为空") |
| | | private Long uid; |
| | | |
| | | @NotNull(message = "活动ID不能为空") |
| | | private Long activityId; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Long getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Long activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DO; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | public class ActivityTag { |
| | | private Long id; |
| | | |
| | | @NotNull(message = "活动ID不能为空") |
| | | private Long activityId; |
| | | |
| | | @NotEmpty(message = "标签名称不能为空") |
| | | private String tagName; |
| | | |
| | | @NotEmpty(message = "标签背景颜色不能为空") |
| | | private String tagBgColor; |
| | | |
| | | @NotEmpty(message = "标签前景色不能为空") |
| | | private String tagFontColr; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | private Integer weight; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Long activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public String getTagName() { |
| | | return tagName; |
| | | } |
| | | |
| | | public void setTagName(String tagName) { |
| | | this.tagName = tagName == null ? null : tagName.trim(); |
| | | } |
| | | |
| | | public String getTagBgColor() { |
| | | return tagBgColor; |
| | | } |
| | | |
| | | public void setTagBgColor(String tagBgColor) { |
| | | this.tagBgColor = tagBgColor == null ? null : tagBgColor.trim(); |
| | | } |
| | | |
| | | public String getTagFontColr() { |
| | | return tagFontColr; |
| | | } |
| | | |
| | | public void setTagFontColr(String tagFontColr) { |
| | | this.tagFontColr = tagFontColr == null ? null : tagFontColr.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) { |
| | | this.weight = weight; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DO; |
| | | |
| | | import org.yeshi.utils.mybatis.Column; |
| | | import org.yeshi.utils.mybatis.Table; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | @Table("announcement") |
| | | public class Announcement { |
| | | public enum AnnouncementType { |
| | | |
| | | } |
| | | |
| | | |
| | | @Column(name = "id") |
| | | private Long id; |
| | | @Column(name = "identity_code") |
| | | private String identityCode; |
| | | |
| | | @Column(name = "app_id") |
| | | @NotNull(message = "应用ID不能为空") |
| | | private Long appId; |
| | | @Column(name = "type") |
| | | @NotNull(message = "公告类型不能为空") |
| | | private AnnouncementType type; |
| | | @Column(name = "name") |
| | | @NotEmpty(message = "名字不能为空") |
| | | private String name; |
| | | |
| | | @Column(name = "content") |
| | | private String content; |
| | | |
| | | @Column(name = "link") |
| | | private String link; |
| | | |
| | | @Column(name = "close") |
| | | private Boolean close; |
| | | |
| | | @Column(name = "show") |
| | | private Boolean show; |
| | | |
| | | @Column(name = "create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "update_time") |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getIdentityCode() { |
| | | return identityCode; |
| | | } |
| | | |
| | | public void setIdentityCode(String identityCode) { |
| | | this.identityCode = identityCode == null ? null : identityCode.trim(); |
| | | } |
| | | |
| | | public AnnouncementType getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(AnnouncementType type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name == null ? null : name.trim(); |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content == null ? null : content.trim(); |
| | | } |
| | | |
| | | public String getLink() { |
| | | return link; |
| | | } |
| | | |
| | | public void setLink(String link) { |
| | | this.link = link == null ? null : link.trim(); |
| | | } |
| | | |
| | | public Boolean getClose() { |
| | | return close; |
| | | } |
| | | |
| | | public void setClose(Boolean close) { |
| | | this.close = close; |
| | | } |
| | | |
| | | public Boolean getShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(Boolean show) { |
| | | this.show = show; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | |
| | | public Long getAppId() { |
| | | return appId; |
| | | } |
| | | |
| | | public void setAppId(Long appId) { |
| | | this.appId = appId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DO; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | public class AppConfig { |
| | | private Long id; |
| | | |
| | | @NotNull(message = "应用ID不能为空") |
| | | private Long appId; |
| | | |
| | | @NotEmpty(message = "配置名称不能为空") |
| | | private String name; |
| | | |
| | | @NotEmpty(message = "key不能为空") |
| | | private String key; |
| | | |
| | | private String value; |
| | | |
| | | private Integer minVersion; |
| | | |
| | | private String remarks; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getAppId() { |
| | | return appId; |
| | | } |
| | | |
| | | public void setAppId(Long appId) { |
| | | this.appId = appId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name == null ? null : name.trim(); |
| | | } |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(String key) { |
| | | this.key = key == null ? null : key.trim(); |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value == null ? null : value.trim(); |
| | | } |
| | | |
| | | public Integer getMinVersion() { |
| | | return minVersion; |
| | | } |
| | | |
| | | public void setMinVersion(Integer minVersion) { |
| | | this.minVersion = minVersion; |
| | | } |
| | | |
| | | public String getRemarks() { |
| | | return remarks; |
| | | } |
| | | |
| | | public void setRemarks(String remarks) { |
| | | this.remarks = remarks == null ? null : remarks.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DO; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | public class MsgTypeConfig { |
| | | private Long id; |
| | | |
| | | @NotNull(message = "应用ID不能为空") |
| | | private Long appId; |
| | | @NotNull(message = "消息类型不能为空") |
| | | private UserMsg.UserMsgType msgType; |
| | | |
| | | @NotEmpty(message = "消息名称不能为空") |
| | | private String msgName; |
| | | |
| | | private String msgIcon; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | public UserMsg.UserMsgType getMsgType() { |
| | | return msgType; |
| | | } |
| | | |
| | | public void setMsgType(UserMsg.UserMsgType msgType) { |
| | | this.msgType = msgType; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getAppId() { |
| | | return appId; |
| | | } |
| | | |
| | | public void setAppId(Long appId) { |
| | | this.appId = appId; |
| | | } |
| | | |
| | | public String getMsgName() { |
| | | return msgName; |
| | | } |
| | | |
| | | public void setMsgName(String msgName) { |
| | | this.msgName = msgName == null ? null : msgName.trim(); |
| | | } |
| | | |
| | | public String getMsgIcon() { |
| | | return msgIcon; |
| | | } |
| | | |
| | | public void setMsgIcon(String msgIcon) { |
| | | this.msgIcon = msgIcon == null ? null : msgIcon.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DO; |
| | | |
| | | import java.util.Date; |
| | | |
| | | public class UserInfo { |
| | | private Long id; |
| | | |
| | | private Long appId; |
| | | |
| | | private String identifyCode; |
| | | |
| | | private String nickName; |
| | | |
| | | private String portrait; |
| | | |
| | | private String mobile; |
| | | |
| | | private String alipayUid; |
| | | |
| | | private String alipayPortrait; |
| | | |
| | | private String wxOpenId; |
| | | |
| | | private String wxUnionId; |
| | | |
| | | private String wxPortrait; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getAppId() { |
| | | return appId; |
| | | } |
| | | |
| | | public void setAppId(Long appId) { |
| | | this.appId = appId; |
| | | } |
| | | |
| | | public String getIdentifyCode() { |
| | | return identifyCode; |
| | | } |
| | | |
| | | public void setIdentifyCode(String identifyCode) { |
| | | this.identifyCode = identifyCode == null ? null : identifyCode.trim(); |
| | | } |
| | | |
| | | public String getNickName() { |
| | | return nickName; |
| | | } |
| | | |
| | | public void setNickName(String nickName) { |
| | | this.nickName = nickName == null ? null : nickName.trim(); |
| | | } |
| | | |
| | | public String getPortrait() { |
| | | return portrait; |
| | | } |
| | | |
| | | public void setPortrait(String portrait) { |
| | | this.portrait = portrait == null ? null : portrait.trim(); |
| | | } |
| | | |
| | | public String getMobile() { |
| | | return mobile; |
| | | } |
| | | |
| | | public void setMobile(String mobile) { |
| | | this.mobile = mobile == null ? null : mobile.trim(); |
| | | } |
| | | |
| | | public String getAlipayUid() { |
| | | return alipayUid; |
| | | } |
| | | |
| | | public void setAlipayUid(String alipayUid) { |
| | | this.alipayUid = alipayUid == null ? null : alipayUid.trim(); |
| | | } |
| | | |
| | | public String getAlipayPortrait() { |
| | | return alipayPortrait; |
| | | } |
| | | |
| | | public void setAlipayPortrait(String alipayPortrait) { |
| | | this.alipayPortrait = alipayPortrait == null ? null : alipayPortrait.trim(); |
| | | } |
| | | |
| | | public String getWxOpenId() { |
| | | return wxOpenId; |
| | | } |
| | | |
| | | public void setWxOpenId(String wxOpenId) { |
| | | this.wxOpenId = wxOpenId == null ? null : wxOpenId.trim(); |
| | | } |
| | | |
| | | public String getWxUnionId() { |
| | | return wxUnionId; |
| | | } |
| | | |
| | | public void setWxUnionId(String wxUnionId) { |
| | | this.wxUnionId = wxUnionId == null ? null : wxUnionId.trim(); |
| | | } |
| | | |
| | | public String getWxPortrait() { |
| | | return wxPortrait; |
| | | } |
| | | |
| | | public void setWxPortrait(String wxPortrait) { |
| | | this.wxPortrait = wxPortrait == null ? null : wxPortrait.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DO; |
| | | |
| | | import java.util.Date; |
| | | |
| | | public class UserInfoExtra { |
| | | private Long uid; |
| | | |
| | | private String msgSetting; |
| | | |
| | | private Integer msgUnreadCount; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getMsgSetting() { |
| | | return msgSetting; |
| | | } |
| | | |
| | | public void setMsgSetting(String msgSetting) { |
| | | this.msgSetting = msgSetting == null ? null : msgSetting.trim(); |
| | | } |
| | | |
| | | public Integer getMsgUnreadCount() { |
| | | return msgUnreadCount; |
| | | } |
| | | |
| | | public void setMsgUnreadCount(Integer msgUnreadCount) { |
| | | this.msgUnreadCount = msgUnreadCount; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DO; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | public class UserMsg { |
| | | |
| | | public enum UserMsgType { |
| | | activity("活动消息", ""); |
| | | |
| | | private UserMsgType(String name, String icon) { |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | private Long id; |
| | | |
| | | @NotNull(message = "用户ID不能为空") |
| | | private Long uid; |
| | | @NotNull(message = "消息类型不能为空") |
| | | private UserMsgType msgType; |
| | | |
| | | @NotNull(message = "消息内容不能为空") |
| | | private String msgContent; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public UserMsgType getMsgType() { |
| | | return msgType; |
| | | } |
| | | |
| | | public void setMsgType(UserMsgType msgType) { |
| | | this.msgType = msgType; |
| | | } |
| | | |
| | | public String getMsgContent() { |
| | | return msgContent; |
| | | } |
| | | |
| | | public void setMsgContent(String msgContent) { |
| | | this.msgContent = msgContent == null ? null : msgContent.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.pojo.DTO; |
| | | |
| | | public class UserMsgSettings { |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.query; |
| | | |
| | | import com.ks.lucky.query.BaseDaoQuery; |
| | | |
| | | public class ActivityScanQuery extends BaseDaoQuery { |
| | | public Long uid; |
| | | public Long activityId; |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.query; |
| | | |
| | | import com.ks.daylucky.pojo.DO.Announcement; |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.lucky.query.BaseDaoQuery; |
| | | |
| | | public class AnnouncementQuery extends BaseDaoQuery { |
| | | public Long appId; |
| | | public Announcement.AnnouncementType type; |
| | | public String key; |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.query; |
| | | |
| | | import com.ks.lucky.query.BaseDaoQuery; |
| | | |
| | | public class AppConfigQuery extends BaseDaoQuery { |
| | | public Long appId; |
| | | public String nameKey; |
| | | public String key; |
| | | public Integer minVersion; |
| | | public Integer version; |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.query; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.lucky.query.BaseDaoQuery; |
| | | |
| | | public class MsgTypeConfigQuery extends BaseDaoQuery { |
| | | public Long appId; |
| | | public UserMsg.UserMsgType msgType; |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.query; |
| | | |
| | | import com.ks.lucky.query.BaseDaoQuery; |
| | | |
| | | public class UserInfoQuery extends BaseDaoQuery { |
| | | public Long appId; |
| | | public String identifyCode; |
| | | public String key; |
| | | public String mobile; |
| | | public String alipayUid; |
| | | public String wxOpenId; |
| | | public String wxUnionId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.query; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.lucky.query.BaseDaoQuery; |
| | | |
| | | public class UserMsgQuery extends BaseDaoQuery { |
| | | public Long uid; |
| | | public UserMsg.UserMsgType msgType; |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.pojo.DO.ActivityScanRecord; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 活动浏览足迹 |
| | | */ |
| | | public interface ActivityScanRecordService { |
| | | |
| | | /** |
| | | * 添加记录 |
| | | * |
| | | * @param record |
| | | * @throws ParameterException |
| | | */ |
| | | public void addRecord(@Valid ActivityScanRecord record) throws ParameterException; |
| | | |
| | | |
| | | /** |
| | | * 获取记录 |
| | | * |
| | | * @param uid |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<ActivityScanRecord> getRecordList(Long uid, int page, int pageSize); |
| | | |
| | | |
| | | /** |
| | | * 记录计数 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public long countRecord(Long uid); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.pojo.DO.ActivityTag; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 活动标签 |
| | | */ |
| | | public interface ActivityTagService { |
| | | |
| | | /** |
| | | * 添加活动标签 |
| | | * |
| | | * @param tag |
| | | * @throws ParameterException |
| | | */ |
| | | public void addActivityTag(@Valid ActivityTag tag) throws ParameterException; |
| | | |
| | | |
| | | /** |
| | | * 获取标签列表 |
| | | * |
| | | * @param activityId |
| | | * @return |
| | | */ |
| | | public List<ActivityTag> getTagList(Long activityId); |
| | | |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param tag |
| | | */ |
| | | public void update(ActivityTag tag); |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id |
| | | */ |
| | | public void delete(Long id); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.exception.AnnouncementException; |
| | | import com.ks.daylucky.pojo.DO.Announcement; |
| | | import com.ks.daylucky.query.AnnouncementQuery; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 公告 |
| | | */ |
| | | public interface AnnouncementService { |
| | | |
| | | |
| | | /** |
| | | * 添加公告 |
| | | * |
| | | * @param announcement |
| | | * @throws ParameterException |
| | | * @throws AnnouncementException |
| | | */ |
| | | public void addAnnouncement(@Valid Announcement announcement) throws ParameterException, AnnouncementException; |
| | | |
| | | |
| | | /** |
| | | * 获取公告 |
| | | * |
| | | * @param appId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | public Announcement getAnnouncement(Long appId, Announcement.AnnouncementType type); |
| | | |
| | | |
| | | /** |
| | | * 获取公告列表 |
| | | * |
| | | * @param query |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<Announcement> getAnnouncementList(AnnouncementQuery query, int page, int pageSize); |
| | | |
| | | |
| | | /** |
| | | * 修改公告 |
| | | * |
| | | * @param announcement |
| | | */ |
| | | public void update(Announcement announcement); |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id |
| | | */ |
| | | public void delete(Long id); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.exception.AppConfigException; |
| | | import com.ks.daylucky.pojo.DO.AppConfig; |
| | | import com.ks.daylucky.query.AppConfigQuery; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 应用配置服务 |
| | | */ |
| | | public interface AppConfigService { |
| | | |
| | | |
| | | /** |
| | | * 添加应用配置信息 |
| | | * |
| | | * @param config |
| | | * @throws ParameterException |
| | | * @throws AppConfigException |
| | | */ |
| | | public void addAppConfig(@Valid AppConfig config) throws ParameterException, AppConfigException; |
| | | |
| | | |
| | | /** |
| | | * 获取配置列表 |
| | | * |
| | | * @param query |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<AppConfig> getConfigList(AppConfigQuery query, int page, int pageSize); |
| | | |
| | | |
| | | public long countConfig(AppConfigQuery query); |
| | | |
| | | /** |
| | | * 主键查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public AppConfig selectByPrimaryKey(Long id); |
| | | |
| | | |
| | | /** |
| | | * 获取应用配置信息 |
| | | * |
| | | * @param appId |
| | | * @param key |
| | | * @param version |
| | | * @return |
| | | */ |
| | | public AppConfig getConfig(Long appId, String key, Integer version); |
| | | |
| | | |
| | | /** |
| | | * 获取应用配置信息(有缓存) |
| | | * |
| | | * @param appId |
| | | * @param key |
| | | * @param version |
| | | * @return |
| | | */ |
| | | public AppConfig getConfigCache(Long appId, String key, Integer version); |
| | | |
| | | |
| | | /** |
| | | * 修改应用配置 |
| | | * |
| | | * @param config |
| | | */ |
| | | public void update(AppConfig config); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id |
| | | */ |
| | | public void delete(Long id); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service; |
| | | |
| | | import com.ks.daylucky.exception.MsgTypeConfigException; |
| | | import com.ks.daylucky.pojo.DO.MsgTypeConfig; |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | public interface MsgTypeConfigService { |
| | | |
| | | |
| | | /** |
| | | * 添加消息类型配置 |
| | | * |
| | | * @param config |
| | | * @throws MsgTypeConfigException |
| | | */ |
| | | public void addMsgTypeConfig(@Valid MsgTypeConfig config) throws MsgTypeConfigException; |
| | | |
| | | |
| | | /** |
| | | * 获取配置信息 |
| | | * |
| | | * @param appId |
| | | * @param msgType |
| | | * @return |
| | | */ |
| | | public MsgTypeConfig getConfig(Long appId, UserMsg.UserMsgType msgType); |
| | | |
| | | |
| | | /** |
| | | * 修改配置信息 |
| | | * |
| | | * @param config |
| | | */ |
| | | public void updateConfig(MsgTypeConfig config); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id |
| | | */ |
| | | public void delete(Long id); |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserInfoExtra; |
| | | import com.ks.daylucky.pojo.DTO.UserMsgSettings; |
| | | |
| | | public interface UserInfoExtraService { |
| | | |
| | | |
| | | /** |
| | | * 获取详情 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public UserInfoExtra getUserInfoExtra(Long uid); |
| | | |
| | | /** |
| | | * 设置消息已读 |
| | | * |
| | | * @param uid |
| | | */ |
| | | public void setMsgRead(Long uid); |
| | | |
| | | /** |
| | | * 消息设置 |
| | | * |
| | | * @param setting |
| | | */ |
| | | public void setUserMsgSetting(UserMsgSettings setting); |
| | | |
| | | /** |
| | | * 获取用户消息设置信息 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public UserMsgSettings getUserMsgSettings(Long uid); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.exception.UserInfoException; |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import com.ks.daylucky.query.UserInfoQuery; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | public interface UserInfoService { |
| | | |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @param appId |
| | | * @param identifyCode |
| | | * @return |
| | | */ |
| | | public UserInfo getUserInfo(Long appId, String identifyCode); |
| | | |
| | | /** |
| | | * 添加用户 |
| | | * |
| | | * @param userInfo |
| | | * @throws ParameterException |
| | | * @throws UserInfoException |
| | | */ |
| | | public Long addUserInfo(@Valid UserInfo userInfo) throws ParameterException, UserInfoException; |
| | | |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | * |
| | | * @param query |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<UserInfo> getUserList(UserInfoQuery query, int page, int pageSize); |
| | | |
| | | /** |
| | | * 获取用户的数量 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | public long countUser(UserInfoQuery query); |
| | | |
| | | /** |
| | | * 获取用户详情 |
| | | * |
| | | * @param appId |
| | | * @param identifyCode |
| | | * @return |
| | | */ |
| | | public UserInfo getUserDetail(Long appId, String identifyCode); |
| | | |
| | | public UserInfo getUserDetail(Long id); |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | | * |
| | | * @param userInfo |
| | | */ |
| | | public void updateUserInfo(UserInfo userInfo); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service; |
| | | |
| | | import com.ks.daylucky.exception.UserMsgException; |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.daylucky.query.UserMsgQuery; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | public interface UserMsgService { |
| | | |
| | | /** |
| | | * 添加消息 |
| | | * |
| | | * @param userMsg |
| | | * @throws UserMsgException |
| | | */ |
| | | public void addMsg(@Valid UserMsg userMsg) throws UserMsgException; |
| | | |
| | | /** |
| | | * 获取用户消息列表 |
| | | * |
| | | * @param uid |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<UserMsg> getUserMsgList(Long uid, int page, int pageSize); |
| | | |
| | | public long countUserMsg(Long uid); |
| | | |
| | | |
| | | /** |
| | | * 获取用户消息列表 |
| | | * |
| | | * @param query |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<UserMsg> getUserMsgList(UserMsgQuery query, int page, int pageSize); |
| | | |
| | | public long countUserMsg(UserMsgQuery query); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id |
| | | */ |
| | | public void delete(Long id); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.mapper.ActivityScanRecordMapper; |
| | | import com.ks.daylucky.pojo.DO.ActivityScanRecord; |
| | | import com.ks.daylucky.query.ActivityScanQuery; |
| | | import com.ks.daylucky.service.ActivityScanRecordService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class ActivityScanRecordServiceImpl implements ActivityScanRecordService { |
| | | @Resource |
| | | private ActivityScanRecordMapper activityScanRecordMapper; |
| | | |
| | | |
| | | @Validated |
| | | @Override |
| | | public void addRecord(@Valid ActivityScanRecord record) throws ParameterException { |
| | | ActivityScanQuery query = new ActivityScanQuery(); |
| | | query.uid = record.getUid(); |
| | | query.activityId = record.getActivityId(); |
| | | query.count = 1; |
| | | query.minCreateTime = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd"), "yyyyMMdd")); |
| | | List<ActivityScanRecord> list = activityScanRecordMapper.list(query); |
| | | if (list != null && list.size() > 0) { |
| | | ActivityScanRecord update = new ActivityScanRecord(); |
| | | update.setId(list.get(0).getId()); |
| | | update.setUpdateTime(new Date()); |
| | | activityScanRecordMapper.updateByPrimaryKeySelective(update); |
| | | } else { |
| | | record.setCreateTime(new Date()); |
| | | record.setUpdateTime(new Date()); |
| | | activityScanRecordMapper.insertSelective(record); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<ActivityScanRecord> getRecordList(Long uid, int page, int pageSize) { |
| | | ActivityScanQuery query = new ActivityScanQuery(); |
| | | query.uid = uid; |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | query.sortList = Arrays.asList(new String[]{"update_time desc"}); |
| | | List<ActivityScanRecord> recordList = activityScanRecordMapper.list(query); |
| | | return recordList; |
| | | } |
| | | |
| | | @Override |
| | | public long countRecord(Long uid) { |
| | | ActivityScanQuery query = new ActivityScanQuery(); |
| | | query.uid = uid; |
| | | return activityScanRecordMapper.count(query); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.mapper.ActivityTagMapper; |
| | | import com.ks.daylucky.pojo.DO.ActivityTag; |
| | | import com.ks.daylucky.service.ActivityTagService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class ActivityTagServiceImpl implements ActivityTagService { |
| | | |
| | | @Resource |
| | | private ActivityTagMapper activityTagMapper; |
| | | |
| | | |
| | | @Validated |
| | | @Override |
| | | public void addActivityTag(@Valid ActivityTag tag) throws ParameterException { |
| | | if (tag.getWeight() == null) { |
| | | tag.setWeight(1); |
| | | } |
| | | tag.setCreateTime(new Date()); |
| | | activityTagMapper.insertSelective(tag); |
| | | } |
| | | |
| | | @Override |
| | | public List<ActivityTag> getTagList(Long activityId) { |
| | | return activityTagMapper.listByActivityId(activityId); |
| | | } |
| | | |
| | | @Override |
| | | public void update(ActivityTag tag) { |
| | | if (tag == null || tag.getId() == null) { |
| | | return; |
| | | } |
| | | tag.setUpdateTime(new Date()); |
| | | activityTagMapper.updateByPrimaryKeySelective(tag); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | activityTagMapper.deleteByPrimaryKey(id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.exception.AnnouncementException; |
| | | import com.ks.daylucky.mapper.AnnouncementMapper; |
| | | import com.ks.daylucky.pojo.DO.Announcement; |
| | | import com.ks.daylucky.query.AnnouncementQuery; |
| | | import com.ks.daylucky.service.AnnouncementService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class AnnouncementServiceImpl implements AnnouncementService { |
| | | |
| | | |
| | | @Resource |
| | | private AnnouncementMapper announcementMapper; |
| | | |
| | | @Validated |
| | | @Override |
| | | public void addAnnouncement(@Valid Announcement announcement) throws ParameterException, AnnouncementException { |
| | | AnnouncementQuery query = new AnnouncementQuery(); |
| | | query.appId = announcement.getAppId(); |
| | | query.type = announcement.getType(); |
| | | query.count = 1; |
| | | List<Announcement> list = announcementMapper.list(query); |
| | | if (list != null && list.size() > 0) { |
| | | throw new AnnouncementException(AnnouncementException.CODE_EXIST, "应用的该类型公告已存在"); |
| | | } |
| | | |
| | | if (announcement.getCreateTime() == null) { |
| | | announcement.setCreateTime(new Date()); |
| | | } |
| | | announcementMapper.insertSelective(announcement); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Announcement getAnnouncement(Long appId, Announcement.AnnouncementType type) { |
| | | AnnouncementQuery query = new AnnouncementQuery(); |
| | | query.appId = appId; |
| | | query.type = type; |
| | | query.count = 1; |
| | | List<Announcement> list = announcementMapper.list(query); |
| | | if (list != null && list.size() > 0) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<Announcement> getAnnouncementList(AnnouncementQuery query, int page, int pageSize) { |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | return announcementMapper.list(query); |
| | | } |
| | | |
| | | @Override |
| | | public void update(Announcement announcement) { |
| | | if (announcement == null || announcement.getId() == null) { |
| | | return; |
| | | } |
| | | announcement.setUpdateTime(new Date()); |
| | | announcementMapper.updateByPrimaryKeySelective(announcement); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | announcementMapper.deleteByPrimaryKey(id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.exception.AppConfigException; |
| | | import com.ks.daylucky.mapper.AppConfigMapper; |
| | | import com.ks.daylucky.pojo.DO.AppConfig; |
| | | import com.ks.daylucky.query.AppConfigQuery; |
| | | import com.ks.daylucky.service.AppConfigService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class AppConfigServiceImpl implements AppConfigService { |
| | | |
| | | @Resource |
| | | private AppConfigMapper appConfigMapper; |
| | | |
| | | @Validated |
| | | @Override |
| | | public void addAppConfig(@Valid AppConfig config) throws ParameterException, AppConfigException { |
| | | AppConfigQuery query = new AppConfigQuery(); |
| | | query.appId = config.getAppId(); |
| | | query.key = config.getKey(); |
| | | query.minVersion = config.getMinVersion(); |
| | | query.count = 1; |
| | | List<AppConfig> list = appConfigMapper.list(query); |
| | | if (list != null && list.size() > 0) { |
| | | throw new AppConfigException(AppConfigException.CODE_EXIST, "应用配置已存在"); |
| | | } |
| | | config.setCreateTime(new Date()); |
| | | appConfigMapper.insertSelective(config); |
| | | } |
| | | |
| | | @Override |
| | | public List<AppConfig> getConfigList(AppConfigQuery query, int page, int pageSize) { |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | return appConfigMapper.list(query); |
| | | } |
| | | |
| | | @Override |
| | | public long countConfig(AppConfigQuery query) { |
| | | return appConfigMapper.count(query); |
| | | } |
| | | |
| | | @Override |
| | | public AppConfig selectByPrimaryKey(Long id) { |
| | | return appConfigMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public AppConfig getConfig(Long appId, String key, Integer version) { |
| | | AppConfigQuery query = new AppConfigQuery(); |
| | | query.appId = appId; |
| | | query.key = key; |
| | | query.version = version; |
| | | |
| | | List<AppConfig> list = appConfigMapper.list(query); |
| | | if (list != null && list.size() > 0) { |
| | | return list.get(0); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public AppConfig getConfigCache(Long appId, String key, Integer version) { |
| | | return getConfig(appId, key, version); |
| | | } |
| | | |
| | | @Override |
| | | public void update(AppConfig config) { |
| | | |
| | | if (config == null || config.getId() == null) { |
| | | return; |
| | | } |
| | | |
| | | config.setUpdateTime(new Date()); |
| | | appConfigMapper.updateByPrimaryKeySelective(config); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | appConfigMapper.deleteByPrimaryKey(id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.ks.daylucky.exception.MsgTypeConfigException; |
| | | import com.ks.daylucky.mapper.MsgTypeConfigMapper; |
| | | import com.ks.daylucky.pojo.DO.MsgTypeConfig; |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.daylucky.query.MsgTypeConfigQuery; |
| | | import com.ks.daylucky.service.MsgTypeConfigService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class MsgTypeConfigServiceImpl implements MsgTypeConfigService { |
| | | |
| | | @Resource |
| | | private MsgTypeConfigMapper msgTypeConfigMapper; |
| | | |
| | | @Validated |
| | | @Override |
| | | public void addMsgTypeConfig(@Valid MsgTypeConfig config) throws MsgTypeConfigException { |
| | | MsgTypeConfigQuery query = new MsgTypeConfigQuery(); |
| | | query.appId = config.getAppId(); |
| | | query.msgType = config.getMsgType(); |
| | | query.count = 1; |
| | | List<MsgTypeConfig> list = msgTypeConfigMapper.list(query); |
| | | if (list != null && list.size() > 0) { |
| | | throw new MsgTypeConfigException(MsgTypeConfigException.CODE_EXIST, "应用的消息类型已存在"); |
| | | } |
| | | |
| | | if (config.getCreateTime() == null) { |
| | | config.setCreateTime(new Date()); |
| | | } |
| | | |
| | | msgTypeConfigMapper.insertSelective(config); |
| | | } |
| | | |
| | | @Override |
| | | public MsgTypeConfig getConfig(Long appId, UserMsg.UserMsgType msgType) { |
| | | MsgTypeConfigQuery query = new MsgTypeConfigQuery(); |
| | | query.appId = appId; |
| | | query.msgType = msgType; |
| | | query.count = 1; |
| | | List<MsgTypeConfig> list = msgTypeConfigMapper.list(query); |
| | | if (list != null && list.size() > 0) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void updateConfig(MsgTypeConfig config) { |
| | | if (config == null || config.getId() == null) { |
| | | return; |
| | | } |
| | | config.setUpdateTime(new Date()); |
| | | msgTypeConfigMapper.updateByPrimaryKeySelective(config); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | msgTypeConfigMapper.deleteByPrimaryKey(id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.ks.daylucky.mapper.UserInfoExtraMapper; |
| | | import com.ks.daylucky.pojo.DO.UserInfoExtra; |
| | | import com.ks.daylucky.pojo.DTO.UserMsgSettings; |
| | | import com.ks.daylucky.service.UserInfoExtraService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class UserInfoExtraServiceImpl implements UserInfoExtraService { |
| | | |
| | | @Resource |
| | | private UserInfoExtraMapper userInfoExtraMapper; |
| | | |
| | | |
| | | @Override |
| | | public UserInfoExtra getUserInfoExtra(Long uid) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void setMsgRead(Long uid) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void setUserMsgSetting(UserMsgSettings setting) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public UserMsgSettings getUserMsgSettings(Long uid) { |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.beust.jcommander.ParameterException; |
| | | import com.ks.daylucky.exception.UserInfoException; |
| | | import com.ks.daylucky.mapper.UserInfoExtraMapper; |
| | | import com.ks.daylucky.mapper.UserInfoMapper; |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import com.ks.daylucky.query.UserInfoQuery; |
| | | import com.ks.daylucky.service.UserInfoService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class UserInfoServiceImpl implements UserInfoService { |
| | | |
| | | @Resource |
| | | private UserInfoMapper userInfoMapper; |
| | | |
| | | @Resource |
| | | private UserInfoExtraMapper userInfoExtraMapper; |
| | | |
| | | @Override |
| | | public UserInfo getUserInfo(Long appId, String identifyCode) { |
| | | return null; |
| | | } |
| | | |
| | | @Validated |
| | | @Override |
| | | public Long addUserInfo(@Valid UserInfo userInfo) throws ParameterException, UserInfoException { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<UserInfo> getUserList(UserInfoQuery query, int page, int pageSize) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public long countUser(UserInfoQuery query) { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo getUserDetail(Long appId, String identifyCode) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo getUserDetail(Long id) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void updateUserInfo(UserInfo userInfo) { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.service.impl.remote; |
| | | |
| | | import com.ks.daylucky.exception.UserMsgException; |
| | | import com.ks.daylucky.mapper.UserMsgMapper; |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.daylucky.query.UserMsgQuery; |
| | | import com.ks.daylucky.service.UserMsgService; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class UserMsgServiceImpl implements UserMsgService { |
| | | @Resource |
| | | private UserMsgMapper userMsgMapper; |
| | | |
| | | @Validated |
| | | @Override |
| | | public void addMsg(@Valid UserMsg userMsg) throws UserMsgException { |
| | | if (userMsg.getCreateTime() == null) { |
| | | userMsg.setCreateTime(new Date()); |
| | | } |
| | | userMsgMapper.insertSelective(userMsg); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserMsg> getUserMsgList(Long uid, int page, int pageSize) { |
| | | UserMsgQuery query = new UserMsgQuery(); |
| | | query.uid = uid; |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | query.sortList = Arrays.asList(new String[]{"create_time desc"}); |
| | | |
| | | return userMsgMapper.list(query); |
| | | } |
| | | |
| | | @Override |
| | | public long countUserMsg(Long uid) { |
| | | UserMsgQuery query = new UserMsgQuery(); |
| | | query.uid = uid; |
| | | return userMsgMapper.count(query); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserMsg> getUserMsgList(UserMsgQuery query, int page, int pageSize) { |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | return userMsgMapper.list(query); |
| | | } |
| | | |
| | | @Override |
| | | public long countUserMsg(UserMsgQuery query) { |
| | | return userMsgMapper.count(query); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | userMsgMapper.deleteByPrimaryKey(id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.util; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | public class UserInfoUtil { |
| | | |
| | | /** |
| | | * 获取用户唯一标识 |
| | | * |
| | | * @param userInfo |
| | | * @return |
| | | */ |
| | | public static String getIdentifyCode(UserInfo userInfo) { |
| | | if (!StringUtil.isNullOrEmpty(userInfo.getAlipayUid())) { |
| | | return userInfo.getAlipayUid(); |
| | | } else if (!StringUtil.isNullOrEmpty(userInfo.getWxOpenId())) { |
| | | return userInfo.getWxOpenId(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | database: 3 |
| | | |
| | | datasource: |
| | | url: jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_lucky |
| | | url: jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_day_lucky |
| | | username: root |
| | | password: Yeshi2016@ |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | |
| | | |
| | | dubbo: |
| | | application: |
| | | name: lucky-provider |
| | | name: daylucky-provider |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://134.175.68.214:2181 # 134.175.68.214 134.175.68.214:2181 |
| | |
| | | </commentGenerator> |
| | | <!--数据库连接的信息:驱动类、连接地址、用户名、密码 --> |
| | | <jdbcConnection driverClass="com.mysql.jdbc.Driver" |
| | | connectionURL="jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_lucky" userId="root" |
| | | connectionURL="jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_day_lucky" userId="root" |
| | | password="Yeshi2016@"> |
| | | </jdbcConnection> |
| | | |
| | |
| | | </javaTypeResolver> |
| | | |
| | | <!-- targetProject:生成PO类的位置 --> |
| | | <javaModelGenerator targetPackage="com.ks.lucky.pojo.DO" |
| | | <javaModelGenerator targetPackage="com.ks.daylucky.pojo.DO" |
| | | targetProject="src/main/java"> |
| | | <!-- enableSubPackages:是否让schema作为包的后缀 --> |
| | | <property name="enableSubPackages" value="false"/> |
| | |
| | | |
| | | <!-- targetPackage:mapper接口生成的位置 --> |
| | | <javaClientGenerator type="XMLMAPPER" |
| | | targetPackage="com.ks.lucky.mapper" |
| | | targetPackage="com.ks.daylucky.mapper" |
| | | targetProject="src/main/java"> |
| | | |
| | | <!-- enableSubPackages:是否让schema作为包的后缀 --> |
| | | <property name="enableSubPackages" value="false"/> |
| | | </javaClientGenerator> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivity" tableName="lucky_activity" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--<table schema="" tableName="activity_scan_record" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityOpenInfo" tableName="lucky_activity_open_info" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--<table schema="" tableName="activity_tag" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityAwardResult" tableName="lucky_activity_award_result" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--<table schema="" tableName="app_config" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityAwardResultExtra" tableName="lucky_activity_award_result_extra" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--<table schema="" tableName="msg_type_config" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityAwards" tableName="lucky_activity_awards" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--<table schema="" tableName="user_info" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityJoinAssist" tableName="lucky_activity_join_assist" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--<table schema="" tableName="user_info_extra" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivityJoinRecord" tableName="lucky_activity_join_record" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--<table schema="" tableName="user_msg" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyActivitySponsorInfo" tableName="lucky_activity_sponsor_info" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--<table schema="" tableName="announcement" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <!--<table schema="" domainObjectName="LuckyMQ" tableName="lucky_mq" enableCountByExample="false" enableUpdateByExample="false"--> |
| | | <!--enableDeleteByExample="false" enableSelectByExample="false"--> |
| | | <!--selectByExampleQueryId="false"></table>--> |
| | | |
| | | <table schema="" domainObjectName="" tableName=""></table> |
| | | |
| | | |
| | | </context> |
New file |
| | |
| | | <?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.ks.daylucky.mapper.ActivityScanRecordMapper" > |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.ActivityScanRecord" > |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="activity_id" property="activityId" jdbcType="BIGINT" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, uid, activity_id, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from activity_scan_record |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from activity_scan_record |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.ActivityScanRecord" > |
| | | insert into activity_scan_record (id, uid, activity_id, |
| | | create_time, update_time) |
| | | values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT}, #{activityId,jdbcType=BIGINT}, |
| | | #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.ActivityScanRecord" > |
| | | insert into activity_scan_record |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | id, |
| | | </if> |
| | | <if test="uid != null" > |
| | | uid, |
| | | </if> |
| | | <if test="activityId != null" > |
| | | activity_id, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null" > |
| | | #{uid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="activityId != null" > |
| | | #{activityId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.ActivityScanRecord" > |
| | | update activity_scan_record |
| | | <set > |
| | | <if test="uid != null" > |
| | | uid = #{uid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="activityId != null" > |
| | | activity_id = #{activityId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.daylucky.pojo.DO.ActivityScanRecord" > |
| | | update activity_scan_record |
| | | set uid = #{uid,jdbcType=BIGINT}, |
| | | activity_id = #{activityId,jdbcType=BIGINT}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.ks.daylucky.mapper.ActivityTagMapper" > |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.ActivityTag" > |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="activity_id" property="activityId" jdbcType="BIGINT" /> |
| | | <result column="tag_name" property="tagName" jdbcType="VARCHAR" /> |
| | | <result column="tag_bg_color" property="tagBgColor" jdbcType="VARCHAR" /> |
| | | <result column="tag_font_colr" property="tagFontColr" jdbcType="VARCHAR" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="weight" property="weight" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, activity_id, tag_name, tag_bg_color, tag_font_colr, create_time, update_time, |
| | | weight |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from activity_tag |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from activity_tag |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.ActivityTag" > |
| | | insert into activity_tag (id, activity_id, tag_name, |
| | | tag_bg_color, tag_font_colr, create_time, |
| | | update_time, weight) |
| | | values (#{id,jdbcType=BIGINT}, #{activityId,jdbcType=BIGINT}, #{tagName,jdbcType=VARCHAR}, |
| | | #{tagBgColor,jdbcType=VARCHAR}, #{tagFontColr,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, |
| | | #{updateTime,jdbcType=TIMESTAMP}, #{weight,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.ActivityTag" > |
| | | insert into activity_tag |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | id, |
| | | </if> |
| | | <if test="activityId != null" > |
| | | activity_id, |
| | | </if> |
| | | <if test="tagName != null" > |
| | | tag_name, |
| | | </if> |
| | | <if test="tagBgColor != null" > |
| | | tag_bg_color, |
| | | </if> |
| | | <if test="tagFontColr != null" > |
| | | tag_font_colr, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time, |
| | | </if> |
| | | <if test="weight != null" > |
| | | weight, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="activityId != null" > |
| | | #{activityId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="tagName != null" > |
| | | #{tagName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="tagBgColor != null" > |
| | | #{tagBgColor,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="tagFontColr != null" > |
| | | #{tagFontColr,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="weight != null" > |
| | | #{weight,jdbcType=INTEGER}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.ActivityTag" > |
| | | update activity_tag |
| | | <set > |
| | | <if test="activityId != null" > |
| | | activity_id = #{activityId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="tagName != null" > |
| | | tag_name = #{tagName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="tagBgColor != null" > |
| | | tag_bg_color = #{tagBgColor,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="tagFontColr != null" > |
| | | tag_font_colr = #{tagFontColr,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="weight != null" > |
| | | weight = #{weight,jdbcType=INTEGER}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.daylucky.pojo.DO.ActivityTag" > |
| | | update activity_tag |
| | | set activity_id = #{activityId,jdbcType=BIGINT}, |
| | | tag_name = #{tagName,jdbcType=VARCHAR}, |
| | | tag_bg_color = #{tagBgColor,jdbcType=VARCHAR}, |
| | | tag_font_colr = #{tagFontColr,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | weight = #{weight,jdbcType=INTEGER} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.ks.daylucky.mapper.AnnouncementMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.Announcement"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="identity_code" property="identityCode" jdbcType="VARCHAR"/> |
| | | <result column="app_id" property="appId" jdbcType="BIGINT"/> |
| | | <result column="type" property="type" jdbcType="VARCHAR"/> |
| | | <result column="name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="content" property="content" jdbcType="VARCHAR"/> |
| | | <result column="link" property="link" jdbcType="VARCHAR"/> |
| | | <result column="close" property="close" jdbcType="BOOLEAN"/> |
| | | <result column="show" property="show" jdbcType="BOOLEAN"/> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,identity_code,app_id,type,name,content,link,close,show,create_time,update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from announcement where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" |
| | | parameterType="java.lang.Long">delete from announcement where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.Announcement" useGeneratedKeys="true" |
| | | keyProperty="id">insert into announcement (id,identity_code,app_id,type,name,content,link,close,show,create_time,update_time) values (#{id,jdbcType=BIGINT},#{identityCode,jdbcType=VARCHAR},#{appId,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{link,jdbcType=VARCHAR},#{close,jdbcType=BOOLEAN},#{show,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.Announcement" useGeneratedKeys="true" |
| | | keyProperty="id">insert into announcement |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="identityCode != null">identity_code,</if> |
| | | <if test="appId != null">app_id,</if> |
| | | <if test="type != null">type,</if> |
| | | <if test="name != null">name,</if> |
| | | <if test="content != null">content,</if> |
| | | <if test="link != null">link,</if> |
| | | <if test="close != null">close,</if> |
| | | <if test="show != null">show,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="identityCode != null">#{identityCode,jdbcType=VARCHAR},</if> |
| | | <if test="appId != null">#{appId,jdbcType=BIGINT},</if> |
| | | <if test="type != null">#{type,jdbcType=VARCHAR},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="content != null">#{content,jdbcType=VARCHAR},</if> |
| | | <if test="link != null">#{link,jdbcType=VARCHAR},</if> |
| | | <if test="close != null">#{close,jdbcType=BOOLEAN},</if> |
| | | <if test="show != null">#{show,jdbcType=BOOLEAN},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.ks.daylucky.pojo.DO.Announcement">update announcement set identity_code = #{identityCode,jdbcType=VARCHAR},app_id = #{appId,jdbcType=BIGINT},type = #{type,jdbcType=VARCHAR},name = #{name,jdbcType=VARCHAR},content = #{content,jdbcType=VARCHAR},link = #{link,jdbcType=VARCHAR},close = #{close,jdbcType=BOOLEAN},show = #{show,jdbcType=BOOLEAN},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.Announcement">update announcement |
| | | <set> |
| | | <if test="identityCode != null">identity_code=#{identityCode,jdbcType=VARCHAR},</if> |
| | | <if test="appId != null">app_id=#{appId,jdbcType=BIGINT},</if> |
| | | <if test="type != null">type=#{type,jdbcType=VARCHAR},</if> |
| | | <if test="name != null">name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="content != null">content=#{content,jdbcType=VARCHAR},</if> |
| | | <if test="link != null">link=#{link,jdbcType=VARCHAR},</if> |
| | | <if test="close != null">close=#{close,jdbcType=BOOLEAN},</if> |
| | | <if test="show != null">show=#{show,jdbcType=BOOLEAN},</if> |
| | | <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.ks.daylucky.mapper.AppConfigMapper" > |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.AppConfig" > |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="app_id" property="appId" jdbcType="BIGINT" /> |
| | | <result column="name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="key" property="key" jdbcType="VARCHAR" /> |
| | | <result column="value" property="value" jdbcType="VARCHAR" /> |
| | | <result column="min_version" property="minVersion" jdbcType="INTEGER" /> |
| | | <result column="remarks" property="remarks" jdbcType="VARCHAR" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, app_id, name, key, value, min_version, remarks, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from app_config |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from app_config |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.AppConfig" > |
| | | insert into app_config (id, app_id, name, |
| | | key, value, min_version, |
| | | remarks, create_time, update_time |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, |
| | | #{key,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, #{minVersion,jdbcType=INTEGER}, |
| | | #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.AppConfig" > |
| | | insert into app_config |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | id, |
| | | </if> |
| | | <if test="appId != null" > |
| | | app_id, |
| | | </if> |
| | | <if test="name != null" > |
| | | name, |
| | | </if> |
| | | <if test="key != null" > |
| | | key, |
| | | </if> |
| | | <if test="value != null" > |
| | | value, |
| | | </if> |
| | | <if test="minVersion != null" > |
| | | min_version, |
| | | </if> |
| | | <if test="remarks != null" > |
| | | remarks, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="appId != null" > |
| | | #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null" > |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="key != null" > |
| | | #{key,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="value != null" > |
| | | #{value,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="minVersion != null" > |
| | | #{minVersion,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="remarks != null" > |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.AppConfig" > |
| | | update app_config |
| | | <set > |
| | | <if test="appId != null" > |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null" > |
| | | name = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="key != null" > |
| | | key = #{key,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="value != null" > |
| | | value = #{value,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="minVersion != null" > |
| | | min_version = #{minVersion,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="remarks != null" > |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.daylucky.pojo.DO.AppConfig" > |
| | | update app_config |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | name = #{name,jdbcType=VARCHAR}, |
| | | key = #{key,jdbcType=VARCHAR}, |
| | | value = #{value,jdbcType=VARCHAR}, |
| | | min_version = #{minVersion,jdbcType=INTEGER}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.ks.daylucky.mapper.MsgTypeConfigMapper" > |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.MsgTypeConfig" > |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="app_id" property="appId" jdbcType="BIGINT" /> |
| | | <result column="msg_type" property="msgType" jdbcType="VARCHAR" /> |
| | | <result column="msg_name" property="msgName" jdbcType="VARCHAR" /> |
| | | <result column="msg_icon" property="msgIcon" jdbcType="VARCHAR" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, app_id, msg_type, msg_name, msg_icon, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from msg_type_config |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from msg_type_config |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.MsgTypeConfig" > |
| | | insert into msg_type_config (id, app_id, msg_type, |
| | | msg_name, msg_icon, create_time, |
| | | update_time) |
| | | values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{msgType,jdbcType=VARCHAR}, |
| | | #{msgName,jdbcType=VARCHAR}, #{msgIcon,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, |
| | | #{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.MsgTypeConfig" > |
| | | insert into msg_type_config |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | id, |
| | | </if> |
| | | <if test="appId != null" > |
| | | app_id, |
| | | </if> |
| | | <if test="msgType != null" > |
| | | msg_type, |
| | | </if> |
| | | <if test="msgName != null" > |
| | | msg_name, |
| | | </if> |
| | | <if test="msgIcon != null" > |
| | | msg_icon, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="appId != null" > |
| | | #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="msgType != null" > |
| | | #{msgType,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="msgName != null" > |
| | | #{msgName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="msgIcon != null" > |
| | | #{msgIcon,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.MsgTypeConfig" > |
| | | update msg_type_config |
| | | <set > |
| | | <if test="appId != null" > |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="msgType != null" > |
| | | msg_type = #{msgType,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="msgName != null" > |
| | | msg_name = #{msgName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="msgIcon != null" > |
| | | msg_icon = #{msgIcon,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.daylucky.pojo.DO.MsgTypeConfig" > |
| | | update msg_type_config |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | msg_type = #{msgType,jdbcType=VARCHAR}, |
| | | msg_name = #{msgName,jdbcType=VARCHAR}, |
| | | msg_icon = #{msgIcon,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.ks.daylucky.mapper.UserInfoExtraMapper" > |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.UserInfoExtra" > |
| | | <id column="uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="msg_setting" property="msgSetting" jdbcType="VARCHAR" /> |
| | | <result column="msg_unread_count" property="msgUnreadCount" jdbcType="INTEGER" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | uid, msg_setting, msg_unread_count, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from user_info_extra |
| | | where uid = #{uid,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from user_info_extra |
| | | where uid = #{uid,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.UserInfoExtra" > |
| | | insert into user_info_extra (uid, msg_setting, msg_unread_count, |
| | | create_time, update_time) |
| | | values (#{uid,jdbcType=BIGINT}, #{msgSetting,jdbcType=VARCHAR}, #{msgUnreadCount,jdbcType=INTEGER}, |
| | | #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.UserInfoExtra" > |
| | | insert into user_info_extra |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="uid != null" > |
| | | uid, |
| | | </if> |
| | | <if test="msgSetting != null" > |
| | | msg_setting, |
| | | </if> |
| | | <if test="msgUnreadCount != null" > |
| | | msg_unread_count, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="uid != null" > |
| | | #{uid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="msgSetting != null" > |
| | | #{msgSetting,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="msgUnreadCount != null" > |
| | | #{msgUnreadCount,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.UserInfoExtra" > |
| | | update user_info_extra |
| | | <set > |
| | | <if test="msgSetting != null" > |
| | | msg_setting = #{msgSetting,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="msgUnreadCount != null" > |
| | | msg_unread_count = #{msgUnreadCount,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where uid = #{uid,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.daylucky.pojo.DO.UserInfoExtra" > |
| | | update user_info_extra |
| | | set msg_setting = #{msgSetting,jdbcType=VARCHAR}, |
| | | msg_unread_count = #{msgUnreadCount,jdbcType=INTEGER}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where uid = #{uid,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.ks.daylucky.mapper.UserInfoMapper" > |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.UserInfo" > |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="app_id" property="appId" jdbcType="BIGINT" /> |
| | | <result column="identify_code" property="identifyCode" jdbcType="VARCHAR" /> |
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" /> |
| | | <result column="portrait" property="portrait" jdbcType="VARCHAR" /> |
| | | <result column="mobile" property="mobile" jdbcType="VARCHAR" /> |
| | | <result column="alipay_uid" property="alipayUid" jdbcType="VARCHAR" /> |
| | | <result column="alipay_portrait" property="alipayPortrait" jdbcType="VARCHAR" /> |
| | | <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" /> |
| | | <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" /> |
| | | <result column="wx_portrait" property="wxPortrait" jdbcType="VARCHAR" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, app_id, identify_code, nick_name, portrait, mobile, alipay_uid, alipay_portrait, |
| | | wx_open_id, wx_union_id, wx_portrait, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from user_info |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from user_info |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.UserInfo" > |
| | | insert into user_info (id, app_id, identify_code, |
| | | nick_name, portrait, mobile, |
| | | alipay_uid, alipay_portrait, wx_open_id, |
| | | wx_union_id, wx_portrait, create_time, |
| | | update_time) |
| | | values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{identifyCode,jdbcType=VARCHAR}, |
| | | #{nickName,jdbcType=VARCHAR}, #{portrait,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, |
| | | #{alipayUid,jdbcType=VARCHAR}, #{alipayPortrait,jdbcType=VARCHAR}, #{wxOpenId,jdbcType=VARCHAR}, |
| | | #{wxUnionId,jdbcType=VARCHAR}, #{wxPortrait,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, |
| | | #{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.UserInfo" > |
| | | insert into user_info |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | id, |
| | | </if> |
| | | <if test="appId != null" > |
| | | app_id, |
| | | </if> |
| | | <if test="identifyCode != null" > |
| | | identify_code, |
| | | </if> |
| | | <if test="nickName != null" > |
| | | nick_name, |
| | | </if> |
| | | <if test="portrait != null" > |
| | | portrait, |
| | | </if> |
| | | <if test="mobile != null" > |
| | | mobile, |
| | | </if> |
| | | <if test="alipayUid != null" > |
| | | alipay_uid, |
| | | </if> |
| | | <if test="alipayPortrait != null" > |
| | | alipay_portrait, |
| | | </if> |
| | | <if test="wxOpenId != null" > |
| | | wx_open_id, |
| | | </if> |
| | | <if test="wxUnionId != null" > |
| | | wx_union_id, |
| | | </if> |
| | | <if test="wxPortrait != null" > |
| | | wx_portrait, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="appId != null" > |
| | | #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="identifyCode != null" > |
| | | #{identifyCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="nickName != null" > |
| | | #{nickName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="portrait != null" > |
| | | #{portrait,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="mobile != null" > |
| | | #{mobile,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="alipayUid != null" > |
| | | #{alipayUid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="alipayPortrait != null" > |
| | | #{alipayPortrait,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="wxOpenId != null" > |
| | | #{wxOpenId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="wxUnionId != null" > |
| | | #{wxUnionId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="wxPortrait != null" > |
| | | #{wxPortrait,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.UserInfo" > |
| | | update user_info |
| | | <set > |
| | | <if test="appId != null" > |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="identifyCode != null" > |
| | | identify_code = #{identifyCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="nickName != null" > |
| | | nick_name = #{nickName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="portrait != null" > |
| | | portrait = #{portrait,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="mobile != null" > |
| | | mobile = #{mobile,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="alipayUid != null" > |
| | | alipay_uid = #{alipayUid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="alipayPortrait != null" > |
| | | alipay_portrait = #{alipayPortrait,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="wxOpenId != null" > |
| | | wx_open_id = #{wxOpenId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="wxUnionId != null" > |
| | | wx_union_id = #{wxUnionId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="wxPortrait != null" > |
| | | wx_portrait = #{wxPortrait,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.daylucky.pojo.DO.UserInfo" > |
| | | update user_info |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | identify_code = #{identifyCode,jdbcType=VARCHAR}, |
| | | nick_name = #{nickName,jdbcType=VARCHAR}, |
| | | portrait = #{portrait,jdbcType=VARCHAR}, |
| | | mobile = #{mobile,jdbcType=VARCHAR}, |
| | | alipay_uid = #{alipayUid,jdbcType=VARCHAR}, |
| | | alipay_portrait = #{alipayPortrait,jdbcType=VARCHAR}, |
| | | wx_open_id = #{wxOpenId,jdbcType=VARCHAR}, |
| | | wx_union_id = #{wxUnionId,jdbcType=VARCHAR}, |
| | | wx_portrait = #{wxPortrait,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.ks.daylucky.mapper.UserMsgMapper" > |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.UserMsg" > |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="msg_type" property="msgType" jdbcType="VARCHAR" /> |
| | | <result column="msg_content" property="msgContent" jdbcType="VARCHAR" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, uid, msg_type, msg_content, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from user_msg |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from user_msg |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.UserMsg" > |
| | | insert into user_msg (id, uid, msg_type, |
| | | msg_content, create_time, update_time |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT}, #{msgType,jdbcType=VARCHAR}, |
| | | #{msgContent,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.UserMsg" > |
| | | insert into user_msg |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | id, |
| | | </if> |
| | | <if test="uid != null" > |
| | | uid, |
| | | </if> |
| | | <if test="msgType != null" > |
| | | msg_type, |
| | | </if> |
| | | <if test="msgContent != null" > |
| | | msg_content, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null" > |
| | | #{uid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="msgType != null" > |
| | | #{msgType,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="msgContent != null" > |
| | | #{msgContent,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.UserMsg" > |
| | | update user_msg |
| | | <set > |
| | | <if test="uid != null" > |
| | | uid = #{uid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="msgType != null" > |
| | | msg_type = #{msgType,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="msgContent != null" > |
| | | msg_content = #{msgContent,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.daylucky.pojo.DO.UserMsg" > |
| | | update user_msg |
| | | set uid = #{uid,jdbcType=BIGINT}, |
| | | msg_type = #{msgType,jdbcType=VARCHAR}, |
| | | msg_content = #{msgContent,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | package com.ks; |
| | | |
| | | import com.ks.daylucky.pojo.DO.Announcement; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityAwardResultExtra; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.yeshi.utils.mybatis.ColumnParseUtil; |
| | | import org.yeshi.utils.mybatis.MyBatisMapperUtil; |
| | | |
| | | public class MyBatisTest { |
| | | |
| | | @Test |
| | | public void test() { |
| | | ColumnParseUtil.parseColumn(LuckyActivity.class, "D:\\workspace\\DayLucky\\service-lucky\\src\\main\\resources\\mapper\\LuckyActivityMapper.xml"); |
| | | MyBatisMapperUtil.createMapper(Announcement.class); |
| | | } |
| | | } |
| | |
| | | package com.ks.lucky.config; |
| | | |
| | | import com.ks.lucky.util.mq.CMQConsumeRunner; |
| | | import com.ks.lucky.util.mq.consume.AcitivtyConsumer; |
| | | import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; |
| | | import com.ks.lucky.util.mq.consumer.AcitivtyConsumer; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | |
| | | public class ActivityMQMsg { |
| | | //开始活动 |
| | | public final static int TYPE_EXEC_START = 1; |
| | | //结束活动 |
| | | public final static int TYPE_EXEC_FINSIH = 6; |
| | | //开始执行打开 |
| | | public final static int TYPE_EXEC_OPEN = 7; |
| | | //活动达到最小开奖人数 |
| | | public final static int TYPE_REACH_MIN_PERSON = 2; |
| | | //活动达到最大开奖数 |
| | | public final static int TYPE_REACH_MAX_PERSON = 3; |
| | | //活动达到开奖时间 |
| | | public final static int TYPE_REACH_OPEN_TIME = 4; |
| | | //活动开奖 |
| | | public final static int TYPE_OPEN = 5; |
| | | //显示活动开奖 |
| | | public final static int TYPE_OPEN_SHOW = 5; |
| | | |
| | | private Long activityId; |
| | | private Integer type; |
| | |
| | | package com.ks.lucky.service.impl; |
| | | |
| | | import com.ks.lucky.exception.LuckyActivityException; |
| | | import com.ks.lucky.exception.LuckyMQException; |
| | | import com.ks.lucky.mapper.LuckyActivityMapper; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityOpenInfo; |
| | | import com.ks.lucky.pojo.DO.LuckyMQ; |
| | | import com.ks.lucky.pojo.DTO.ActivityMQMsg; |
| | | import com.ks.lucky.service.LuckyMQService; |
| | | import com.ks.lucky.util.mq.CMQManager; |
| | | import com.ks.lucky.util.mq.LuckyMQFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private LuckyActivityOpenInfoManager luckyActivityOpenInfoManager; |
| | | |
| | | @Resource |
| | | private LuckyMQService luckyMQService; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否可以更改活动内容 |
| | | * |
| | | * @param activityId |
| | | * @return |
| | | */ |
| | | public boolean canUpdate(Long activityId) { |
| | | LuckyActivity activity = luckyActivityMapper.selectByPrimaryKey(activityId); |
| | | if (activity != null) { |
| | | if (activity.getState() == LuckyActivity.STATE_VERIFY_REJECT || activity.getState() == LuckyActivity.STATE_NOT_SUBMIT_VERIFY) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @param activityId |
| | | */ |
| | | public void startUpActivity(Long activityId) throws LuckyActivityException { |
| | | public void startUpActivity(Long activityId) throws LuckyActivityException, LuckyMQException { |
| | | LuckyActivity luckyActivity = luckyActivityMapper.selectByPrimaryKeyForUpdate(activityId); |
| | | if (luckyActivity == null) { |
| | | throw new LuckyActivityException(LuckyActivityException.CODE_NOT_EXIST, "活动不存在"); |
| | |
| | | update.setActualStartTime(new Date()); |
| | | update.setUpdateTime(new Date()); |
| | | luckyActivityMapper.updateByPrimaryKeySelective(update); |
| | | |
| | | //有预计结束时间 |
| | | if (luckyActivity.getPreFinishTime() != null) { |
| | | //添加结束消息 |
| | | LuckyMQ mq = LuckyMQFactory.createFinishActivity(luckyActivity); |
| | | luckyMQService.addMQ(mq); |
| | | } |
| | | |
| | | //尝试删除消息 |
| | | try { |
| | | LuckyMQ mq = LuckyMQFactory.createStartUpActivity(luckyActivity); |
| | | luckyMQService.removeUnSendMsg(mq.getTaskId()); |
| | | } catch (LuckyMQException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | * @param remarks |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void finishActivity(Long activityId, boolean force, String remarks) throws LuckyActivityException { |
| | | public void finishActivity(Long activityId, boolean force, String remarks) throws LuckyActivityException, LuckyMQException { |
| | | LuckyActivity activity = luckyActivityMapper.selectByPrimaryKeyForUpdate(activityId); |
| | | if (activity.getState() != LuckyActivity.STATE_STARTED) { |
| | | throw new LuckyActivityException(1, "活动未处于已开始状态"); |
| | |
| | | update.setUpdateTime(new Date()); |
| | | luckyActivityMapper.updateByPrimaryKeySelective(update); |
| | | |
| | | activity.setActualFinishTime(update.getActualFinishTime()); |
| | | //强制结束的不开奖 |
| | | if (!force) { |
| | | //添加开奖消息 |
| | | LuckyMQ mq = LuckyMQFactory.createOpenActivity(activity); |
| | | luckyMQService.addMQ(mq); |
| | | } |
| | | //尝试删除消息 |
| | | try { |
| | | LuckyMQ mq1 = LuckyMQFactory.createFinishActivity(activity); |
| | | luckyMQService.removeUnSendMsg(mq1.getTaskId()); |
| | | } catch (LuckyMQException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import com.ks.lucky.exception.LuckyActivityAwardException; |
| | | import com.ks.lucky.exception.LuckyActivityException; |
| | | import com.ks.lucky.exception.LuckyActivityOpenException; |
| | | import com.ks.lucky.exception.LuckyMQException; |
| | | import com.ks.lucky.mapper.LuckyActivityMapper; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityAwards; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityOpenInfo; |
| | | import com.ks.lucky.pojo.DTO.ActivityMQMsg; |
| | | import com.ks.lucky.remote.service.LuckyActivityOpenService; |
| | | import com.ks.lucky.service.impl.LuckyActivityAwardManager; |
| | | import com.ks.lucky.service.impl.LuckyActivityAwardResultManager; |
| | | import com.ks.lucky.service.impl.LuckyActivityJoinManager; |
| | | import com.ks.lucky.service.impl.LuckyActivityOpenInfoManager; |
| | | import com.ks.lucky.service.impl.*; |
| | | import com.ks.lucky.util.LuckyRunUtil; |
| | | import com.ks.lucky.util.mq.CMQManager; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.omg.PortableServer.THREAD_POLICY_ID; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private LuckyActivityAwardResultManager luckyActivityAwardResultManager; |
| | | |
| | | @Resource |
| | | private LuckyActivityManager luckyActivityManager; |
| | | |
| | | |
| | | /** |
| | | * 是否可以开奖了 |
| | |
| | | */ |
| | | private boolean canOpen(LuckyActivity activity) throws LuckyActivityException { |
| | | long now = System.currentTimeMillis(); |
| | | |
| | | if (activity.getState() != LuckyActivity.STATE_FINISH) { |
| | | throw new LuckyActivityException(1, "活动尚未结束"); |
| | | } |
| | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void preOpenAward(Long activityId) throws LuckyActivityException, LuckyActivityAwardException { |
| | | public void preOpenAward(Long activityId) throws LuckyActivityException, LuckyActivityOpenException, LuckyActivityAwardException { |
| | | //判断活动状态 |
| | | LuckyActivity activity = luckyActivityMapper.selectByPrimaryKeyForUpdate(activityId); |
| | | if (activity == null) { |
| | | throw new LuckyActivityException(LuckyActivityException.CODE_NOT_EXIST, "活动不存在"); |
| | | } |
| | | |
| | | |
| | | //判断是否达到开奖条件 |
| | | try { |
| | | canOpen(activity); |
| | | } catch (LuckyActivityException e) { |
| | | throw new LuckyActivityOpenException(1, "尚未达到开奖条件"); |
| | | } |
| | | //------------计算开奖------------- |
| | | |
| | | //获取奖项数据 |
| | |
| | | update.setStateRemarks("预开奖成功"); |
| | | update.setUpdateTime(new Date()); |
| | | luckyActivityMapper.updateByPrimaryKeySelective(update); |
| | | //添加消息 |
| | | CMQManager.getInstance().addActivityMsg(new ActivityMQMsg(activityId, ActivityMQMsg.TYPE_OPEN_SHOW, new Date())); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | luckyActivityAwardResultManager.setResultShow(activityId); |
| | | } |
| | | |
| | | @Override |
| | | public void reachMinPerson(Long activityId) throws LuckyActivityException { |
| | | LuckyActivity activity = luckyActivityMapper.selectByPrimaryKey(activityId); |
| | | if (activity == null) { |
| | | throw new LuckyActivityException(LuckyActivityException.CODE_NOT_EXIST, "活动不存在"); |
| | | } |
| | | //如果未设置开奖时间,且活动正在进行,就判断是否达到最低人数 |
| | | if (activity.getPreOpenTime() == null) { |
| | | if (activity.getState() == LuckyActivity.STATE_STARTED) { |
| | | try { |
| | | luckyActivityManager.finishActivity(activityId, false, "达到最低开奖人数"); |
| | | } catch (LuckyMQException e) { |
| | | throw new LuckyActivityException(1, e.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | throw new LuckyActivityException(2, "活动尚未处于已发布状态"); |
| | | } |
| | | |
| | | luckyActivityManager.startUpActivity(activityId); |
| | | |
| | | //尝试删除消息 |
| | | try { |
| | | LuckyMQ mq = LuckyMQFactory.createStartUpActivity(activity); |
| | | luckyMQService.removeUnSendMsg(mq.getTaskId()); |
| | | luckyActivityManager.startUpActivity(activityId); |
| | | } catch (LuckyMQException e) { |
| | | e.printStackTrace(); |
| | | throw new LuckyActivityException(e.getCode(), e.getMsg()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void verifyActivity(Long activityId, boolean pass, String remarks) throws LuckyActivityException { |
| | | LuckyActivity activity = luckyActivityMapper.selectByPrimaryKeyForUpdate(activityId); |
| | | notNull(activity); |
| | | if (activity.getState() != LuckyActivity.STATE_WAITING_VERIFY) { |
| | | throw new LuckyActivityException(2, "活动尚未处于审核状态"); |
| | | } |
| | | |
| | | //审核活动 |
| | | //审核通过 |
| | | if (pass) { |
| | | //审核通过 |
| | | luckyActivityManager.setState(activityId, LuckyActivity.STATE_NOT_PUBLISH, remarks); |
| | | } else { |
| | | //审核未通过 |
| | |
| | | public void forceFinishActivity(Long activityId, String remarks) throws LuckyActivityException { |
| | | LuckyActivity activity = luckyActivityMapper.selectByPrimaryKey(activityId); |
| | | notNull(activity); |
| | | try { |
| | | luckyActivityManager.finishActivity(activityId, true, remarks); |
| | | } catch (LuckyMQException e) { |
| | | throw new LuckyActivityException(e.getCode(), e.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | throw new LuckyActivityException(2, e.getMsg()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void cancelVerify(Long activityId) throws LuckyActivityException { |
| | | LuckyActivity activity = luckyActivityMapper.selectByPrimaryKeyForUpdate(activityId); |
| | | notNull(activity); |
| | | if (activity.getState() != LuckyActivity.STATE_WAITING_VERIFY) { |
| | | throw new LuckyActivityException(1, "活动未处于等待审核状态"); |
| | | } |
| | | |
| | | luckyActivityManager.setState(activityId, LuckyActivity.STATE_NOT_SUBMIT_VERIFY, "主动取消审核"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (activity.getState() != null) { |
| | | throw new LuckyActivityException(1, "不能更改活动状态"); |
| | | } |
| | | if (!luckyActivityManager.canUpdate(activity.getId())) { |
| | | throw new LuckyActivityException(1, "当前活动不能修改"); |
| | | } |
| | | |
| | | activity.setUpdateTime(new Date()); |
| | | luckyActivityMapper.updateByPrimaryKeySelective(activity); |
| | | } |
| | |
| | | LuckyMQ mq = new LuckyMQ(); |
| | | mq.setState(LuckyMQ.STATE_NOT_SEND); |
| | | mq.setCreateTime(new Date()); |
| | | mq.setPreSendTime(activity.getStartTime()); |
| | | mq.setPreSendTime(activity.getPreStartTime()); |
| | | mq.setQueueContent(new Gson().toJson(new ActivityMQMsg(activity.getId(), ActivityMQMsg.TYPE_EXEC_START, new Date()))); |
| | | mq.setQueueName(CMQManager.QUEUENAME_LUCKY_ACTIVITY); |
| | | mq.setTaskId("start-activity-" + activity.getId()); |
| | | mq.setTaskName("启动活动"); |
| | | return mq; |
| | | } |
| | | |
| | | |
| | | public static LuckyMQ createFinishActivity(LuckyActivity activity) { |
| | | LuckyMQ mq = new LuckyMQ(); |
| | | mq.setState(LuckyMQ.STATE_NOT_SEND); |
| | | mq.setCreateTime(new Date()); |
| | | mq.setPreSendTime(activity.getPreFinishTime()); |
| | | mq.setQueueContent(new Gson().toJson(new ActivityMQMsg(activity.getId(), ActivityMQMsg.TYPE_EXEC_FINSIH, new Date()))); |
| | | mq.setQueueName(CMQManager.QUEUENAME_LUCKY_ACTIVITY); |
| | | mq.setTaskId("finish-activity-" + activity.getId()); |
| | | mq.setTaskName("结束活动"); |
| | | return mq; |
| | | } |
| | | |
| | | |
| | | public static LuckyMQ createOpenActivity(LuckyActivity activity) { |
| | | LuckyMQ mq = new LuckyMQ(); |
| | | mq.setState(LuckyMQ.STATE_NOT_SEND); |
| | | mq.setCreateTime(new Date()); |
| | | //设置开奖时间 |
| | | if (activity.getPreOpenTime() != null) { |
| | | mq.setPreSendTime(activity.getPreOpenTime()); |
| | | } else { |
| | | mq.setPreSendTime(activity.getActualFinishTime()); |
| | | } |
| | | mq.setQueueContent(new Gson().toJson(new ActivityMQMsg(activity.getId(), ActivityMQMsg.TYPE_EXEC_OPEN, new Date()))); |
| | | mq.setQueueName(CMQManager.QUEUENAME_LUCKY_ACTIVITY); |
| | | mq.setTaskId("open-activity-" + activity.getId()); |
| | | mq.setTaskName("活动开奖"); |
| | | return mq; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.lucky.util.mq.consumer; |
| | | |
| | | import com.ks.lucky.exception.LuckyActivityAwardException; |
| | | import com.ks.lucky.exception.LuckyActivityException; |
| | | import com.ks.lucky.exception.LuckyActivityOpenException; |
| | | import com.ks.lucky.exception.LuckyMQException; |
| | | import com.ks.lucky.pojo.DTO.ActivityMQMsg; |
| | | import com.ks.lucky.remote.service.LuckyActivityOpenService; |
| | | import com.ks.lucky.service.impl.LuckyActivityManager; |
| | | import com.ks.lucky.util.mq.CMQConsumeRunner; |
| | | import com.ks.lucky.util.mq.CMQManager; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | |
| | | public class AcitivtyConsumer implements CMQConsumeRunner { |
| | | |
| | | @Resource |
| | | private LuckyActivityManager luckyActivityManager; |
| | | |
| | | @Resource |
| | | private LuckyActivityOpenService luckyActivityOpenService; |
| | | |
| | | private void preOpen(Long activityId, String handler) { |
| | | |
| | | try { |
| | | luckyActivityOpenService.preOpenAward(activityId); |
| | | CMQManager.getInstance().deleteActivityMsg(handler); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyActivityAwardException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyActivityOpenException e) { |
| | | CMQManager.getInstance().deleteActivityMsg(handler); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void start() { |
| | | while (true) { |
| | | Map<String, ActivityMQMsg> map = CMQManager.getInstance().consumeActivityMsg(16); |
| | | if (map != null) { |
| | | for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) { |
| | | String handler = its.next(); |
| | | ActivityMQMsg msg = map.get(handler); |
| | | if (msg != null) { |
| | | switch (msg.getType()) { |
| | | case ActivityMQMsg.TYPE_EXEC_START: |
| | | //启动活动 |
| | | try { |
| | | luckyActivityManager.startUpActivity(msg.getActivityId()); |
| | | CMQManager.getInstance().deleteActivityMsg(handler); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyMQException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | break; |
| | | case ActivityMQMsg.TYPE_EXEC_FINSIH: |
| | | //结束活动 |
| | | try { |
| | | luckyActivityManager.finishActivity(msg.getActivityId(), false, "定时结束"); |
| | | CMQManager.getInstance().deleteActivityMsg(handler); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyMQException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | break; |
| | | |
| | | |
| | | case ActivityMQMsg.TYPE_REACH_MIN_PERSON: |
| | | try { |
| | | luckyActivityOpenService.reachMinPerson(msg.getActivityId()); |
| | | CMQManager.getInstance().deleteActivityMsg(handler); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | break; |
| | | |
| | | case ActivityMQMsg.TYPE_REACH_MAX_PERSON: |
| | | try { |
| | | luckyActivityManager.finishActivity(msg.getActivityId(), false, "活动达到最大开奖人数"); |
| | | CMQManager.getInstance().deleteActivityMsg(handler); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyMQException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | break; |
| | | |
| | | case ActivityMQMsg.TYPE_REACH_OPEN_TIME: |
| | | try { |
| | | luckyActivityManager.finishActivity(msg.getActivityId(), false, "活动达到开奖时间"); |
| | | CMQManager.getInstance().deleteActivityMsg(handler); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyMQException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | break; |
| | | |
| | | case ActivityMQMsg.TYPE_OPEN_SHOW: |
| | | try { |
| | | luckyActivityOpenService.showOpenAward(msg.getActivityId()); |
| | | CMQManager.getInstance().deleteActivityMsg(handler); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | break; |
| | | |
| | | case ActivityMQMsg.TYPE_EXEC_OPEN: |
| | | preOpen(msg.getActivityId(), handler); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() { |
| | | |
| | | } |
| | | } |