Compare commits
42
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
118bdb1666 | ||
|
|
944de228f7 | ||
|
|
25c9cd4dfc | ||
|
|
882cd226ec | ||
|
|
feb4d7af66 | ||
|
|
d75ab1ed5f | ||
|
|
a501eb7443 | ||
|
|
19941d9480 | ||
|
|
cd3d522d4f | ||
|
|
181c5078e9 | ||
|
|
e97f46e6b4 | ||
|
|
c0f89deb83 | ||
|
|
ce695463d3 | ||
|
|
83c683d473 | ||
|
|
9555474b0b | ||
|
|
a150f9e017 | ||
|
|
ecd2fa1c33 | ||
|
|
e3236d262d | ||
|
|
c8e2e16ba5 | ||
|
|
99b44faf09 | ||
|
|
b3e3cbf84b | ||
|
|
0aee11d824 | ||
|
|
fcf358a768 | ||
|
|
619369104c | ||
|
|
4f1408b9d0 | ||
|
|
029eea70cc | ||
|
|
22b1e65385 | ||
|
|
2170c48763 | ||
|
|
c2d1c48aae | ||
|
|
e14958c643 | ||
|
|
da288338cd | ||
|
|
ea430f2468 | ||
|
|
f76f79744a | ||
|
|
19daaff907 | ||
|
|
db94d8f932 | ||
|
|
53618fe362 | ||
|
|
523edffc4e | ||
|
|
c7ddb1a8b0 | ||
|
|
45c9fc814a | ||
|
|
407dc13ac4 | ||
|
|
0c06bf16c2 | ||
|
|
1db39e77d3 |
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.timiserverapi</groupId>
|
<groupId>com.imyeyu.timiserverapi</groupId>
|
||||||
<artifactId>TimiServerAPI</artifactId>
|
<artifactId>TimiServerAPI</artifactId>
|
||||||
<version>1.0.35</version>
|
<version>1.0.31</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>TimiServerAPI</name>
|
<name>TimiServerAPI</name>
|
||||||
<description>imyeyu.com API</description>
|
<description>imyeyu.com API</description>
|
||||||
|
|||||||
-66
@@ -1,66 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.controller;
|
|
||||||
|
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
|
||||||
import com.imyeyu.api.modules.gao.annotation.RequireGaoPermission;
|
|
||||||
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
|
||||||
import com.imyeyu.api.modules.gao.service.GaoCustomerConsumptionRecordService;
|
|
||||||
import com.imyeyu.api.modules.gao.service.GaoCustomerService;
|
|
||||||
import com.imyeyu.api.modules.gao.service.GaoStoreScopeService;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerConsumptionRecordPage;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerConsumptionRecordPageResult;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
|
||||||
import com.imyeyu.spring.annotation.AOPLog;
|
|
||||||
import com.imyeyu.spring.annotation.RequestRateLimit;
|
|
||||||
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.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/// GAO 客户消费事实接口
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-07
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@RequestMapping("/gao/customer/consumption-record")
|
|
||||||
public class GaoCustomerConsumptionRecordController {
|
|
||||||
|
|
||||||
private final AttachmentService attachmentService;
|
|
||||||
private final GaoCustomerService customerService;
|
|
||||||
private final GaoStoreScopeService storeScopeService;
|
|
||||||
private final GaoCustomerConsumptionRecordService service;
|
|
||||||
|
|
||||||
@AOPLog
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequireGaoPermission(GaoPermissionCode.SALES_ORDER_READ)
|
|
||||||
@PostMapping("/list")
|
|
||||||
public GaoCustomerConsumptionRecordPageResult list(@RequestBody GaoCustomerConsumptionRecordPage page) {
|
|
||||||
TimiException.required(page, "not found consumption record page");
|
|
||||||
page.setStoreId(storeScopeService.resolveStoreId(page.getStoreId()));
|
|
||||||
|
|
||||||
GaoCustomerConsumptionRecordPageResult result = service.pageByQuery(page);
|
|
||||||
List<String> customerIdList = result.getList()
|
|
||||||
.stream()
|
|
||||||
.map(GaoCustomerConsumptionRecord::getCustomerId)
|
|
||||||
.filter(customerId -> customerId != null && !customerId.isBlank())
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
var customerMap = customerService.mapByIdList(customerIdList);
|
|
||||||
Map<String, List<Attachment>> attachmentMap = attachmentService.mapByBizIdList(Attachment.BizType.GAO_CUSTOMER, customerIdList);
|
|
||||||
for (GaoCustomerConsumptionRecord record : result.getList()) {
|
|
||||||
var customer = customerMap.get(record.getCustomerId());
|
|
||||||
if (customer == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
customer.setAttachmentList(attachmentMap.getOrDefault(customer.getId(), List.of()));
|
|
||||||
record.setCustomer(customer);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,6 @@ import com.imyeyu.api.modules.gao.vo.GaoFundRecordPage;
|
|||||||
import com.imyeyu.api.modules.gao.vo.GaoFundRevokeRequest;
|
import com.imyeyu.api.modules.gao.vo.GaoFundRevokeRequest;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoOrderPaymentRevokeRequest;
|
import com.imyeyu.api.modules.gao.vo.GaoOrderPaymentRevokeRequest;
|
||||||
import com.imyeyu.api.modules.user.entity.User;
|
import com.imyeyu.api.modules.user.entity.User;
|
||||||
import com.imyeyu.api.modules.user.service.UserLoginService;
|
|
||||||
import com.imyeyu.api.modules.user.service.UserService;
|
import com.imyeyu.api.modules.user.service.UserService;
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.annotation.AOPLog;
|
import com.imyeyu.spring.annotation.AOPLog;
|
||||||
@@ -43,7 +42,6 @@ public class GaoFundRecordController {
|
|||||||
private final GaoStoreScopeService storeScopeService;
|
private final GaoStoreScopeService storeScopeService;
|
||||||
private final AttachmentService attachmentService;
|
private final AttachmentService attachmentService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final UserLoginService userLoginService;
|
|
||||||
|
|
||||||
@AOPLog
|
@AOPLog
|
||||||
@RequestRateLimit
|
@RequestRateLimit
|
||||||
@@ -68,33 +66,6 @@ public class GaoFundRecordController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AOPLog
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequireGaoPermission(GaoPermissionCode.FUND_RECEIVE_CREATE)
|
|
||||||
@PostMapping("/my-receive/list")
|
|
||||||
public PageResult<GaoFundRecord> listMyReceive(@RequestBody GaoFundRecordPage page) {
|
|
||||||
TimiException.required(page, "not found page");
|
|
||||||
page.setStoreId(storeScopeService.resolveStoreId(page.getStoreId()));
|
|
||||||
page.setOperatorUserId(userLoginService.getRequireLoginUserId());
|
|
||||||
page.setOperationType(GaoFundRecord.OperationType.RECEIVE);
|
|
||||||
PageResult<GaoFundRecord> result = service.pageByQuery(page);
|
|
||||||
fillTransient(result.getList());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@AOPLog
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequireGaoPermission(GaoPermissionCode.FUND_RECEIVE_CREATE)
|
|
||||||
@PostMapping("/my-receive/detail")
|
|
||||||
public GaoFundRecord detailMyReceive(@RequestParam String id) {
|
|
||||||
GaoFundRecord result = service.detail(id);
|
|
||||||
TimiException.requiredTrue(result.getOperationType() == GaoFundRecord.OperationType.RECEIVE, "not found fund receive record");
|
|
||||||
TimiException.requiredTrue(userLoginService.getRequireLoginUserId().equals(result.getOperatorUserId()), "只能读取自己提交的收款");
|
|
||||||
storeScopeService.checkStoreId(result.getStoreId());
|
|
||||||
fillTransient(List.of(result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@AOPLog
|
@AOPLog
|
||||||
@RequestRateLimit
|
@RequestRateLimit
|
||||||
@RequireGaoPermission(GaoPermissionCode.FUND_REVOKE)
|
@RequireGaoPermission(GaoPermissionCode.FUND_REVOKE)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.imyeyu.api.modules.gao.controller;
|
|||||||
|
|
||||||
import com.imyeyu.api.modules.gao.annotation.RequireGaoPermission;
|
import com.imyeyu.api.modules.gao.annotation.RequireGaoPermission;
|
||||||
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
||||||
import com.imyeyu.api.bean.PermissionMatchMode;
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoFundRecord;
|
import com.imyeyu.api.modules.gao.entity.GaoFundRecord;
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoSalesOrder;
|
import com.imyeyu.api.modules.gao.entity.GaoSalesOrder;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoOrderPaymentService;
|
import com.imyeyu.api.modules.gao.service.GaoOrderPaymentService;
|
||||||
@@ -113,7 +112,7 @@ public class GaoSalesOrderController {
|
|||||||
|
|
||||||
@AOPLog
|
@AOPLog
|
||||||
@RequestRateLimit
|
@RequestRateLimit
|
||||||
@RequireGaoPermission(value = {GaoPermissionCode.FUND_RECEIVE_CREATE, GaoPermissionCode.FUND_RECORD_READ}, mode = PermissionMatchMode.ANY)
|
@RequireGaoPermission(GaoPermissionCode.FUND_RECEIVE_CREATE)
|
||||||
@PostMapping("/payment/cancel")
|
@PostMapping("/payment/cancel")
|
||||||
public GaoFundRecord cancelPayment(@RequestBody GaoOrderPaymentActionRequest request) {
|
public GaoFundRecord cancelPayment(@RequestBody GaoOrderPaymentActionRequest request) {
|
||||||
return paymentService.cancel(request);
|
return paymentService.cancel(request);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.gao.entity;
|
package com.imyeyu.api.modules.gao.entity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.imyeyu.spring.annotation.table.Transient;
|
|
||||||
import com.imyeyu.spring.entity.UUIDEntity;
|
import com.imyeyu.spring.entity.UUIDEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -42,8 +41,4 @@ public class GaoCustomerConsumptionRecord extends UUIDEntity {
|
|||||||
private Long revokedAt;
|
private Long revokedAt;
|
||||||
private String revokeReason;
|
private String revokeReason;
|
||||||
private JsonNode sourcePayload;
|
private JsonNode sourcePayload;
|
||||||
|
|
||||||
/// 客户
|
|
||||||
@Transient
|
|
||||||
private GaoCustomer customer;
|
|
||||||
}
|
}
|
||||||
|
|||||||
-7
@@ -1,7 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.gao.mapper;
|
package com.imyeyu.api.modules.gao.mapper;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerConsumptionRecordPage;
|
|
||||||
import com.imyeyu.spring.mapper.BaseMapper;
|
import com.imyeyu.spring.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -17,11 +16,5 @@ public interface GaoCustomerConsumptionRecordMapper extends BaseMapper<GaoCustom
|
|||||||
|
|
||||||
List<GaoCustomerConsumptionRecord> selectActiveByWindow(@Param("storeId") String storeId, @Param("customerId") String customerId, @Param("beginAt") long beginAt, @Param("endAt") long endAt);
|
List<GaoCustomerConsumptionRecord> selectActiveByWindow(@Param("storeId") String storeId, @Param("customerId") String customerId, @Param("beginAt") long beginAt, @Param("endAt") long endAt);
|
||||||
|
|
||||||
long countByQuery(GaoCustomerConsumptionRecordPage page);
|
|
||||||
|
|
||||||
Long sumAmountByPage(GaoCustomerConsumptionRecordPage page);
|
|
||||||
|
|
||||||
List<GaoCustomerConsumptionRecord> selectByQuery(GaoCustomerConsumptionRecordPage page);
|
|
||||||
|
|
||||||
int revokeBySource(@Param("sourceType") GaoCustomerConsumptionRecord.SourceType sourceType, @Param("sourceId") String sourceId, @Param("revokedAt") long revokedAt, @Param("revokeReason") String revokeReason);
|
int revokeBySource(@Param("sourceType") GaoCustomerConsumptionRecord.SourceType sourceType, @Param("sourceId") String sourceId, @Param("revokedAt") long revokedAt, @Param("revokeReason") String revokeReason);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.imyeyu.api.modules.gao.mapper;
|
|||||||
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoPackageConfigItem;
|
import com.imyeyu.api.modules.gao.entity.GaoPackageConfigItem;
|
||||||
import com.imyeyu.spring.mapper.BaseMapper;
|
import com.imyeyu.spring.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Delete;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -14,12 +13,6 @@ import java.util.List;
|
|||||||
/// @since 2026-08-31
|
/// @since 2026-08-31
|
||||||
public interface GaoPackageConfigItemMapper extends BaseMapper<GaoPackageConfigItem, String> {
|
public interface GaoPackageConfigItemMapper extends BaseMapper<GaoPackageConfigItem, String> {
|
||||||
|
|
||||||
/// 物理删除套餐配置的全部权益模板项
|
|
||||||
///
|
|
||||||
/// @param packageConfigId 套餐配置 ID
|
|
||||||
@Delete("DELETE FROM `gao_package_config_item` WHERE `package_config_id` = #{packageConfigId}")
|
|
||||||
void destroyByPackageConfigId(@Param("packageConfigId") String packageConfigId);
|
|
||||||
|
|
||||||
/// 按套餐配置 ID 查询产品
|
/// 按套餐配置 ID 查询产品
|
||||||
List<GaoPackageConfigItem> selectByPackageConfigId(@Param("packageConfigId") String packageConfigId);
|
List<GaoPackageConfigItem> selectByPackageConfigId(@Param("packageConfigId") String packageConfigId);
|
||||||
|
|
||||||
|
|||||||
-5
@@ -1,8 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.gao.service;
|
package com.imyeyu.api.modules.gao.service;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerConsumptionRecordPage;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerConsumptionRecordPageResult;
|
|
||||||
import com.imyeyu.spring.service.BaseService;
|
import com.imyeyu.spring.service.BaseService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -13,9 +11,6 @@ import java.util.List;
|
|||||||
/// @since 2026-09-04
|
/// @since 2026-09-04
|
||||||
public interface GaoCustomerConsumptionRecordService extends BaseService<GaoCustomerConsumptionRecord, String> {
|
public interface GaoCustomerConsumptionRecordService extends BaseService<GaoCustomerConsumptionRecord, String> {
|
||||||
|
|
||||||
/// 按条件分页查询消费事实
|
|
||||||
GaoCustomerConsumptionRecordPageResult pageByQuery(GaoCustomerConsumptionRecordPage page);
|
|
||||||
|
|
||||||
/// 写入销售订单消费事实
|
/// 写入销售订单消费事实
|
||||||
///
|
///
|
||||||
/// 幂等,重复执行返回已有事实
|
/// 幂等,重复执行返回已有事实
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public interface GaoOrderPaymentService {
|
|||||||
/// 拒绝收款
|
/// 拒绝收款
|
||||||
GaoFundRecord reject(GaoOrderPaymentActionRequest request);
|
GaoFundRecord reject(GaoOrderPaymentActionRequest request);
|
||||||
|
|
||||||
/// 撤销待核销收款
|
/// 撤销自己提交的收款
|
||||||
GaoFundRecord cancel(GaoOrderPaymentActionRequest request);
|
GaoFundRecord cancel(GaoOrderPaymentActionRequest request);
|
||||||
|
|
||||||
/// 登记退款
|
/// 登记退款
|
||||||
|
|||||||
-16
@@ -1,14 +1,10 @@
|
|||||||
package com.imyeyu.api.modules.gao.service.implement;
|
package com.imyeyu.api.modules.gao.service.implement;
|
||||||
|
|
||||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoSalesOrder;
|
import com.imyeyu.api.modules.gao.entity.GaoSalesOrder;
|
||||||
import com.imyeyu.api.modules.gao.mapper.GaoCustomerConsumptionRecordMapper;
|
import com.imyeyu.api.modules.gao.mapper.GaoCustomerConsumptionRecordMapper;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoCustomerConsumptionRecordService;
|
import com.imyeyu.api.modules.gao.service.GaoCustomerConsumptionRecordService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoCustomerService;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerConsumptionRecordPage;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerConsumptionRecordPageResult;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
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;
|
||||||
@@ -28,24 +24,12 @@ import java.util.List;
|
|||||||
public class GaoCustomerConsumptionRecordServiceImplement extends AbstractEntityService<GaoCustomerConsumptionRecord, String> implements GaoCustomerConsumptionRecordService {
|
public class GaoCustomerConsumptionRecordServiceImplement extends AbstractEntityService<GaoCustomerConsumptionRecord, String> implements GaoCustomerConsumptionRecordService {
|
||||||
|
|
||||||
private final GaoCustomerConsumptionRecordMapper mapper;
|
private final GaoCustomerConsumptionRecordMapper mapper;
|
||||||
private final GaoCustomerService customerService;
|
|
||||||
private final AttachmentService attachmentService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BaseMapper<GaoCustomerConsumptionRecord, String> mapper() {
|
protected BaseMapper<GaoCustomerConsumptionRecord, String> mapper() {
|
||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public GaoCustomerConsumptionRecordPageResult pageByQuery(GaoCustomerConsumptionRecordPage page) {
|
|
||||||
TimiException.required(page, "not found consumption record page");
|
|
||||||
GaoCustomerConsumptionRecordPageResult result = new GaoCustomerConsumptionRecordPageResult();
|
|
||||||
result.setTotal(mapper.countByQuery(page));
|
|
||||||
result.setAmountTotal(mapper.sumAmountByPage(page));
|
|
||||||
result.setList(mapper.selectByQuery(page));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||||
@Override
|
@Override
|
||||||
public GaoCustomerConsumptionRecord createSalesOrder(String salesOrderId, String storeId, String customerId, Long amount, Long effectiveAt, GaoSalesOrder.OrderType orderType) {
|
public GaoCustomerConsumptionRecord createSalesOrder(String salesOrderId, String storeId, String customerId, Long amount, Long effectiveAt, GaoSalesOrder.OrderType orderType) {
|
||||||
|
|||||||
+1
-6
@@ -1,12 +1,10 @@
|
|||||||
package com.imyeyu.api.modules.gao.service.implement;
|
package com.imyeyu.api.modules.gao.service.implement;
|
||||||
|
|
||||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||||
import com.imyeyu.api.bean.ModuleCode;
|
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoFundRecord;
|
import com.imyeyu.api.modules.gao.entity.GaoFundRecord;
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoSalesOrder;
|
import com.imyeyu.api.modules.gao.entity.GaoSalesOrder;
|
||||||
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
|
||||||
import com.imyeyu.api.modules.gao.service.GaoFundRecordService;
|
import com.imyeyu.api.modules.gao.service.GaoFundRecordService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoOrderPaymentService;
|
import com.imyeyu.api.modules.gao.service.GaoOrderPaymentService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoPointTriggerService;
|
import com.imyeyu.api.modules.gao.service.GaoPointTriggerService;
|
||||||
@@ -19,7 +17,6 @@ import com.imyeyu.api.modules.gao.vo.GaoOrderPaymentRevokeRequest;
|
|||||||
import com.imyeyu.api.modules.system.entity.Logger;
|
import com.imyeyu.api.modules.system.entity.Logger;
|
||||||
import com.imyeyu.api.modules.system.service.LoggerService;
|
import com.imyeyu.api.modules.system.service.LoggerService;
|
||||||
import com.imyeyu.api.modules.user.service.UserLoginService;
|
import com.imyeyu.api.modules.user.service.UserLoginService;
|
||||||
import com.imyeyu.api.modules.user.service.PermissionChecker;
|
|
||||||
import com.imyeyu.java.TimiJava;
|
import com.imyeyu.java.TimiJava;
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.service.AbstractEntityService;
|
import com.imyeyu.spring.service.AbstractEntityService;
|
||||||
@@ -43,7 +40,6 @@ public class GaoOrderPaymentServiceImplement implements GaoOrderPaymentService {
|
|||||||
private final GaoPointTriggerService pointTriggerService;
|
private final GaoPointTriggerService pointTriggerService;
|
||||||
private final AttachmentService attachmentService;
|
private final AttachmentService attachmentService;
|
||||||
private final UserLoginService userLoginService;
|
private final UserLoginService userLoginService;
|
||||||
private final PermissionChecker permissionChecker;
|
|
||||||
private final LoggerService loggerService;
|
private final LoggerService loggerService;
|
||||||
|
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||||
@@ -114,8 +110,7 @@ public class GaoOrderPaymentServiceImplement implements GaoOrderPaymentService {
|
|||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||||
@Override
|
@Override
|
||||||
public GaoFundRecord cancel(GaoOrderPaymentActionRequest request) {
|
public GaoFundRecord cancel(GaoOrderPaymentActionRequest request) {
|
||||||
boolean onlyOperator = !permissionChecker.hasAny(ModuleCode.GAO, GaoPermissionCode.FUND_RECORD_READ.getValue());
|
return releasePending(request, GaoFundRecord.Status.CANCELLED, true);
|
||||||
return releasePending(request, GaoFundRecord.Status.CANCELLED, onlyOperator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GaoFundRecord releasePending(GaoOrderPaymentActionRequest request, GaoFundRecord.Status targetStatus, boolean onlyOperator) {
|
private GaoFundRecord releasePending(GaoOrderPaymentActionRequest request, GaoFundRecord.Status targetStatus, boolean onlyOperator) {
|
||||||
|
|||||||
+6
-4
@@ -132,14 +132,16 @@ public class GaoPackageConfigServiceImplement extends AbstractEntityService<GaoP
|
|||||||
dbConfig.setEndAt(request.getEndAt());
|
dbConfig.setEndAt(request.getEndAt());
|
||||||
dbConfig.setSort(request.getSort());
|
dbConfig.setSort(request.getSort());
|
||||||
prepareConfig(dbConfig, dbConfig.getId());
|
prepareConfig(dbConfig, dbConfig.getId());
|
||||||
TimiException.required(request.getItemList(), "套餐至少配置一个产品");
|
|
||||||
verifyItems(dbConfig.getStoreId(), request.getItemList());
|
|
||||||
dbConfig.setUpdatedBy(userLoginService.getRequireLoginUserId());
|
dbConfig.setUpdatedBy(userLoginService.getRequireLoginUserId());
|
||||||
super.update(dbConfig);
|
super.update(dbConfig);
|
||||||
// 权益项仅是后续购买使用的套餐模板,历史订单已保存独立的订单明细快照
|
if (request.getItemList() != null) {
|
||||||
itemMapper.destroyByPackageConfigId(dbConfig.getId());
|
verifyItems(dbConfig.getStoreId(), request.getItemList());
|
||||||
|
GaoPackageConfigItem example = new GaoPackageConfigItem();
|
||||||
|
example.setPackageConfigId(dbConfig.getId());
|
||||||
|
itemMapper.deleteAllByExample(example);
|
||||||
saveItems(dbConfig.getId(), request.getItemList());
|
saveItems(dbConfig.getId(), request.getItemList());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ public class GaoPointTriggerServiceImplement implements GaoPointTriggerService {
|
|||||||
GaoPointScriptContext context = eventContext(rule, record);
|
GaoPointScriptContext context = eventContext(rule, record);
|
||||||
GroovyScriptExecutionResult<GaoPointDecision> execution = evaluate(rule, record.getStoreId(), record.getCustomerId(), record.getRegisteredAt(),
|
GroovyScriptExecutionResult<GaoPointDecision> execution = evaluate(rule, record.getStoreId(), record.getCustomerId(), record.getRegisteredAt(),
|
||||||
GaoPointRule.TriggerRefType.EVENT.name(), record.getEventId());
|
GaoPointRule.TriggerRefType.EVENT.name(), record.getEventId());
|
||||||
if (execution.result() == null) {
|
if (execution == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pointDeltaTotal += applyDecision(rule, execution, GaoPointLedger.TriggerSourceType.EVENT_RECORD, record.getId(), null,
|
pointDeltaTotal += applyDecision(rule, execution, GaoPointLedger.TriggerSourceType.EVENT_RECORD, record.getId(), null,
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
|
||||||
import com.imyeyu.java.bean.BasePage;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/// GAO 客户消费事实分页请求
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-07
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class GaoCustomerConsumptionRecordPage extends BasePage {
|
|
||||||
|
|
||||||
/// 门店 ID
|
|
||||||
private String storeId;
|
|
||||||
|
|
||||||
/// 客户 ID
|
|
||||||
private String customerId;
|
|
||||||
|
|
||||||
/// 消费来源
|
|
||||||
private GaoCustomerConsumptionRecord.SourceType sourceType;
|
|
||||||
|
|
||||||
/// 消费状态
|
|
||||||
private GaoCustomerConsumptionRecord.Status status;
|
|
||||||
|
|
||||||
/// 起始生效时间
|
|
||||||
private Long beginAt;
|
|
||||||
|
|
||||||
/// 结束生效时间
|
|
||||||
private Long endAt;
|
|
||||||
}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord;
|
|
||||||
import com.imyeyu.spring.bean.PageResult;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/// GAO 客户消费事实分页查询结果
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-07
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class GaoCustomerConsumptionRecordPageResult extends PageResult<GaoCustomerConsumptionRecord> {
|
|
||||||
|
|
||||||
/// 当前筛选条件下的消费金额合计,单位分
|
|
||||||
private Long amountTotal;
|
|
||||||
}
|
|
||||||
@@ -39,7 +39,4 @@ public class GaoFundRecordPage extends BasePage {
|
|||||||
|
|
||||||
/// 操作结束时间
|
/// 操作结束时间
|
||||||
private Long endAt;
|
private Long endAt;
|
||||||
|
|
||||||
/// 操作用户 ID,仅限服务端设置的数据范围条件
|
|
||||||
private String operatorUserId;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,26 +12,6 @@
|
|||||||
AND `effective_at` >= #{beginAt} AND `effective_at` <= #{endAt} AND `deleted_at` IS NULL
|
AND `effective_at` >= #{beginAt} AND `effective_at` <= #{endAt} AND `deleted_at` IS NULL
|
||||||
ORDER BY `effective_at` ASC, `id` ASC
|
ORDER BY `effective_at` ASC, `id` ASC
|
||||||
</select>
|
</select>
|
||||||
<sql id="pageWhere">
|
|
||||||
r.`deleted_at` IS NULL
|
|
||||||
<if test="storeId != null and storeId != ''">AND r.`store_id` = #{storeId}</if>
|
|
||||||
<if test="customerId != null and customerId != ''">AND r.`customer_id` = #{customerId}</if>
|
|
||||||
<if test="sourceType != null">AND r.`source_type` = #{sourceType}</if>
|
|
||||||
<if test="status != null">AND r.`status` = #{status}</if>
|
|
||||||
<if test="beginAt != null">AND r.`effective_at` >= #{beginAt}</if>
|
|
||||||
<if test="endAt != null">AND r.`effective_at` <= #{endAt}</if>
|
|
||||||
</sql>
|
|
||||||
<select id="countByQuery" resultType="long">
|
|
||||||
SELECT COUNT(1) FROM `gao_customer_consumption_record` r WHERE <include refid="pageWhere"/>
|
|
||||||
</select>
|
|
||||||
<select id="sumAmountByPage" resultType="long">
|
|
||||||
SELECT COALESCE(SUM(r.`amount`), 0) FROM `gao_customer_consumption_record` r WHERE <include refid="pageWhere"/>
|
|
||||||
</select>
|
|
||||||
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord">
|
|
||||||
SELECT r.* FROM `gao_customer_consumption_record` r WHERE <include refid="pageWhere"/>
|
|
||||||
ORDER BY r.`effective_at` DESC, r.`created_at` DESC
|
|
||||||
LIMIT #{offset}, #{limit}
|
|
||||||
</select>
|
|
||||||
<update id="revokeBySource">
|
<update id="revokeBySource">
|
||||||
UPDATE `gao_customer_consumption_record`
|
UPDATE `gao_customer_consumption_record`
|
||||||
SET `status` = 'REVOKED', `revoked_at` = #{revokedAt}, `revoke_reason` = #{revokeReason}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
SET `status` = 'REVOKED', `revoked_at` = #{revokedAt}, `revoke_reason` = #{revokeReason}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)
|
||||||
|
|||||||
@@ -52,7 +52,6 @@
|
|||||||
<if test="status != null">AND f.`status` = #{status}</if>
|
<if test="status != null">AND f.`status` = #{status}</if>
|
||||||
<if test="beginAt != null">AND f.`occurred_at` >= #{beginAt}</if>
|
<if test="beginAt != null">AND f.`occurred_at` >= #{beginAt}</if>
|
||||||
<if test="endAt != null">AND f.`occurred_at` <= #{endAt}</if>
|
<if test="endAt != null">AND f.`occurred_at` <= #{endAt}</if>
|
||||||
<if test="operatorUserId != null and operatorUserId != ''">AND f.`operator_user_id` = #{operatorUserId}</if>
|
|
||||||
</sql>
|
</sql>
|
||||||
<select id="countByQuery" resultType="long">
|
<select id="countByQuery" resultType="long">
|
||||||
SELECT COUNT(1) FROM `gao_fund_record` f WHERE <include refid="queryWhere"/>
|
SELECT COUNT(1) FROM `gao_fund_record` f WHERE <include refid="queryWhere"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user