功能迭代
This commit is contained in:
1 parent
ed890edb85
commit
d1844ce9a2
80 files changed
+1799
-75
No files matched your search
@@ -13,7 +13,8 @@ public enum BusinessCodePrefixEnum {
|
||||
INQUIRY_SETTING("IST"), INQUIRY_FIELD_VALUE("IFV"), INQUIRY_ATTACHMENT("IAT"),
|
||||
INQUIRY_LOG("ILG"), INQUIRY_RECEIVER("IRC"), MAIL_TASK("MLT"), CUSTOMER("CUS"),
|
||||
CONTACT("CON"), LEAD("LED"), FOLLOW_UP("FLW"), MEDIA("MED"), SEO("SEO"), SEO_HEADING("SEH"),
|
||||
PUBLISH("PUB"), JOB("JOB"), USER("USR"), ROLE("ROL"), FLOW_LOG("FLO"), SOCIAL_CHANNEL("SOC");
|
||||
PUBLISH("PUB"), JOB("JOB"), USER("USR"), USER_SITE("UST"), ROLE("ROL"), FLOW_LOG("FLO"), SOCIAL_CHANNEL("SOC"),
|
||||
CRM_TAG("CTG"), CRM_TAG_RELATION("CTR");
|
||||
|
||||
/** 三位业务前缀。 */
|
||||
private final String prefix;
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.shoplix.modules.account.enums;
|
||||
|
||||
/** 管理员站点关系状态。 */
|
||||
public enum AdminSiteMembershipStatusEnum {
|
||||
/** 启用。 */ ENABLED("ENABLED", "启用"),
|
||||
/** 停用。 */ DISABLED("DISABLED", "停用");
|
||||
|
||||
/** 状态值。 */ private final String value;
|
||||
/** 状态文案。 */ private final String label;
|
||||
|
||||
/** 创建关系状态。 */
|
||||
AdminSiteMembershipStatusEnum(String value, String label) { this.value = value; this.label = label; }
|
||||
|
||||
/** 获取状态值。 */ public String getValue() { return value; }
|
||||
/** 获取状态文案。 */ public String getLabel() { return label; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.shoplix.modules.account.enums;
|
||||
|
||||
/** 管理员在站点中的角色。 */
|
||||
public enum AdminSiteRoleEnum {
|
||||
/** 站点所有者。 */ OWNER("OWNER", "所有者"),
|
||||
/** 站点管理员。 */ ADMIN("ADMIN", "管理员");
|
||||
|
||||
/** 角色值。 */ private final String value;
|
||||
/** 角色文案。 */ private final String label;
|
||||
|
||||
/** 创建站点角色。 */
|
||||
AdminSiteRoleEnum(String value, String label) { this.value = value; this.label = label; }
|
||||
|
||||
/** 获取角色值。 */ public String getValue() { return value; }
|
||||
/** 获取角色文案。 */ public String getLabel() { return label; }
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.shoplix.modules.account.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/** 管理员可访问站点关系持久化实体。 */
|
||||
@Data
|
||||
@TableName("admin_user_site")
|
||||
public class AdminUserSiteEntity {
|
||||
/** 数据库内部主键。 */ @TableId(type = IdType.AUTO) private Long id;
|
||||
/** 用户站点关系业务编号。 */ private String relationCode;
|
||||
/** 管理员业务编号。 */ private String userCode;
|
||||
/** 站点业务编号。 */ private String siteCode;
|
||||
/** 站点角色:OWNER所有者,ADMIN管理员。 */ private String siteRole;
|
||||
/** 关系状态:ENABLED启用,DISABLED停用。 */ private String status;
|
||||
/** 逻辑删除状态:0未删除,1已删除。 */ private Integer deleted;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.shoplix.modules.account.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.shoplix.modules.account.repository.entity.AdminUserSiteEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/** 管理员可访问站点关系 Mapper。 */
|
||||
@Mapper
|
||||
public interface AdminUserSiteMapper extends BaseMapper<AdminUserSiteEntity> {}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.shoplix.modules.account.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.shoplix.modules.account.enums.AdminSiteMembershipStatusEnum;
|
||||
import com.shoplix.modules.account.repository.entity.AdminUserSiteEntity;
|
||||
import com.shoplix.modules.account.repository.mapper.AdminUserSiteMapper;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/** 管理员可访问站点关系单表数据源服务。 */
|
||||
@Service
|
||||
public class AdminUserSiteRepositoryService {
|
||||
/** 用户站点关系 Mapper。 */ private final AdminUserSiteMapper mapper;
|
||||
|
||||
/** 注入用户站点关系 Mapper。 */
|
||||
public AdminUserSiteRepositoryService(AdminUserSiteMapper mapper) { this.mapper = mapper; }
|
||||
|
||||
/** 查询管理员全部启用站点关系。 */
|
||||
public List<AdminUserSiteEntity> listEnabled(String userCode) {
|
||||
return mapper.selectList(Wrappers.<AdminUserSiteEntity>lambdaQuery()
|
||||
.eq(AdminUserSiteEntity::getUserCode, userCode)
|
||||
.eq(AdminUserSiteEntity::getStatus, AdminSiteMembershipStatusEnum.ENABLED.getValue())
|
||||
.eq(AdminUserSiteEntity::getDeleted, 0)
|
||||
.orderByAsc(AdminUserSiteEntity::getId));
|
||||
}
|
||||
|
||||
/** 判断管理员是否可以访问目标站点。 */
|
||||
public boolean canAccess(String userCode, String siteCode) {
|
||||
return mapper.selectCount(Wrappers.<AdminUserSiteEntity>lambdaQuery()
|
||||
.eq(AdminUserSiteEntity::getUserCode, userCode)
|
||||
.eq(AdminUserSiteEntity::getSiteCode, siteCode)
|
||||
.eq(AdminUserSiteEntity::getStatus, AdminSiteMembershipStatusEnum.ENABLED.getValue())
|
||||
.eq(AdminUserSiteEntity::getDeleted, 0)) > 0;
|
||||
}
|
||||
|
||||
/** 新增管理员站点关系。 */
|
||||
public int insert(AdminUserSiteEntity entity) { return mapper.insert(entity); }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.shoplix.modules.crm.enums;
|
||||
|
||||
/** CRM客户来源。 */
|
||||
public enum CrmCustomerSourceEnum {
|
||||
/** 手工新增。 */ MANUAL,
|
||||
/** 批量导入。 */ IMPORT,
|
||||
/** 询盘转化。 */ INQUIRY
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.shoplix.modules.crm.enums;
|
||||
|
||||
/** CRM客户状态。 */
|
||||
public enum CrmCustomerStatusEnum {
|
||||
/** 有效客户。 */ ACTIVE,
|
||||
/** 无效客户。 */ INACTIVE
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.shoplix.modules.crm.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/** CRM客户持久化实体。 */
|
||||
@Data
|
||||
@TableName("crm_customer")
|
||||
public class CrmCustomerEntity {
|
||||
/** 数据库内部主键。 */ @TableId(type = IdType.AUTO) private Long id;
|
||||
/** 客户业务编号。 */ private String customerCode;
|
||||
/** 所属站点业务编号。 */ private String siteCode;
|
||||
/** 公司名称。 */ private String companyName;
|
||||
/** 联系人姓名。 */ private String contactName;
|
||||
/** 公司网站。 */ private String website;
|
||||
/** 联系邮箱。 */ private String email;
|
||||
/** 联系电话。 */ private String phone;
|
||||
/** 国家或地区。 */ private String country;
|
||||
/** Facebook主页。 */ private String facebookUrl;
|
||||
/** Instagram主页。 */ private String instagramUrl;
|
||||
/** LinkedIn主页。 */ private String linkedinUrl;
|
||||
/** WhatsApp账号。 */ private String whatsapp;
|
||||
/** 客户备注。 */ private String remark;
|
||||
/** 客户来源。 */ private String source;
|
||||
/** 客户状态。 */ private String status;
|
||||
/** 逻辑删除状态。 */ private Integer deleted;
|
||||
/** 创建时间。 */ private java.time.LocalDateTime createTime;
|
||||
/** 更新时间。 */ private java.time.LocalDateTime updateTime;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.shoplix.modules.crm.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/** CRM客户标签持久化实体。 */
|
||||
@Data
|
||||
@TableName("crm_customer_tag")
|
||||
public class CrmCustomerTagEntity {
|
||||
/** 数据库内部主键。 */ @TableId(type = IdType.AUTO) private Long id;
|
||||
/** 标签业务编号。 */ private String tagCode;
|
||||
/** 所属站点业务编号。 */ private String siteCode;
|
||||
/** 标签名称。 */ private String tagName;
|
||||
/** 标签颜色。 */ private String color;
|
||||
/** 逻辑删除状态。 */ private Integer deleted;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.shoplix.modules.crm.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/** CRM客户标签关系持久化实体。 */
|
||||
@Data
|
||||
@TableName("crm_customer_tag_relation")
|
||||
public class CrmCustomerTagRelationEntity {
|
||||
/** 数据库内部主键。 */ @TableId(type = IdType.AUTO) private Long id;
|
||||
/** 关系业务编号。 */ private String relationCode;
|
||||
/** 所属站点业务编号。 */ private String siteCode;
|
||||
/** 客户业务编号。 */ private String customerCode;
|
||||
/** 标签业务编号。 */ private String tagCode;
|
||||
/** 逻辑删除状态。 */ private Integer deleted;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.shoplix.modules.crm.repository.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.shoplix.modules.crm.repository.entity.CrmCustomerEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
/** CRM客户 Mapper。 */ @Mapper public interface CrmCustomerMapper extends BaseMapper<CrmCustomerEntity> { }
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.shoplix.modules.crm.repository.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.shoplix.modules.crm.repository.entity.CrmCustomerTagEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
/** CRM客户标签 Mapper。 */ @Mapper public interface CrmCustomerTagMapper extends BaseMapper<CrmCustomerTagEntity> { }
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.shoplix.modules.crm.repository.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.shoplix.modules.crm.repository.entity.CrmCustomerTagRelationEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
/** CRM客户标签关系 Mapper。 */ @Mapper public interface CrmCustomerTagRelationMapper extends BaseMapper<CrmCustomerTagRelationEntity> { }
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.shoplix.modules.crm.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.shoplix.modules.crm.repository.entity.CrmCustomerEntity;
|
||||
import com.shoplix.modules.crm.repository.mapper.CrmCustomerMapper;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/** CRM客户单表数据源服务。 */
|
||||
@Service
|
||||
public class CrmCustomerRepositoryService {
|
||||
/** CRM客户 Mapper。 */ private final CrmCustomerMapper mapper;
|
||||
/** 注入 CRM 客户 Mapper。 */ public CrmCustomerRepositoryService(CrmCustomerMapper mapper) { this.mapper = mapper; }
|
||||
/** 分页查询当前站点客户。 */
|
||||
public List<CrmCustomerEntity> page(String siteCode, String keyword, int pageNo, int pageSize) {
|
||||
var query = query(siteCode, keyword);
|
||||
return mapper.selectList(query.orderByDesc(CrmCustomerEntity::getId)
|
||||
.last("LIMIT " + pageSize + " OFFSET " + (long) (pageNo - 1) * pageSize));
|
||||
}
|
||||
/** 统计当前站点客户。 */ public long count(String siteCode, String keyword) { return mapper.selectCount(query(siteCode, keyword)); }
|
||||
/** 按业务编号查询当前站点客户。 */
|
||||
public Optional<CrmCustomerEntity> find(String siteCode, String customerCode) {
|
||||
return Optional.ofNullable(mapper.selectOne(Wrappers.<CrmCustomerEntity>lambdaQuery()
|
||||
.eq(CrmCustomerEntity::getSiteCode, siteCode).eq(CrmCustomerEntity::getCustomerCode, customerCode)
|
||||
.eq(CrmCustomerEntity::getDeleted, 0)));
|
||||
}
|
||||
/** 新增客户。 */ public int insert(CrmCustomerEntity entity) { return mapper.insert(entity); }
|
||||
/** 更新当前站点客户。 */
|
||||
public int update(CrmCustomerEntity entity) { return mapper.update(entity, Wrappers.<CrmCustomerEntity>lambdaUpdate()
|
||||
.eq(CrmCustomerEntity::getSiteCode, entity.getSiteCode()).eq(CrmCustomerEntity::getCustomerCode, entity.getCustomerCode())
|
||||
.eq(CrmCustomerEntity::getDeleted, 0)); }
|
||||
/** 构造客户搜索条件。 */
|
||||
private com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<CrmCustomerEntity> query(String siteCode, String keyword) {
|
||||
var query = Wrappers.<CrmCustomerEntity>lambdaQuery().eq(CrmCustomerEntity::getSiteCode, siteCode).eq(CrmCustomerEntity::getDeleted, 0);
|
||||
if (keyword != null && !keyword.isBlank()) query.and(item -> item.like(CrmCustomerEntity::getCompanyName, keyword.trim())
|
||||
.or().like(CrmCustomerEntity::getContactName, keyword.trim()).or().like(CrmCustomerEntity::getEmail, keyword.trim()));
|
||||
return query;
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.shoplix.modules.crm.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.shoplix.modules.crm.repository.entity.CrmCustomerTagEntity;
|
||||
import com.shoplix.modules.crm.repository.entity.CrmCustomerTagRelationEntity;
|
||||
import com.shoplix.modules.crm.repository.mapper.CrmCustomerTagMapper;
|
||||
import com.shoplix.modules.crm.repository.mapper.CrmCustomerTagRelationMapper;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/** CRM客户标签单表数据源服务。 */
|
||||
@Service
|
||||
public class CrmCustomerTagRepositoryService {
|
||||
/** 标签 Mapper。 */ private final CrmCustomerTagMapper tagMapper;
|
||||
/** 标签关系 Mapper。 */ private final CrmCustomerTagRelationMapper relationMapper;
|
||||
/** 注入 CRM 客户标签 Mapper。 */
|
||||
public CrmCustomerTagRepositoryService(CrmCustomerTagMapper tagMapper, CrmCustomerTagRelationMapper relationMapper) { this.tagMapper = tagMapper; this.relationMapper = relationMapper; }
|
||||
/** 查询站点全部标签。 */ public List<CrmCustomerTagEntity> listTags(String siteCode) { return tagMapper.selectList(Wrappers.<CrmCustomerTagEntity>lambdaQuery().eq(CrmCustomerTagEntity::getSiteCode, siteCode).eq(CrmCustomerTagEntity::getDeleted, 0).orderByAsc(CrmCustomerTagEntity::getId)); }
|
||||
/** 查询客户标签关系。 */ public List<CrmCustomerTagRelationEntity> listRelations(String siteCode, List<String> customerCodes) { if (customerCodes.isEmpty()) return List.of(); return relationMapper.selectList(Wrappers.<CrmCustomerTagRelationEntity>lambdaQuery().eq(CrmCustomerTagRelationEntity::getSiteCode, siteCode).in(CrmCustomerTagRelationEntity::getCustomerCode, customerCodes).eq(CrmCustomerTagRelationEntity::getDeleted, 0)); }
|
||||
/** 新增标签。 */ public int insertTag(CrmCustomerTagEntity entity) { return tagMapper.insert(entity); }
|
||||
/** 新增客户标签关系。 */ public int insertRelation(CrmCustomerTagRelationEntity entity) { return relationMapper.insert(entity); }
|
||||
/** 清除客户全部标签关系。 */ public void deleteRelations(String siteCode, String customerCode) { relationMapper.delete(Wrappers.<CrmCustomerTagRelationEntity>lambdaQuery().eq(CrmCustomerTagRelationEntity::getSiteCode, siteCode).eq(CrmCustomerTagRelationEntity::getCustomerCode, customerCode)); }
|
||||
}
|
||||
+9
@@ -84,6 +84,15 @@ public class MediaAssetRepositoryService {
|
||||
.eq(MediaAssetEntity::getDeleted, 0));
|
||||
}
|
||||
|
||||
/** 按业务编号批量逻辑删除素材。 */
|
||||
public int deleteBatch(String siteCode, List<String> mediaCodes) {
|
||||
return mapper.update(null, Wrappers.<MediaAssetEntity>lambdaUpdate()
|
||||
.set(MediaAssetEntity::getDeleted, 1)
|
||||
.eq(MediaAssetEntity::getSiteCode, siteCode)
|
||||
.in(MediaAssetEntity::getMediaCode, mediaCodes)
|
||||
.eq(MediaAssetEntity::getDeleted, 0));
|
||||
}
|
||||
|
||||
/** 构造素材中心公共筛选条件。 */
|
||||
private LambdaQueryWrapper<MediaAssetEntity> buildQuery(String siteCode, String mediaType,
|
||||
String keyword, String tagName) {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.shoplix.modules.site.enums;
|
||||
|
||||
/** 站点启停状态。 */
|
||||
public enum SiteStatusEnum {
|
||||
/** 启用。 */ ENABLED("ENABLED", "启用"),
|
||||
/** 停用。 */ DISABLED("DISABLED", "停用");
|
||||
|
||||
/** 状态值。 */ private final String value;
|
||||
/** 状态文案。 */ private final String label;
|
||||
|
||||
/** 创建站点状态。 */
|
||||
SiteStatusEnum(String value, String label) { this.value = value; this.label = label; }
|
||||
|
||||
/** 获取状态值。 */ public String getValue() { return value; }
|
||||
/** 获取状态文案。 */ public String getLabel() { return label; }
|
||||
}
|
||||
+13
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.shoplix.modules.site.repository.entity.SiteEntity;
|
||||
import com.shoplix.modules.site.repository.mapper.SiteMapper;
|
||||
import java.util.Optional;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/** 站点基本信息单表数据源服务。 */
|
||||
@@ -20,6 +21,18 @@ public class SiteRepositoryService {
|
||||
.eq(SiteEntity::getSiteCode, siteCode)));
|
||||
}
|
||||
|
||||
/** 按业务编号批量查询站点。 */
|
||||
public List<SiteEntity> listByCodes(List<String> siteCodes) {
|
||||
if (siteCodes.isEmpty()) return List.of();
|
||||
return mapper.selectList(Wrappers.<SiteEntity>lambdaQuery()
|
||||
.in(SiteEntity::getSiteCode, siteCodes)
|
||||
.eq(SiteEntity::getDeleted, 0)
|
||||
.orderByAsc(SiteEntity::getId));
|
||||
}
|
||||
|
||||
/** 新增站点。 */
|
||||
public int insert(SiteEntity entity) { return mapper.insert(entity); }
|
||||
|
||||
/** 更新店铺基本信息。 */
|
||||
public int updateProfile(SiteEntity entity) {
|
||||
return mapper.update(null, Wrappers.<SiteEntity>lambdaUpdate()
|
||||
|
||||
Reference in new issue
Block a user