Compare commits

...
46 Commits
Author SHA1 Message Date
timi 944de228f7 Merge pull request 'v1.0.30' (#42) from dev into master
Reviewed-on: #42
2026-09-01 17:44:48 +00:00
Timi a81c8476e7 v1.0.30
CI / build-deploy (pull_request) Successful in 25s
CI / notify-on-failure (pull_request) Skipped
2026-09-02 01:44:32 +08:00
timi 25c9cd4dfc Merge pull request 'v1.0.30' (#41) from dev into master
Reviewed-on: #41
2026-09-01 17:42:44 +00:00
Timi e7cf1a72e3 v1.0.30
CI / build-deploy (pull_request) Failing after 6s
CI / notify-on-failure (pull_request) Successful in 0s
2026-09-02 01:42:24 +08:00
timi 882cd226ec Merge pull request 'v1.0.30' (#40) from dev into master
Reviewed-on: #40
2026-09-01 17:38:50 +00:00
Timi eec665109e v1.0.30
CI / build-deploy (pull_request) Failing after 3s
CI / notify-on-failure (pull_request) Successful in 0s
2026-09-02 01:37:47 +08:00
Timi f6a2f5a6f5 support half paid 2026-09-01 14:07:04 +08:00
Timi 9ba610de86 update store diary attachment 2026-09-01 14:06:13 +08:00
timi feb4d7af66 Merge pull request 'v1.0.28' (#38) from dev into master
Reviewed-on: #38
2026-08-30 15:51:37 +00:00
timi d75ab1ed5f Merge pull request 'v1.0.27' (#37) from dev into master
Reviewed-on: #37
2026-08-29 17:49:23 +00:00
timi a501eb7443 Merge pull request 'v1.0.26' (#36) from dev into master
Reviewed-on: #36
2026-08-28 16:52:15 +00:00
timi 19941d9480 Merge pull request 'v1.0.25' (#35) from dev into master
Reviewed-on: #35
2026-08-23 17:50:25 +00:00
timi cd3d522d4f Merge pull request 'v1.0.24' (#34) from dev into master
Reviewed-on: #34
2026-08-22 09:56:13 +00:00
timi 181c5078e9 Merge pull request 'v1.0.23' (#33) from dev into master
Reviewed-on: #33
2026-08-22 09:51:37 +00:00
timi e97f46e6b4 Merge pull request 'v1.0.22' (#32) from dev into master
Reviewed-on: #32
2026-08-21 17:31:33 +00:00
timi c0f89deb83 Merge pull request 'v1.0.22' (#31) from dev into master
Reviewed-on: #31
2026-08-21 17:28:32 +00:00
timi ce695463d3 Merge pull request 'v1.0.21' (#30) from dev into master
Reviewed-on: #30
2026-08-21 07:29:34 +00:00
timi 83c683d473 Merge pull request 'v1.0.20' (#29) from dev into master
Reviewed-on: #29
2026-08-21 07:25:32 +00:00
timi 9555474b0b Merge pull request 'v1.0.19' (#28) from dev into master
Reviewed-on: #28
2026-08-21 05:52:36 +00:00
timi a150f9e017 Merge pull request 'v1.0.18' (#27) from dev into master
Reviewed-on: #27
2026-08-20 17:40:22 +00:00
timi ecd2fa1c33 Merge pull request 'v1.0.17' (#26) from dev into master
Reviewed-on: #26
2026-08-19 17:30:35 +00:00
timi e3236d262d Merge pull request 'v1.0.16' (#25) from dev into master
Reviewed-on: #25
2026-08-16 03:37:08 +00:00
timi c8e2e16ba5 Merge pull request 'v1.0.15' (#24) from dev into master
Reviewed-on: #24
2026-08-15 17:49:51 +00:00
timi 99b44faf09 Merge pull request 'v1.0.15' (#23) from dev into master
Reviewed-on: #23
2026-08-15 17:45:26 +00:00
timi b3e3cbf84b Merge pull request 'v1.0.14' (#22) from dev into master
Reviewed-on: #22
2026-08-14 17:31:11 +00:00
timi 0aee11d824 Merge pull request 'v1.0.14' (#21) from dev into master
Reviewed-on: #21
2026-08-14 17:26:10 +00:00
timi fcf358a768 Merge pull request 'v1.0.13' (#20) from dev into master
Reviewed-on: #20
2026-08-13 09:52:26 +00:00
timi 619369104c Merge pull request 'v1.0.12' (#19) from dev into master
Reviewed-on: #19
2026-08-12 17:02:43 +00:00
timi 4f1408b9d0 Merge pull request 'v1.0.11' (#18) from dev into master
Reviewed-on: #18
2026-08-11 16:49:08 +00:00
timi 029eea70cc Merge pull request 'v1.0.10' (#17) from dev into master
Reviewed-on: #17
2026-08-11 16:45:36 +00:00
timi 22b1e65385 Merge pull request 'v1.0.9' (#16) from dev into master
Reviewed-on: #16
2026-08-11 16:01:10 +00:00
timi 2170c48763 Merge pull request 'v1.0.8' (#15) from dev into master
Reviewed-on: #15
2026-08-03 16:36:19 +00:00
timi c2d1c48aae Merge pull request 'v0.0.18' (#14) from dev into master
Reviewed-on: #14
2026-08-03 11:59:20 +00:00
timi e14958c643 Merge pull request 'v0.0.18' (#13) from dev into master
Reviewed-on: #13
2026-08-03 11:58:16 +00:00
timi da288338cd Merge pull request 'v1.0.7' (#12) from dev into master
Reviewed-on: #12
2026-08-01 09:34:18 +00:00
timi ea430f2468 Merge pull request 'v1.0.6' (#11) from dev into master
Reviewed-on: #11
2026-08-01 09:03:48 +00:00
timi f76f79744a Merge pull request 'v1.0.5' (#10) from dev into master
Reviewed-on: #10
2026-08-01 08:52:52 +00:00
timi 19daaff907 Merge pull request 'v1.0.4' (#9) from dev into master
Reviewed-on: #9
2026-08-01 03:13:00 +00:00
timi db94d8f932 Merge pull request 'v1.0.3' (#8) from dev into master
Reviewed-on: #8
2026-07-31 17:19:48 +00:00
timi 53618fe362 Merge pull request 'v1.0.3' (#7) from dev into master
Reviewed-on: #7
2026-07-31 17:13:37 +00:00
timi 523edffc4e Merge pull request 'v1.0.2' (#6) from dev into master
Reviewed-on: #6
2026-04-13 10:28:11 +00:00
timi c7ddb1a8b0 Merge pull request 'v1.0.1' (#5) from dev into master
Reviewed-on: #5
2026-04-12 16:17:02 +00:00
timi 45c9fc814a Merge pull request 'v1.0.0' (#4) from dev into master
Reviewed-on: #4
2026-04-09 05:16:04 +00:00
timi 407dc13ac4 Merge pull request 'v1.0.0' (#3) from dev into master
Reviewed-on: #3
2026-04-09 04:09:16 +00:00
timi 0c06bf16c2 Merge pull request 'v1.0.0' (#2) from dev into master
Reviewed-on: #2
2026-04-09 04:03:43 +00:00
timi 1db39e77d3 Merge pull request 'v1.0.0' (#1) from dev into master
Reviewed-on: #1
2026-04-08 08:48:12 +00:00
10 changed files with 117 additions and 13 deletions
+2 -2
View File
@@ -11,7 +11,7 @@
<groupId>com.imyeyu.timiserverapi</groupId>
<artifactId>TimiServerAPI</artifactId>
<version>1.0.29</version>
<version>1.0.30</version>
<packaging>jar</packaging>
<name>TimiServerAPI</name>
<description>imyeyu.com API</description>
@@ -198,7 +198,7 @@
<dependency>
<groupId>com.imyeyu.java</groupId>
<artifactId>timi-java</artifactId>
<version>0.0.7</version>
<version>0.0.11</version>
</dependency>
<dependency>
<groupId>com.imyeyu.utils</groupId>
@@ -34,6 +34,8 @@ public interface AttachmentMapper extends BaseMapper<Attachment, String>, RawMap
List<Attachment> selectAllByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, List<String> attachTypes);
List<Attachment> selectImageByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, String attachType);
long countByBizId(Attachment.BizType bizType, String bizId, List<String> attachTypes);
@Select("SELECT * FROM attachment WHERE `is_destroyed` = FALSE AND `destroy_at` < " + UNIX_TIME)
@@ -45,6 +45,12 @@ public interface AttachmentService extends BaseService<Attachment, String> {
*/
List<Attachment> listByBizId(Attachment.BizType bizType, String bizId, String... attachTypes);
default Map<String, Attachment> mapFirstImageByIdList(Attachment.BizType bizType, Collection<String> bizIdList) {
return mapFirstImageByIdList(bizType, bizIdList, null);
}
Map<String, Attachment> mapFirstImageByIdList(Attachment.BizType bizType, Collection<String> bizIdList, String attachType);
/**
* 根据多个业务 ID 批量获取附件
*
@@ -34,10 +34,12 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -244,9 +246,14 @@ public class AttachmentServiceImplement extends AbstractEntityService<Attachment
return mapper.selectAllByBizIdList(bizType, List.of(bizId), List.of(attachTypes));
}
@Override
public Map<String, Attachment> mapFirstImageByIdList(Attachment.BizType bizType, Collection<String> bizIdList, String attachType) {
return mapper.selectImageByBizIdList(bizType, new HashSet<>(bizIdList), attachType).stream().collect(Collectors.toMap(Attachment::getBizId, Function.identity()));
}
@Override
public Map<String, List<Attachment>> mapByBizIdList(Attachment.BizType bizType, Collection<String> bizIdList, String... attachTypes) {
return mapper.selectAllByBizIdList(bizType, bizIdList, List.of(attachTypes)).stream().collect(Collectors.groupingBy(Attachment::getBizId));
return mapper.selectAllByBizIdList(bizType, new HashSet<>(bizIdList), List.of(attachTypes)).stream().collect(Collectors.groupingBy(Attachment::getBizId));
}
@Override
@@ -71,10 +71,19 @@ public class GaoCustomerPackageController {
if (result.getList().isEmpty()) {
return result;
}
fillTransient(result.getList());
Map<String, GaoCustomer> customerMap = customerService.mapByIdList(result.getList().stream().map(GaoCustomerPackage::getCustomerId).toList());
List<String> customerIdList = result.getList().stream()
.map(GaoCustomerPackage::getCustomerId)
.filter(value -> value != null && !value.isBlank())
.distinct()
.toList();
Map<String, GaoCustomer> customerMap = customerService.mapByIdList(customerIdList);
Map<String, List<Attachment>> attachmentMap = attachmentService.mapByBizIdList(Attachment.BizType.GAO_CUSTOMER, customerIdList, GaoCustomer.AttachType.PHOTO.name());
for (GaoCustomerPackage packageEntity : result.getList()) {
packageEntity.setCustomer(customerMap.get(packageEntity.getCustomerId()));
GaoCustomer customer = customerMap.get(packageEntity.getCustomerId());
if (customer != null) {
customer.setAttachmentList(attachmentMap.get(customer.getId()));
}
packageEntity.setCustomer(customer);
}
return result;
}
@@ -8,6 +8,7 @@ import com.imyeyu.api.modules.gao.annotation.RequireGaoPermission;
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
import com.imyeyu.api.modules.gao.service.GaoStoreDiaryService;
import com.imyeyu.api.modules.gao.service.GaoStoreScopeService;
import com.imyeyu.api.modules.gao.vo.GaoStoreDiaryPage;
import com.imyeyu.api.modules.user.entity.User;
import com.imyeyu.api.modules.user.service.UserLoginService;
import com.imyeyu.api.modules.user.service.UserService;
@@ -16,7 +17,6 @@ import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.spring.annotation.AOPLog;
import com.imyeyu.spring.annotation.RequestRateLimit;
import com.imyeyu.spring.bean.PageResult;
import com.imyeyu.api.modules.gao.vo.GaoStoreDiaryPage;
import com.imyeyu.spring.util.ResponseView;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
@@ -25,6 +25,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/// GAO 门店日记接口
///
/// @author Codex
@@ -55,7 +58,16 @@ public class GaoStoreDiaryController {
TimiException.required(page.getEndCreatedAt(), "未找到门店日记结束时间");
TimiException.requiredTrue(page.getBeginCreatedAt() < page.getEndCreatedAt(), "门店日记时间范围无效");
page.setStoreId(storeScopeService.resolveStoreId(page.getStoreId()));
return service.page(page);
PageResult<Article> result = service.page(page);
{
List<String> articleIdList = result.getList().stream().map(Article::getId).toList();
Map<String, Attachment> attachMap = attachmentService.mapFirstImageByIdList(Attachment.BizType.ARTICLE, articleIdList);
for (Article article : result.getList()) {
Attachment attachment = attachMap.get(article.getId());
article.setAttachmentList(TimiJava.ofList(attachment));
}
}
return result;
}
/// 查询门店日记详情
@@ -1,8 +1,8 @@
package com.imyeyu.api.modules.gao.service;
import com.imyeyu.api.modules.common.entity.Article;
import com.imyeyu.spring.bean.PageResult;
import com.imyeyu.api.modules.gao.vo.GaoStoreDiaryPage;
import com.imyeyu.spring.bean.PageResult;
/// GAO 门店日记服务
///
@@ -1,8 +1,10 @@
package com.imyeyu.api.modules.gao.service.implement;
import com.imyeyu.api.bean.ModuleCode;
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
import com.imyeyu.api.modules.common.entity.Attachment;
import com.imyeyu.api.modules.common.service.AttachmentService;
import com.imyeyu.api.modules.gao.bean.GaoRoleCode;
import com.imyeyu.api.modules.gao.entity.GaoCustomerPackage;
import com.imyeyu.api.modules.gao.entity.GaoCustomerPackageItem;
import com.imyeyu.api.modules.gao.entity.GaoPackageDelivery;
@@ -18,6 +20,7 @@ import com.imyeyu.api.modules.gao.vo.GaoPackageDeliveryPage;
import com.imyeyu.api.modules.gao.vo.GaoPackageDeliveryRevokeRequest;
import com.imyeyu.api.modules.system.entity.Logger;
import com.imyeyu.api.modules.system.service.LoggerService;
import com.imyeyu.api.modules.user.service.RoleChecker;
import com.imyeyu.api.modules.user.service.UserLoginService;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiCode;
@@ -55,6 +58,7 @@ public class GaoPackageDeliveryServiceImplement extends AbstractEntityService<Ga
private final GaoCustomerPackageService customerPackageService;
private final AttachmentService attachmentService;
private final GaoStoreScopeService storeScopeService;
private final RoleChecker roleChecker;
private final UserLoginService userLoginService;
private final LoggerService loggerService;
@@ -156,7 +160,7 @@ public class GaoPackageDeliveryServiceImplement extends AbstractEntityService<Ga
}
TimiException.requiredTrue(hasAttachment(request.getAttachmentList()), "发放必须上传照片");
TimiException.requiredTrue(packageEntity.getStatus() == GaoCustomerPackage.Status.ACTIVE, "当前套餐不可发放");
TimiException.requiredTrue(packageEntity.getPaymentStatus() == GaoCustomerPackage.PaymentStatus.PAID, "套餐未付清,不能发放");
checkPaymentForDelivery(packageEntity);
List<GaoPackageDeliveryItem> requestItemList = validateRequestItems(request.getItemList());
Map<String, GaoCustomerPackageItem> packageItemMap = new HashMap<>();
for (GaoPackageDeliveryItem requestItem : requestItemList) {
@@ -213,7 +217,7 @@ public class GaoPackageDeliveryServiceImplement extends AbstractEntityService<Ga
GaoCustomerPackage packageEntity = customerPackageService.getForUpdate(delivery.getCustomerPackageId());
TimiException.required(packageEntity, "not found customer package");
TimiException.requiredTrue(packageEntity.getStatus() == GaoCustomerPackage.Status.ACTIVE, "当前套餐不可核销发放");
TimiException.requiredTrue(packageEntity.getPaymentStatus() == GaoCustomerPackage.PaymentStatus.PAID, "套餐未付清,不能核销发放");
checkPaymentForDelivery(packageEntity);
List<GaoPackageDeliveryItem> itemList = itemMapper.selectByDeliveryId(delivery.getId());
for (GaoPackageDeliveryItem deliveryItem : itemList) {
GaoCustomerPackageItem packageItem = customerPackageService.getItemForUpdate(deliveryItem.getCustomerPackageItemId());
@@ -400,6 +404,19 @@ public class GaoPackageDeliveryServiceImplement extends AbstractEntityService<Ga
return reason != null && !reason.trim().isEmpty();
}
private boolean canDeliver(GaoCustomerPackage packageEntity) {
return safeLong(packageEntity.getSaleAmount()) == 0 || 0 < safeLong(packageEntity.getPaidAmount());
}
private void checkPaymentForDelivery(GaoCustomerPackage packageEntity) {
long saleAmount = safeLong(packageEntity.getSaleAmount());
long paidAmount = safeLong(packageEntity.getPaidAmount());
TimiException.requiredTrue(canDeliver(packageEntity), "套餐未有已核销收款,不能发放");
if (0 < paidAmount && paidAmount < saleAmount) {
roleChecker.checkAny(ModuleCode.GAO, GaoRoleCode.STORE_MANAGER.name());
}
}
private boolean sameText(String left, String right) {
return left == null ? right == null : left.equals(right);
}
@@ -407,4 +424,8 @@ public class GaoPackageDeliveryServiceImplement extends AbstractEntityService<Ga
private BigDecimal decimal(BigDecimal value) {
return value == null ? ZERO : value;
}
private long safeLong(Long value) {
return value == null ? 0L : value;
}
}
@@ -6,12 +6,11 @@ import com.imyeyu.api.modules.common.entity.Attachment;
import com.imyeyu.api.modules.common.mapper.ArticleMapper;
import com.imyeyu.api.modules.common.service.ArticleService;
import com.imyeyu.api.modules.common.service.AttachmentService;
import com.imyeyu.api.modules.gao.service.GaoStoreDiaryService;
import com.imyeyu.api.modules.gao.mapper.GaoStoreDiaryMapper;
import com.imyeyu.api.modules.gao.service.GaoStoreDiaryService;
import com.imyeyu.api.modules.gao.vo.GaoStoreDiaryPage;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.spring.bean.Page;
import com.imyeyu.spring.bean.PageResult;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -1,6 +1,54 @@
<?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.imyeyu.api.modules.common.mapper.AttachmentMapper">
<select id="selectImageByBizIdList" resultType="com.imyeyu.api.modules.common.entity.Attachment">
SELECT
`ranked`.`id`,
`ranked`.`biz_type`,
`ranked`.`biz_id`,
`ranked`.`attach_type`,
`ranked`.`mongo_id`,
`ranked`.`title`,
`ranked`.`name`,
`ranked`.`mime_type`,
`ranked`.`metadata`,
`ranked`.`size`,
`ranked`.`md5`,
`ranked`.`uploader_ip`,
`ranked`.`is_destroyed`,
`ranked`.`created_at`,
`ranked`.`updated_at`,
`ranked`.`deleted_at`,
`ranked`.`destroy_at`
FROM (
SELECT
`attachment`.*,
ROW_NUMBER() OVER (
PARTITION BY `attachment`.`biz_id`
ORDER BY `attachment`.`created_at`, `attachment`.`id`
) AS `row_num`
FROM `attachment`
WHERE
`biz_type` = #{bizType}
<if test="bizIdList != null and !bizIdList.isEmpty()">
AND `biz_id` IN
<foreach collection="bizIdList" item="bizId" separator="," open="(" close=")">
#{bizId}
</foreach>
</if>
<if test="bizIdList == null or bizIdList.isEmpty()">
AND FALSE
</if>
AND `mime_type` LIKE "image/%"
AND `deleted_at` IS NULL
AND (`destroy_at` IS NULL OR UNIX_TIMESTAMP() &lt; `destroy_at`)
<if test="attachType != null and !attachType.isEmpty()">
AND `attach_type` = #{attachType}
</if>
) `ranked`
WHERE `ranked`.`row_num` = 1
ORDER BY `ranked`.`created_at`, `ranked`.`id`
</select>
<select id="selectAllByBizIdList" resultType="com.imyeyu.api.modules.common.entity.Attachment">
SELECT
*