feat(crm): 优化礼品申请和礼品信息功能

- 修改礼品申请编号校验规则,新增时由后端自动生成编号
- 更新礼品申请编码规则从1019到1020
- 添加申请部门名称自动补齐逻辑,避免前端未传值问题
- 实现发放部门名称获取失败时使用部门ID兜底机制
- 新增礼品信息单价范围查询功能(最低单价和最高单价)
- 添加礼品信息仅显示有库存筛选条件
- 移除礼品信息VO中的多余空行以优化代码结构
dev
zangch@mesnac.com 4 days ago
parent 82f03fa273
commit c37ad18da7

@ -36,7 +36,8 @@ public class CrmGiftApplyBo extends BaseEntity {
/**
*
*/
@NotBlank(message = "礼品申请编号不能为空", groups = { AddGroup.class, EditGroup.class })
// 新增时由后端自动生成编号,仅编辑场景校验非空
@NotBlank(message = "礼品申请编号不能为空", groups = { EditGroup.class })
private String applicationCode;
/**

@ -50,6 +50,16 @@ public class CrmGiftInfoBo extends BaseEntity {
*/
private BigDecimal unitPrice;
/**
*
*/
private BigDecimal unitPriceMin;
/**
*
*/
private BigDecimal unitPriceMax;
/**
* ID
*/
@ -60,6 +70,11 @@ public class CrmGiftInfoBo extends BaseEntity {
*/
private Integer inventoryQuantity;
/**
*
*/
private Boolean hasStock;
/**
*
*/

@ -11,7 +11,6 @@ import java.io.Serializable;
import java.math.BigDecimal;
/**
* crm_gift_info
*

@ -59,7 +59,7 @@ public class CrmGiftApplyServiceImpl implements ICrmGiftApplyService {
private final CrmGiftInfoMapper giftInfoMapper;
/** 礼品申请编码规则 */
private static final String GIFT_APPLY_CODE_RULE = "1019";
private static final String GIFT_APPLY_CODE_RULE = "1020";
@DubboReference(timeout = 30000)
private RemoteWorkflowService remoteWorkflowService;
@ -154,6 +154,14 @@ public class CrmGiftApplyServiceImpl implements ICrmGiftApplyService {
if (StringUtils.isBlank(add.getApplicationCode())) {
add.setApplicationCode(remoteCodeRuleService.selectCodeRuleCode(GIFT_APPLY_CODE_RULE));
}
// 补齐申请部门名称(有些前端浏览器可能未带出)
if (StringUtils.isBlank(add.getApplicantDeptName())) {
try {
add.setApplicantDeptName(LoginHelper.getLoginUser().getDeptName());
} catch (Exception ignored) {
// 保底:前端未传且无法获取则保持空,避免提交失败
}
}
// 新增时设置默认状态为草稿
if (StringUtils.isBlank(add.getApplicationStatus())) {
add.setApplicationStatus(OAStatusEnum.DRAFT.getStatus());
@ -620,7 +628,8 @@ public class CrmGiftApplyServiceImpl implements ICrmGiftApplyService {
try {
record.setIssueDeptName(LoginHelper.getLoginUser().getDeptName());
} catch (Exception e) {
// 获取失败时忽略
// 获取失败时使用部门ID字符串兜底
record.setIssueDeptName(Convert.toStr(LoginHelper.getDeptId()));
}
record.setBeforeInventory(currentInventory);
record.setAfterInventory(currentInventory - detail.getApplicationQuantity());

@ -85,8 +85,11 @@ public class CrmGiftInfoServiceImpl implements ICrmGiftInfoService {
.like(StringUtils.isNotBlank(bo.getGiftName()), CrmGiftInfo::getGiftName, bo.getGiftName())
.eq(StringUtils.isNotBlank(bo.getSpecification()), CrmGiftInfo::getSpecification, bo.getSpecification())
.eq(bo.getUnitPrice() != null, CrmGiftInfo::getUnitPrice, bo.getUnitPrice())
.ge(bo.getUnitPriceMin() != null, CrmGiftInfo::getUnitPrice, bo.getUnitPriceMin())
.le(bo.getUnitPriceMax() != null, CrmGiftInfo::getUnitPrice, bo.getUnitPriceMax())
.eq(bo.getUnitId() != null, CrmGiftInfo::getUnitId, bo.getUnitId())
.eq(bo.getInventoryQuantity() != null, CrmGiftInfo::getInventoryQuantity, bo.getInventoryQuantity())
.gt(Boolean.TRUE.equals(bo.getHasStock()), CrmGiftInfo::getInventoryQuantity, 0)
.orderByDesc(CrmGiftInfo::getCreateTime);
return lqw;
}

Loading…
Cancel
Save