Merge pull request 'v1.0.17' (#26) from dev into master

Reviewed-on: #26
This commit was merged in pull request #26.
This commit is contained in:
2026-08-19 17:30:35 +00:00
31 changed files with 604 additions and 22 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
<groupId>com.imyeyu.timiserverapi</groupId> <groupId>com.imyeyu.timiserverapi</groupId>
<artifactId>TimiServerAPI</artifactId> <artifactId>TimiServerAPI</artifactId>
<version>1.0.16</version> <version>1.0.17</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>TimiServerAPI</name> <name>TimiServerAPI</name>
<description>imyeyu.com API</description> <description>imyeyu.com API</description>
@@ -50,6 +50,11 @@ public enum CorePermissionCode implements BuiltinPermissionCode {
USER_UPDATE("USER:UPDATE", "用户修改", false, true), USER_UPDATE("USER:UPDATE", "用户修改", false, true),
USER_DELETE("USER:DELETE", "用户删除", false, true), USER_DELETE("USER:DELETE", "用户删除", false, true),
FEEDBACK_CREATE("FEEDBACK:CREATE", "反馈创建", false, true),
FEEDBACK_READ("FEEDBACK:READ", "反馈读取", false, true),
FEEDBACK_UPDATE("FEEDBACK:UPDATE", "反馈修改", false, true),
FEEDBACK_DELETE("FEEDBACK:DELETE", "反馈删除", false, true),
USER_ROLE_CREATE("USER_ROLE:CREATE", "用户角色创建", true, true), USER_ROLE_CREATE("USER_ROLE:CREATE", "用户角色创建", true, true),
USER_ROLE_READ("USER_ROLE:READ", "用户角色读取", true, true), USER_ROLE_READ("USER_ROLE:READ", "用户角色读取", true, true),
USER_ROLE_DELETE("USER_ROLE:DELETE", "用户角色删除", true, true); USER_ROLE_DELETE("USER_ROLE:DELETE", "用户角色删除", true, true);
@@ -0,0 +1,116 @@
package com.imyeyu.api.modules.common.controller;
import com.fasterxml.jackson.annotation.JsonView;
import com.imyeyu.api.annotation.RequireCorePermission;
import com.imyeyu.api.bean.CorePermissionCode;
import com.imyeyu.api.modules.common.entity.Feedback;
import com.imyeyu.api.modules.common.service.FeedbackService;
import com.imyeyu.api.modules.user.service.UserLoginService;
import com.imyeyu.spring.TimiSpring;
import com.imyeyu.spring.annotation.AOPLog;
import com.imyeyu.spring.annotation.CaptchaValid;
import com.imyeyu.spring.annotation.RequestRateLimit;
import com.imyeyu.spring.bean.CaptchaData;
import com.imyeyu.spring.bean.Page;
import com.imyeyu.spring.bean.PageResult;
import com.imyeyu.spring.util.ResponseView;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/// 通用反馈接口
///
/// @author Codex
/// @since 2026-08-19
@RestController
@RequiredArgsConstructor
@RequestMapping("/feedback")
public class FeedbackController {
private final FeedbackService service;
private final UserLoginService userLoginService;
/// 提交反馈。登录用户和匿名用户均需提交图形验证码,匿名用户按 IP 限流
///
/// @param req 带图形验证码的反馈请求
/// @return 已创建反馈
@AOPLog
@JsonView(ResponseView.Public.class)
@CaptchaValid
@RequestRateLimit(value = 3, inSeconds = 60)
@PostMapping("/submit")
public Feedback submit(@RequestBody @Valid CaptchaData<Feedback> req) {
Feedback feedback = req.getData();
feedback.setIp(TimiSpring.getRequestIP());
if (userLoginService.getLoginUser() != null) {
feedback.setUserId(userLoginService.getLoginUser().getId());
}
service.create(feedback);
return feedback;
}
/// 查询反馈列表
///
/// @param page 分页参数
/// @return 反馈分页
@JsonView(ResponseView.Admin.class)
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.FEEDBACK_READ)
@PostMapping("/list")
public PageResult<Feedback> list(@RequestBody Page<Feedback> page) {
return service.page(page);
}
/// 查询反馈详情
///
/// @param id 反馈 ID
/// @return 反馈详情
@JsonView(ResponseView.Admin.class)
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.FEEDBACK_READ)
@PostMapping("/detail")
public Feedback detail(@RequestParam String id) {
return service.get(id);
}
/// 后台创建反馈
///
/// @param feedback 反馈
/// @return 反馈
@AOPLog
@JsonView(ResponseView.Admin.class)
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.FEEDBACK_CREATE)
@PostMapping("/create")
public Feedback create(@RequestBody Feedback feedback) {
service.create(feedback);
return feedback;
}
/// 更新反馈
///
/// @param feedback 反馈
@AOPLog
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.FEEDBACK_UPDATE)
@PostMapping("/update")
public void update(@RequestBody Feedback feedback) {
feedback.setRespondedBy(userLoginService.getRequireLoginUserId());
service.update(feedback);
}
/// 删除反馈
///
/// @param id 反馈 ID
@AOPLog
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.FEEDBACK_DELETE)
@PostMapping("/delete")
public void delete(@RequestParam String id) {
service.delete(id);
}
}
@@ -28,7 +28,10 @@ public class Article extends UUIDEntity implements SettingSupport {
public enum BizType { public enum BizType {
/** 博客 */ /** 博客 */
BLOG BLOG,
/// 反馈
FEEDBACK
} }
/** /**
@@ -79,4 +82,7 @@ public class Article extends UUIDEntity implements SettingSupport {
@Transient @Transient
protected List<Comment> commentList; protected List<Comment> commentList;
@Transient
protected List<Attachment> attachmentList;
} }
@@ -30,6 +30,8 @@ public class Attachment extends UUIDEntity {
/// @since 2026-07-17 20:52 /// @since 2026-07-17 20:52
public enum BizType { public enum BizType {
ARTICLE,
USER, USER,
GAO_CUSTOMER, GAO_CUSTOMER,
@@ -0,0 +1,79 @@
package com.imyeyu.api.modules.common.entity;
import com.fasterxml.jackson.annotation.JsonView;
import com.imyeyu.api.bean.ModuleCode;
import com.imyeyu.spring.annotation.table.Transient;
import com.imyeyu.spring.entity.UUIDEntity;
import com.imyeyu.spring.util.ResponseView;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/// 通用反馈
///
/// @author Codex
/// @since 2026-08-19
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class Feedback extends UUIDEntity {
/// 反馈处理状态
public enum Status {
/// 待处理
PENDING,
/// 已回复
REPLIED,
/// 已关闭
CLOSED
}
/// 所属模块
@JsonView(ResponseView.Public.class)
private ModuleCode module;
/// 提交用户 ID匿名反馈为 null
@JsonView(ResponseView.Admin.class)
private String userId;
/// 反馈内容文章 ID
@JsonView(ResponseView.Public.class)
private String contentId;
/// 联系方式
@JsonView(ResponseView.Public.class)
private String contact;
/// 提交 IP
@JsonView(ResponseView.Admin.class)
private String ip;
/// 处理状态
@JsonView(ResponseView.Public.class)
private Status status;
/// 管理员回复文章 ID
@JsonView(ResponseView.Public.class)
private String responseId;
/// 回复用户 ID
@JsonView(ResponseView.Admin.class)
private String respondedBy;
/// 回复时间
@JsonView(ResponseView.Public.class)
private Long respondedAt;
/// 管理员回复文章
@Transient
@JsonView(ResponseView.Public.class)
private Article content;
/// 管理员回复文章
@Transient
@JsonView(ResponseView.Public.class)
private Article response;
}
@@ -32,7 +32,7 @@ public interface AttachmentMapper extends BaseMapper<Attachment, String>, RawMap
List<Attachment> selectByBizId(Attachment.BizType bizType, String bizId, List<String> attachTypes, Page<Attachment> page); List<Attachment> selectByBizId(Attachment.BizType bizType, String bizId, List<String> attachTypes, Page<Attachment> page);
List<Attachment> selectByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, List<String> attachTypes); List<Attachment> selectAllByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, List<String> attachTypes);
long countByBizId(Attachment.BizType bizType, String bizId, List<String> attachTypes); long countByBizId(Attachment.BizType bizType, String bizId, List<String> attachTypes);
@@ -0,0 +1,11 @@
package com.imyeyu.api.modules.common.mapper;
import com.imyeyu.api.modules.common.entity.Feedback;
import com.imyeyu.spring.mapper.BaseMapper;
/// 通用反馈 Mapper
///
/// @author Codex
/// @since 2026-08-19
public interface FeedbackMapper extends BaseMapper<Feedback, String> {
}
@@ -0,0 +1,11 @@
package com.imyeyu.api.modules.common.service;
import com.imyeyu.api.modules.common.entity.Feedback;
import com.imyeyu.spring.service.BaseService;
/// 通用反馈服务
///
/// @author Codex
/// @since 2026-08-19
public interface FeedbackService extends BaseService<Feedback, String> {
}
@@ -1,8 +1,15 @@
package com.imyeyu.api.modules.common.service.implement; package com.imyeyu.api.modules.common.service.implement;
import com.imyeyu.api.modules.common.entity.Article; import com.imyeyu.api.modules.common.entity.Article;
import com.imyeyu.api.modules.common.entity.Attachment;
import com.imyeyu.api.modules.common.mapper.ArticleMapper; import com.imyeyu.api.modules.common.mapper.ArticleMapper;
import com.imyeyu.api.modules.common.service.ArticleService; import com.imyeyu.api.modules.common.service.ArticleService;
import com.imyeyu.api.modules.common.service.AttachmentService;
import com.imyeyu.api.modules.system.entity.Logger;
import com.imyeyu.api.modules.system.service.LoggerService;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiCode;
import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.spring.mapper.BaseMapper; import com.imyeyu.spring.mapper.BaseMapper;
import com.imyeyu.spring.service.AbstractEntityService; import com.imyeyu.spring.service.AbstractEntityService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -20,10 +27,57 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor @RequiredArgsConstructor
public class ArticleServiceImplement extends AbstractEntityService<Article, String> implements ArticleService { public class ArticleServiceImplement extends AbstractEntityService<Article, String> implements ArticleService {
private final LoggerService loggerService;
private final AttachmentService attachmentService;
private final ArticleMapper mapper; private final ArticleMapper mapper;
@Override @Override
protected BaseMapper<Article, String> mapper() { protected BaseMapper<Article, String> mapper() {
return mapper; return mapper;
} }
@Override
public void create(Article article) {
Logger logger = new Logger(Logger.Module.COMMON, "COMMON_ARTICLE_CREATE");
try {
super.create(article);
attachmentService.updateByBizId(Attachment.BizType.ARTICLE, article.getId(), article.getAttachmentList());
logger.setLevel(Logger.Level.INFO);
logger.setResult(article.getId());
} catch (TimiException e) {
logger.setLevel(Logger.Level.WARN);
logger.setException(e.getMessage());
throw e;
} catch (Exception e) {
logger.setLevel(Logger.Level.ERROR);
logger.setException(TimiJava.serializeThrowable(e));
log.error("create article error", e);
throw new TimiException(TimiCode.ERROR, "create article error", e);
} finally {
loggerService.create(logger);
}
}
@Override
public void update(Article article) {
Logger logger = new Logger(Logger.Module.COMMON, "COMMON_ARTICLE_UPDATE");
try {
super.update(article);
attachmentService.updateByBizId(Attachment.BizType.ARTICLE, article.getId(), article.getAttachmentList());
logger.setLevel(Logger.Level.INFO);
logger.setResult(article.getId());
} catch (TimiException e) {
logger.setLevel(Logger.Level.WARN);
logger.setException(e.getMessage());
throw e;
} catch (Exception e) {
logger.setLevel(Logger.Level.ERROR);
logger.setException(TimiJava.serializeThrowable(e));
log.error("update article error", e);
throw new TimiException(TimiCode.ERROR, "update article error", e);
} finally {
loggerService.create(logger);
}
}
} }
@@ -319,12 +319,12 @@ public class AttachmentServiceImplement extends AbstractEntityService<Attachment
@Override @Override
public List<Attachment> listByBizId(Attachment.BizType bizType, String bizId, String... attachTypes) { public List<Attachment> listByBizId(Attachment.BizType bizType, String bizId, String... attachTypes) {
return mapper.selectByBizId(bizType, bizId, List.of(attachTypes), null); return mapper.selectAllByBizIdList(bizType, List.of(bizId), List.of(attachTypes));
} }
@Override @Override
public Map<String, List<Attachment>> mapByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, String... attachTypes) { public Map<String, List<Attachment>> mapByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, String... attachTypes) {
return mapper.selectByBizIdList(bizType, bizIdList, List.of(attachTypes)).stream().collect(Collectors.groupingBy(Attachment::getBizId)); return mapper.selectAllByBizIdList(bizType, bizIdList, List.of(attachTypes)).stream().collect(Collectors.groupingBy(Attachment::getBizId));
} }
@Override @Override
@@ -0,0 +1,141 @@
package com.imyeyu.api.modules.common.service.implement;
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
import com.imyeyu.api.modules.common.entity.Feedback;
import com.imyeyu.api.modules.common.mapper.FeedbackMapper;
import com.imyeyu.api.modules.common.service.ArticleService;
import com.imyeyu.api.modules.common.service.AttachmentService;
import com.imyeyu.api.modules.common.service.FeedbackService;
import com.imyeyu.api.modules.system.entity.Logger;
import com.imyeyu.api.modules.system.service.LoggerService;
import com.imyeyu.api.modules.user.service.UserLoginService;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiCode;
import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.spring.mapper.BaseMapper;
import com.imyeyu.spring.service.AbstractEntityService;
import com.imyeyu.utils.Time;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/// 通用反馈服务实现
///
/// @author Codex
/// @since 2026-08-19
@Service
@RequiredArgsConstructor
@Slf4j
public class FeedbackServiceImplement extends AbstractEntityService<Feedback, String> implements FeedbackService {
private static final long ANONYMOUS_ATTACHMENT_MAX_SIZE = 500L * 1024;
private final LoggerService loggerService;
private final ArticleService articleService;
private final UserLoginService userLoginService;
private final AttachmentService attachmentService;
private final FeedbackMapper mapper;
@Override
protected BaseMapper<Feedback, String> mapper() {
return mapper;
}
@Transactional(TimiServerDBConfig.ROLLBACKER)
@Override
public void create(Feedback feedback) {
Logger logger = new Logger(Logger.Module.COMMON, "COMMON_FEEDBACK_CREATE");
try {
TimiException.required(feedback, "未找到反馈");
articleService.create(feedback.getContent());
feedback.setContentId(feedback.getContent().getId());
feedback.setStatus(TimiJava.defaultIfNull(feedback.getStatus(), Feedback.Status.PENDING));
super.create(feedback);
logger.setLevel(Logger.Level.INFO);
logger.setResult(feedback.getId());
} catch (TimiException e) {
logger.setLevel(Logger.Level.WARN);
logger.setException(e.getMessage());
throw e;
} catch (Exception e) {
logger.setLevel(Logger.Level.ERROR);
logger.setException(TimiJava.serializeThrowable(e));
log.error("create feedback error", e);
throw new TimiException(TimiCode.ERROR, "create feedback error", e);
} finally {
loggerService.create(logger);
}
}
@Transactional(TimiServerDBConfig.ROLLBACKER)
@Override
public void update(Feedback feedback) {
Logger logger = new Logger(Logger.Module.COMMON, "COMMON_FEEDBACK_UPDATE");
try {
TimiException.required(feedback, "未找到反馈");
TimiException.required(feedback.getId(), "未找到反馈 ID");
Feedback dbFeedback = get(feedback.getId());
TimiException.required(dbFeedback, "未找到反馈");
feedback.getContent().setId(dbFeedback.getContentId());
articleService.update(feedback.getContent());
dbFeedback.setModule(TimiJava.defaultIfNull(feedback.getModule(), dbFeedback.getModule()));
if (TimiJava.isNotEmpty(feedback.getResponse())) {
if (TimiJava.isEmpty(feedback.getResponseId())) {
articleService.create(feedback.getResponse());
dbFeedback.setResponseId(feedback.getResponse().getId());
dbFeedback.setRespondedAt(Time.now());
} else {
feedback.getResponse().setId(dbFeedback.getResponseId());
articleService.update(feedback.getResponse());
}
dbFeedback.setStatus(Feedback.Status.REPLIED);
dbFeedback.setRespondedBy(userLoginService.getRequireLoginUserId());
}
super.update(dbFeedback);
logger.setLevel(Logger.Level.INFO);
logger.setResult(feedback.getId());
} catch (TimiException e) {
logger.setLevel(Logger.Level.WARN);
logger.setException(e.getMessage());
throw e;
} catch (Exception e) {
logger.setLevel(Logger.Level.ERROR);
logger.setException(TimiJava.serializeThrowable(e));
log.error("修改反馈失败", e);
throw new TimiException(TimiCode.ERROR, "修改反馈失败", e);
} finally {
loggerService.create(logger);
}
}
@Transactional(TimiServerDBConfig.ROLLBACKER)
@Override
public void delete(String id) {
Logger logger = new Logger(Logger.Module.COMMON, "COMMON_FEEDBACK_DELETE");
try {
Feedback feedback = get(id);
articleService.delete(feedback.getContentId());
if (TimiJava.isNotEmpty(feedback.getResponseId())) {
articleService.delete(feedback.getResponseId());
}
super.delete(id);
logger.setLevel(Logger.Level.INFO);
logger.setResult(id);
} catch (TimiException e) {
logger.setLevel(Logger.Level.WARN);
logger.setException(e.getMessage());
throw e;
} catch (Exception e) {
logger.setLevel(Logger.Level.ERROR);
logger.setException(TimiJava.serializeThrowable(e));
log.error("delete feedback error", e);
throw new TimiException(TimiCode.ERROR, "delete feedback error", e);
} finally {
loggerService.create(logger);
}
}
}
@@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/// GAO 客户积分规则接口 /// GAO 客户积分规则接口
/// ///
/// @author Codex /// @author Codex
@@ -78,6 +80,19 @@ public class GaoPointRuleController {
ruleService.update(rule); ruleService.update(rule);
} }
@AOPLog
@RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.POINT_RULE_UPDATE)
@PostMapping("/rule/sort")
public void sort(@RequestBody List<String> idList) {
if (idList != null) {
for (GaoPointRule rule : ruleService.listByIdList(idList)) {
checkStore(rule.getStoreId());
}
}
ruleService.sort(idList);
}
@AOPLog @AOPLog
@RequestRateLimit @RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.POINT_RULE_DELETE) @RequireGaoPermission(GaoPermissionCode.POINT_RULE_DELETE)
@@ -7,6 +7,7 @@ import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView; import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView; import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView; import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordNumberValueDailyStatView;
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq; import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
import com.imyeyu.spring.annotation.AOPLog; import com.imyeyu.spring.annotation.AOPLog;
import com.imyeyu.spring.annotation.RequestRateLimit; import com.imyeyu.spring.annotation.RequestRateLimit;
@@ -57,6 +58,15 @@ public class GaoStoreChartController {
return service.eventRecordDailyStat(req); return service.eventRecordDailyStat(req);
} }
/// 查询登记事件每日数值合计
@AOPLog
@RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.STAT_READ)
@PostMapping("/event/record/number-value/daily")
public List<GaoEventRecordNumberValueDailyStatView> eventRecordNumberValueDaily(@RequestBody GaoStoreChartReq req) {
return service.eventRecordNumberValueDailyStat(req);
}
/// 查询登记事件日历记录 /// 查询登记事件日历记录
@AOPLog @AOPLog
@RequestRateLimit @RequestRateLimit
@@ -123,7 +123,9 @@ public class GaoUserController {
{ {
User user = userService.get(result.getUserId()); User user = userService.get(result.getUserId());
user.setAttachmentList(attachmentService.listByBizId(Attachment.BizType.USER, user.getId())); user.setAttachmentList(attachmentService.listByBizId(Attachment.BizType.USER, user.getId()));
user.setRoleList(userRoleService.listAllRoleCodeByUserId(user.getId()));
user.setRoleEntityList(userRoleService.listRoleByUserId(user.getId())); user.setRoleEntityList(userRoleService.listRoleByUserId(user.getId()));
user.setPermissionList(userRoleService.listAllPermissionCodeByUserId(user.getId()));
result.setUser(user); result.setUser(user);
} }
return result; return result;
@@ -30,7 +30,11 @@ public class GaoCustomer extends UUIDEntity {
/// @since 2026-07-27 /// @since 2026-07-27
public enum AttachType { public enum AttachType {
PHOTO PHOTO,
POINT_CARD,
OTHER
} }
/// ///
@@ -17,7 +17,7 @@ public class GaoPointLedger extends UUIDEntity {
/// 流水变化类型 /// 流水变化类型
public enum ChangeType { public enum ChangeType {
/// 登记事件获得积分 /// 登记事件积分变化
EARN, EARN,
/// 删除登记记录撤销积分 /// 删除登记记录撤销积分
@@ -5,6 +5,7 @@ import com.imyeyu.api.modules.gao.vo.GaoCustomerChartReq;
import com.imyeyu.api.modules.gao.vo.GaoCustomerEventRankView; import com.imyeyu.api.modules.gao.vo.GaoCustomerEventRankView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView; import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView; import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordNumberValueDailyStatView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordPage; import com.imyeyu.api.modules.gao.vo.GaoEventRecordPage;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordRankPage; import com.imyeyu.api.modules.gao.vo.GaoEventRecordRankPage;
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq; import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
@@ -88,6 +89,9 @@ public interface GaoEventRecordMapper extends BaseMapper<GaoEventRecord, String>
/// @return 每日登记数 /// @return 每日登记数
List<GaoEventRecordDailyStatView> stateDailyByRange(GaoStoreChartReq req); List<GaoEventRecordDailyStatView> stateDailyByRange(GaoStoreChartReq req);
/// 按时间范围和事件统计每日登记数值合计
List<GaoEventRecordNumberValueDailyStatView> stateNumberValueDailyByRange(GaoStoreChartReq req);
/// 按时间范围查询登记日历记录 /// 按时间范围查询登记日历记录
/// ///
/// @param req 门店报表查询请求 /// @param req 门店报表查询请求
@@ -4,6 +4,7 @@ import com.imyeyu.api.modules.gao.entity.GaoPointRule;
import com.imyeyu.spring.mapper.BaseMapper; import com.imyeyu.spring.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List; import java.util.List;
/// GAO 客户积分规则 Mapper /// GAO 客户积分规则 Mapper
@@ -12,6 +13,8 @@ import java.util.List;
/// @since 2026-08-11 /// @since 2026-08-11
public interface GaoPointRuleMapper extends BaseMapper<GaoPointRule, String> { public interface GaoPointRuleMapper extends BaseMapper<GaoPointRule, String> {
List<GaoPointRule> selectByIdList(Collection<String> idList);
/// 查询当前时间可匹配的启用规则 /// 查询当前时间可匹配的启用规则
/// ///
/// @param storeId 门店 ID /// @param storeId 门店 ID
@@ -19,6 +19,17 @@ public interface GaoPointRuleService extends BaseService<GaoPointRule, String> {
/// @return 规则列表 /// @return 规则列表
List<GaoPointRule> listActive(String storeId, String eventId, long now); List<GaoPointRule> listActive(String storeId, String eventId, long now);
/// 查询规则 ID 列表
///
/// @param idList 规则 ID 列表
/// @return 规则列表
List<GaoPointRule> listByIdList(List<String> idList);
/// 按客户端提交的顺序更新启用规则优先级
///
/// @param idList 规则 ID 列表
void sort(List<String> idList);
/// 创建积分规则 /// 创建积分规则
/// ///
/// @param rule 积分规则 /// @param rule 积分规则
@@ -4,6 +4,7 @@ import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView; import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView; import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView; import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordNumberValueDailyStatView;
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq; import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
import java.util.List; import java.util.List;
@@ -23,6 +24,9 @@ public interface GaoStoreChartService {
/// 查询登记事件每日统计 /// 查询登记事件每日统计
List<GaoEventRecordDailyStatView> eventRecordDailyStat(GaoStoreChartReq req); List<GaoEventRecordDailyStatView> eventRecordDailyStat(GaoStoreChartReq req);
/// 查询登记事件每日数值合计
List<GaoEventRecordNumberValueDailyStatView> eventRecordNumberValueDailyStat(GaoStoreChartReq req);
/// 查询登记事件日历记录 /// 查询登记事件日历记录
List<GaoEventRecordCalendarView> eventRecordCalendar(GaoStoreChartReq req); List<GaoEventRecordCalendarView> eventRecordCalendar(GaoStoreChartReq req);
} }
@@ -10,9 +10,9 @@ import com.imyeyu.api.modules.gao.entity.GaoEvent;
import com.imyeyu.api.modules.gao.entity.GaoEventRecord; import com.imyeyu.api.modules.gao.entity.GaoEventRecord;
import com.imyeyu.api.modules.gao.mapper.GaoEventRecordMapper; import com.imyeyu.api.modules.gao.mapper.GaoEventRecordMapper;
import com.imyeyu.api.modules.gao.service.GaoCustomerService; import com.imyeyu.api.modules.gao.service.GaoCustomerService;
import com.imyeyu.api.modules.gao.service.GaoPointTriggerService;
import com.imyeyu.api.modules.gao.service.GaoEventRecordService; import com.imyeyu.api.modules.gao.service.GaoEventRecordService;
import com.imyeyu.api.modules.gao.service.GaoEventService; import com.imyeyu.api.modules.gao.service.GaoEventService;
import com.imyeyu.api.modules.gao.service.GaoPointTriggerService;
import com.imyeyu.api.modules.gao.service.GaoStoreBusinessDayService; import com.imyeyu.api.modules.gao.service.GaoStoreBusinessDayService;
import com.imyeyu.api.modules.gao.util.EventRecordXSSFBuilder; import com.imyeyu.api.modules.gao.util.EventRecordXSSFBuilder;
import com.imyeyu.api.modules.gao.vo.GaoCustomerEventRankView; import com.imyeyu.api.modules.gao.vo.GaoCustomerEventRankView;
@@ -321,7 +321,7 @@ public class GaoEventRecordServiceImplement extends AbstractEntityService<GaoEve
long today = Time.today(registeredAt); long today = Time.today(registeredAt);
long noon = today + Time.D / 2; long noon = today + Time.D / 2;
long beginAt = today, endAt; long beginAt = today, endAt;
if (today + registeredAt < noon) { if (registeredAt < noon) {
// 上半日 // 上半日
endAt = noon; endAt = noon;
} else { } else {
@@ -74,7 +74,7 @@ public class GaoPointLedgerServiceImplement extends AbstractEntityService<GaoPoi
public GaoPointLedger earn(GaoEventRecord record, GaoPointRule rule, long pointDelta, JsonNode sourcePayload) { public GaoPointLedger earn(GaoEventRecord record, GaoPointRule rule, long pointDelta, JsonNode sourcePayload) {
TimiException.required(record, "not found event record"); TimiException.required(record, "not found event record");
TimiException.required(rule, "not found point rule"); TimiException.required(rule, "not found point rule");
TimiException.requiredTrue(0 < pointDelta, "pointDelta invalid"); TimiException.requiredTrue(pointDelta != 0, "pointDelta invalid");
String idempotencyKey = "GAO_EVENT_RECORD:%s:RULE:%s:EARN".formatted(record.getId(), rule.getId()); String idempotencyKey = "GAO_EVENT_RECORD:%s:RULE:%s:EARN".formatted(record.getId(), rule.getId());
return apply(record.getStoreId(), record.getCustomerId(), GaoPointLedger.ChangeType.EARN, pointDelta, rule.getId(), record.getEventId(), record.getId(), sourcePayload, idempotencyKey, rule.getRemark(), record.getOperatorUserId(), record.getRegisteredAt()); return apply(record.getStoreId(), record.getCustomerId(), GaoPointLedger.ChangeType.EARN, pointDelta, rule.getId(), record.getEventId(), record.getId(), sourcePayload, idempotencyKey, rule.getRemark(), record.getOperatorUserId(), record.getRegisteredAt());
} }
@@ -84,7 +84,7 @@ public class GaoPointLedgerServiceImplement extends AbstractEntityService<GaoPoi
public GaoPointLedger revoke(GaoPointLedger originLedger, GaoEventRecord record) { public GaoPointLedger revoke(GaoPointLedger originLedger, GaoEventRecord record) {
TimiException.required(originLedger, "not found origin ledger"); TimiException.required(originLedger, "not found origin ledger");
TimiException.required(record, "not found event record"); TimiException.required(record, "not found event record");
TimiException.requiredTrue(0 < originLedger.getPointDelta(), "origin ledger pointDelta invalid"); TimiException.requiredTrue(originLedger.getPointDelta() != 0, "origin ledger pointDelta invalid");
String idempotencyKey = "GAO_EVENT_RECORD:%s:LEDGER:%s:REVOKE".formatted(record.getId(), originLedger.getId()); String idempotencyKey = "GAO_EVENT_RECORD:%s:LEDGER:%s:REVOKE".formatted(record.getId(), originLedger.getId());
return apply(originLedger.getStoreId(), originLedger.getCustomerId(), GaoPointLedger.ChangeType.REVOKE, -originLedger.getPointDelta(), originLedger.getRuleId(), originLedger.getEventId(), originLedger.getEventRecordId(), originLedger.getSourcePayload(), idempotencyKey, "撤销登记记录积分", userLoginService.getRequireLoginUserId(), Time.now()); return apply(originLedger.getStoreId(), originLedger.getCustomerId(), GaoPointLedger.ChangeType.REVOKE, -originLedger.getPointDelta(), originLedger.getRuleId(), originLedger.getEventId(), originLedger.getEventRecordId(), originLedger.getSourcePayload(), idempotencyKey, "撤销登记记录积分", userLoginService.getRequireLoginUserId(), Time.now());
} }
@@ -16,6 +16,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/// GAO 客户积分规则服务实现 /// GAO 客户积分规则服务实现
/// ///
@@ -42,6 +47,32 @@ public class GaoPointRuleServiceImplement extends AbstractEntityService<GaoPoint
return mapper.selectActiveByStoreIdAndEventId(storeId, eventId, now); return mapper.selectActiveByStoreIdAndEventId(storeId, eventId, now);
} }
@Override
public List<GaoPointRule> listByIdList(List<String> idList) {
if (TimiJava.isEmpty(idList)) {
return List.of();
}
return mapper.selectByIdList(new LinkedHashSet<>(idList));
}
@Transactional(TimiServerDBConfig.ROLLBACKER)
@Override
public void sort(List<String> idList) {
if (TimiJava.isEmpty(idList)) {
return;
}
List<String> distinctIdList = new ArrayList<>(new LinkedHashSet<>(idList));
Map<String, GaoPointRule> ruleMap = mapper.selectByIdList(new LinkedHashSet<>(distinctIdList)).stream()
.collect(Collectors.toMap(GaoPointRule::getId, Function.identity()));
TimiException.requiredTrue(ruleMap.size() == distinctIdList.size(), "积分规则列表包含不存在的规则");
for (int i = 0; i < distinctIdList.size(); i++) {
GaoPointRule rule = ruleMap.get(distinctIdList.get(i));
TimiException.requiredTrue(rule.getStatus() == GaoPointRule.Status.ACTIVE, "只能调整启用规则排序");
rule.setPriority(i);
mapper.update(rule);
}
}
@Transactional(TimiServerDBConfig.ROLLBACKER) @Transactional(TimiServerDBConfig.ROLLBACKER)
@Override @Override
public void create(GaoPointRule rule) { public void create(GaoPointRule rule) {
@@ -127,7 +158,7 @@ public class GaoPointRuleServiceImplement extends AbstractEntityService<GaoPoint
TimiException.requiredTrue(rule.getPointMode() == GaoPointRule.PointMode.FIXED, "固定触发规则必须使用 FIXED 积分值模式"); TimiException.requiredTrue(rule.getPointMode() == GaoPointRule.PointMode.FIXED, "固定触发规则必须使用 FIXED 积分值模式");
TimiException.required(rule.getPointValue(), "not found rule.pointValue"); TimiException.required(rule.getPointValue(), "not found rule.pointValue");
TimiException.requiredTrue(0 < rule.getPointValue(), "rule.pointValue invalid"); TimiException.requiredTrue(rule.getPointValue() != 0, "rule.pointValue invalid");
if (rule.getTriggerType() == GaoPointRule.TriggerType.AFTER_COUNT_EVERY_TIME) { if (rule.getTriggerType() == GaoPointRule.TriggerType.AFTER_COUNT_EVERY_TIME) {
JsonNode condition = requireObjectCondition(rule.getConditionJson()); JsonNode condition = requireObjectCondition(rule.getConditionJson());
JsonNode threshold = condition.get("threshold"); JsonNode threshold = condition.get("threshold");
@@ -149,6 +180,7 @@ public class GaoPointRuleServiceImplement extends AbstractEntityService<GaoPoint
TimiException.required(sourceEvent, "TIER.sourceEventId 对应事件不存在"); TimiException.required(sourceEvent, "TIER.sourceEventId 对应事件不存在");
TimiException.requiredTrue(storeId.equals(sourceEvent.getStoreId()), "TIER 来源事件和规则不属于同一门店"); TimiException.requiredTrue(storeId.equals(sourceEvent.getStoreId()), "TIER 来源事件和规则不属于同一门店");
TimiException.requiredTrue(sourceEvent.getValueType() == GaoEvent.ValueType.NUMBER, "TIER 来源事件必须配置为 NUMBER 类型"); TimiException.requiredTrue(sourceEvent.getValueType() == GaoEvent.ValueType.NUMBER, "TIER 来源事件必须配置为 NUMBER 类型");
TimiException.required(sourceEvent.getValueUnit(), "TIER 来源事件必须配置数值单位");
JsonNode sourceValueField = condition.get("sourceValueField"); JsonNode sourceValueField = condition.get("sourceValueField");
TimiException.requiredTrue(sourceValueField != null && sourceValueField.isTextual() && "numberValue".equals(sourceValueField.asText()), "TIER.sourceValueField 目前只能是 numberValue"); TimiException.requiredTrue(sourceValueField != null && sourceValueField.isTextual() && "numberValue".equals(sourceValueField.asText()), "TIER.sourceValueField 目前只能是 numberValue");
@@ -192,7 +224,7 @@ public class GaoPointRuleServiceImplement extends AbstractEntityService<GaoPoint
TimiException.requiredTrue(max == null, "最后一档 TIER.max 必须为空"); TimiException.requiredTrue(max == null, "最后一档 TIER.max 必须为空");
} }
JsonNode pointValue = tier.get("pointValue"); JsonNode pointValue = tier.get("pointValue");
TimiException.requiredTrue(pointValue != null && pointValue.isIntegralNumber() && 0 <= pointValue.longValue(), "TIER.tiers[%d].pointValue invalid".formatted(i)); TimiException.requiredTrue(pointValue != null && pointValue.isIntegralNumber(), "TIER.tiers[%d].pointValue invalid".formatted(i));
previousMax = max; previousMax = max;
} }
} }
@@ -203,9 +235,10 @@ public class GaoPointRuleServiceImplement extends AbstractEntityService<GaoPoint
Long max = condition == null || condition.get("max") == null || condition.get("max").isNull() ? null : condition.get("max").isIntegralNumber() ? condition.get("max").longValue() : null; Long max = condition == null || condition.get("max") == null || condition.get("max").isNull() ? null : condition.get("max").isIntegralNumber() ? condition.get("max").longValue() : null;
TimiException.requiredTrue(condition == null || min != null || condition.get("min") == null || condition.get("min").isNull(), "SOURCE_VALUE.min invalid"); TimiException.requiredTrue(condition == null || min != null || condition.get("min") == null || condition.get("min").isNull(), "SOURCE_VALUE.min invalid");
TimiException.requiredTrue(condition == null || max != null || condition.get("max") == null || condition.get("max").isNull(), "SOURCE_VALUE.max invalid"); TimiException.requiredTrue(condition == null || max != null || condition.get("max") == null || condition.get("max").isNull(), "SOURCE_VALUE.max invalid");
TimiException.requiredTrue(min == null || 0 < min, "SOURCE_VALUE.min invalid"); TimiException.requiredTrue(min == null || min != 0, "SOURCE_VALUE.min invalid");
TimiException.requiredTrue(max == null || 0 < max, "SOURCE_VALUE.max invalid"); TimiException.requiredTrue(max == null || max != 0, "SOURCE_VALUE.max invalid");
TimiException.requiredTrue(min == null || max == null || min <= max, "SOURCE_VALUE.min or SOURCE_VALUE.max invalid"); TimiException.requiredTrue(min == null || max == null || min <= max, "SOURCE_VALUE.min or SOURCE_VALUE.max invalid");
TimiException.requiredTrue(min == null || max == null || (min < 0) == (max < 0), "SOURCE_VALUE.min or SOURCE_VALUE.max direction invalid");
} }
private JsonNode requireObjectCondition(JsonNode conditionJson) { private JsonNode requireObjectCondition(JsonNode conditionJson) {
@@ -62,7 +62,7 @@ public class GaoPointTriggerServiceImplement implements GaoPointTriggerService {
List<GaoPointRule> ruleList = ruleService.listActive(record.getStoreId(), record.getEventId(), Time.now()); List<GaoPointRule> ruleList = ruleService.listActive(record.getStoreId(), record.getEventId(), Time.now());
Long count = null; Long count = null;
long earnedPointValue = 0L; long pointDeltaTotal = 0L;
for (GaoPointRule rule : ruleList) { for (GaoPointRule rule : ruleList) {
RuleResolution resolution = resolveRule(record, rule, count); RuleResolution resolution = resolveRule(record, rule, count);
if (resolution == null) { if (resolution == null) {
@@ -72,16 +72,16 @@ public class GaoPointTriggerServiceImplement implements GaoPointTriggerService {
count = count == null ? count(record) : count; count = count == null ? count(record) : count;
} }
long pointDelta = resolution.pointDelta(); long pointDelta = resolution.pointDelta();
if (0 < pointDelta) { if (pointDelta != 0) {
ledgerService.earn(record, rule, pointDelta, resolution.sourcePayload()); ledgerService.earn(record, rule, pointDelta, resolution.sourcePayload());
earnedPointValue = Math.addExact(earnedPointValue, pointDelta); pointDeltaTotal = Math.addExact(pointDeltaTotal, pointDelta);
} }
if (Boolean.TRUE.equals(rule.getExclusive())) { if (Boolean.TRUE.equals(rule.getExclusive())) {
break; break;
} }
} }
record.setEarnedPointValue(earnedPointValue); record.setEarnedPointValue(pointDeltaTotal);
eventRecordMapper.updateEarnedPointValue(record.getId(), earnedPointValue); eventRecordMapper.updateEarnedPointValue(record.getId(), pointDeltaTotal);
} }
@Transactional(TimiServerDBConfig.ROLLBACKER) @Transactional(TimiServerDBConfig.ROLLBACKER)
@@ -140,7 +140,7 @@ public class GaoPointTriggerServiceImplement implements GaoPointTriggerService {
} }
permissionChecker.checkAny(ModuleCode.GAO, GaoPermissionCode.POINT_SOURCE_VALUE.getValue()); permissionChecker.checkAny(ModuleCode.GAO, GaoPermissionCode.POINT_SOURCE_VALUE.getValue());
long pointValue = record.getPointValue(); long pointValue = record.getPointValue();
TimiException.requiredTrue(0 < pointValue, "pointValue invalid"); TimiException.requiredTrue(pointValue != 0, "pointValue invalid");
JsonNode condition = rule.getConditionJson(); JsonNode condition = rule.getConditionJson();
if (condition != null) { if (condition != null) {
JsonNode min = condition.get("min"); JsonNode min = condition.get("min");
@@ -8,6 +8,7 @@ import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
import com.imyeyu.api.modules.gao.vo.GaoCustomerTrendStateReq; import com.imyeyu.api.modules.gao.vo.GaoCustomerTrendStateReq;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView; import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView; import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
import com.imyeyu.api.modules.gao.vo.GaoEventRecordNumberValueDailyStatView;
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq; import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
import com.imyeyu.java.bean.timi.TimiException; import com.imyeyu.java.bean.timi.TimiException;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -48,6 +49,12 @@ public class GaoStoreChartServiceImplement implements GaoStoreChartService {
return eventRecordMapper.stateDailyByRange(req); return eventRecordMapper.stateDailyByRange(req);
} }
@Override
public List<GaoEventRecordNumberValueDailyStatView> eventRecordNumberValueDailyStat(GaoStoreChartReq req) {
checkRangeReq(req);
return eventRecordMapper.stateNumberValueDailyByRange(req);
}
@Override @Override
public List<GaoEventRecordCalendarView> eventRecordCalendar(GaoStoreChartReq req) { public List<GaoEventRecordCalendarView> eventRecordCalendar(GaoStoreChartReq req) {
checkRangeReq(req); checkRangeReq(req);
@@ -0,0 +1,17 @@
package com.imyeyu.api.modules.gao.vo;
import lombok.Data;
/// 登记事件数值每日统计视图
@Data
public class GaoEventRecordNumberValueDailyStatView {
/// 登记事件 ID
private String eventId;
/// 日期值,格式为 yyyyMMdd
private Integer dateValue;
/// 当日登记数值合计
private Long dailyNumberValue;
}
@@ -0,0 +1,21 @@
CREATE TABLE `feedback` (
`id` CHAR(36) NOT NULL COMMENT '主键',
`module` VARCHAR(32) NOT NULL COMMENT '所属模块',
`user_id` CHAR(36) NULL COMMENT '提交用户 ID,匿名反馈为空',
`content_id` VARCHAR(36) NOT NULL COMMENT '反馈内容文章 ID',
`contact` VARCHAR(255) NULL COMMENT '联系方式',
`ip` VARCHAR(64) NULL COMMENT '提交 IP',
`status` VARCHAR(16) NOT NULL DEFAULT 'PENDING' COMMENT '处理状态',
`response_id` VARCHAR(36) NULL COMMENT '管理员回复文章 ID',
`responded_by` CHAR(36) NULL COMMENT '回复用户 ID',
`responded_at` BIGINT NULL COMMENT '回复时间',
`created_at` BIGINT NOT NULL COMMENT '创建时间',
`updated_at` BIGINT NOT NULL COMMENT '更新时间',
`deleted_at` BIGINT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
KEY `idx_feedback_module_status_created` (`module`, `status`, `created_at`),
KEY `idx_feedback_user_created` (`user_id`, `created_at`),
KEY `idx_feedback_content_id` (`content_id`),
KEY `idx_feedback_response_id` (`response_id`),
KEY `idx_feedback_deleted_at` (`deleted_at`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '通用反馈';
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.imyeyu.api.modules.common.mapper.AttachmentMapper"> <mapper namespace="com.imyeyu.api.modules.common.mapper.AttachmentMapper">
<select id="selectByBizIdList" resultType="com.imyeyu.api.modules.common.entity.Attachment"> <select id="selectAllByBizIdList" resultType="com.imyeyu.api.modules.common.entity.Attachment">
SELECT SELECT
* *
FROM `attachment` FROM `attachment`
@@ -350,6 +350,22 @@
r.`registered_date_value` ASC, r.`registered_date_value` ASC,
r.`event_id` ASC r.`event_id` ASC
</select> </select>
<select id="stateNumberValueDailyByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoEventRecordNumberValueDailyStatView">
SELECT
r.`event_id` AS `eventId`,
r.`registered_date_value` AS `dateValue`,
SUM(r.`number_value`) AS `dailyNumberValue`
FROM `gao_event_record` r
WHERE
<include refid="storeChartRangeWhere"/>
AND r.`number_value` IS NOT NULL
GROUP BY
r.`event_id`,
r.`registered_date_value`
ORDER BY
r.`registered_date_value` ASC,
r.`event_id` ASC
</select>
<select id="selectCalendarByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView"> <select id="selectCalendarByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView">
SELECT SELECT
r.`id`, r.`id`,
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.imyeyu.api.modules.gao.mapper.GaoPointRuleMapper"> <mapper namespace="com.imyeyu.api.modules.gao.mapper.GaoPointRuleMapper">
<select id="selectByIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoPointRule">
SELECT *
FROM gao_point_rule
WHERE deleted_at IS NULL
AND id IN
<foreach collection="idList" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</select>
<select id="selectActiveByStoreIdAndEventId" resultType="com.imyeyu.api.modules.gao.entity.GaoPointRule"> <select id="selectActiveByStoreIdAndEventId" resultType="com.imyeyu.api.modules.gao.entity.GaoPointRule">
SELECT * SELECT *
FROM `gao_point_rule` FROM `gao_point_rule`