Initial commit

This commit is contained in:
南宁网宿科技
2023-06-03 23:56:49 +08:00
commit 912944faea
821 changed files with 74279 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.AccessKey;
import com.gxwebsoft.common.system.param.AccessKeyParam;
import java.util.List;
/**
* 访问凭证管理Service
*
* @author 科技小王子
* @since 2023-05-16 19:19:55
*/
public interface AccessKeyService extends IService<AccessKey> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<AccessKey>
*/
PageResult<AccessKey> pageRel(AccessKeyParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<AccessKey>
*/
List<AccessKey> listRel(AccessKeyParam param);
/**
* 根据id查询
*
* @param id 字典项id
* @return AccessKey
*/
AccessKey getByIdRel(Integer id);
}

View File

@@ -0,0 +1,21 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.LoginRecord;
import com.gxwebsoft.common.system.param.LoginRecordParam;
import com.gxwebsoft.shop.entity.Payment;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 支付宝服务层
*
* @author WebSoft
* @since 2018-12-24 16:10:41
*/
public interface AlipayService extends IService<Payment> {
}

View File

@@ -0,0 +1,44 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Company;
import com.gxwebsoft.common.system.param.CompanyParam;
import java.util.List;
/**
* 企业信息Service
*
* @author 科技小王子
* @since 2023-05-27 14:57:34
*/
public interface CompanyService extends IService<Company> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Company>
*/
PageResult<Company> pageRel(CompanyParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Company>
*/
List<Company> listRel(CompanyParam param);
/**
* 根据id查询
*
* @param companyId 企业id
* @return Company
*/
Company getByIdRel(Integer companyId);
Company getByTenantIdRel(Integer tenantId);
}

View File

@@ -0,0 +1,52 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.*;
import com.gxwebsoft.common.system.entity.DictData;
import com.gxwebsoft.common.system.param.DictDataParam;
import java.util.List;
/**
* 字典数据Service
*
* @author WebSoft
* @since 2020-03-14 11:29:04
*/
public interface DictDataService extends IService<DictData> {
/**
* 关联分页查询
*
* @param param 查询参数
* @return PageResult<DictData>
*/
PageResult<DictData> pageRel(DictDataParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<DictData>
*/
List<DictData> listRel(DictDataParam param);
/**
* 根据id查询
*
* @param dictDataId 字典数据id
* @return DictData
*/
DictData getByIdRel(Integer dictDataId);
/**
* 根据dictCode和dictDataName查询
*
* @param dictCode 字典标识
* @param dictDataName 字典项名称
* @return DictData
*/
DictData getByDictCodeAndName(String dictCode, String dictDataName);
}

View File

@@ -0,0 +1,14 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.system.entity.Dict;
/**
* 字典Service
*
* @author WebSoft
* @since 2020-03-14 11:29:03
*/
public interface DictService extends IService<Dict> {
}

View File

@@ -0,0 +1,51 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.DictionaryData;
import com.gxwebsoft.common.system.param.DictionaryDataParam;
import java.util.List;
/**
* 字典数据Service
*
* @author WebSoft
* @since 2020-03-14 11:29:04
*/
public interface DictionaryDataService extends IService<DictionaryData> {
/**
* 关联分页查询
*
* @param param 查询参数
* @return PageResult<DictionaryData>
*/
PageResult<DictionaryData> pageRel(DictionaryDataParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<DictionaryData>
*/
List<DictionaryData> listRel(DictionaryDataParam param);
/**
* 根据id查询
*
* @param dictDataId 字典数据id
* @return DictionaryData
*/
DictionaryData getByIdRel(Integer dictDataId);
/**
* 根据dictCode和dictDataName查询
*
* @param dictCode 字典标识
* @param dictDataName 字典项名称
* @return DictionaryData
*/
DictionaryData getByDictCodeAndName(String dictCode, String dictDataName);
}

View File

@@ -0,0 +1,14 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.system.entity.Dictionary;
/**
* 字典Service
*
* @author WebSoft
* @since 2020-03-14 11:29:03
*/
public interface DictionaryService extends IService<Dictionary> {
}

View File

@@ -0,0 +1,50 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.system.entity.EmailRecord;
import javax.mail.MessagingException;
import java.io.IOException;
import java.util.Map;
/**
* 邮件发送记录Service
*
* @author WebSoft
* @since 2019-06-19 04:07:02
*/
public interface EmailRecordService extends IService<EmailRecord> {
/**
* 发送普通邮件
*
* @param title 标题
* @param content 内容
* @param toEmails 收件人
*/
void sendTextEmail(String title, String content, String[] toEmails);
/**
* 发送富文本邮件
*
* @param title 标题
* @param html 富文本
* @param toEmails 收件人
* @throws MessagingException MessagingException
*/
void sendFullTextEmail(String title, String html, String[] toEmails) throws MessagingException;
/**
* 发送模板邮件
*
* @param title 标题
* @param path 模板路径
* @param map 填充数据
* @param toEmails 收件人
* @throws MessagingException MessagingException
* @throws IOException IOException
*/
void sendHtmlEmail(String title, String path, Map<String, Object> map, String[] toEmails)
throws MessagingException, IOException;
}

View File

@@ -0,0 +1,58 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.FileRecord;
import com.gxwebsoft.common.system.param.FileRecordParam;
import java.io.File;
import java.util.List;
/**
* 文件上传记录Service
*
* @author WebSoft
* @since 2021-08-30 11:20:15
*/
public interface FileRecordService extends IService<FileRecord> {
/**
* 关联分页查询
*
* @param param 查询参数
* @return PageResult<FileRecord>
*/
PageResult<FileRecord> pageRel(FileRecordParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<FileRecord>
*/
List<FileRecord> listRel(FileRecordParam param);
/**
* 根据id查询
*
* @param id id
* @return FileRecord
*/
FileRecord getByIdRel(Integer id);
/**
* 根据path查询
*
* @param path 文件路径
* @return FileRecord
*/
FileRecord getByIdPath(String path);
/**
* 异步删除文件
*
* @param files 文件数组
*/
void deleteFileAsync(List<File> files);
}

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Industry;
import com.gxwebsoft.common.system.param.IndustryParam;
import java.util.List;
/**
* 企业行业记录表Service
*
* @author 科技小王子
* @since 2023-05-17 11:26:43
*/
public interface IndustryService extends IService<Industry> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Industry>
*/
PageResult<Industry> pageRel(IndustryParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Industry>
*/
List<Industry> listRel(IndustryParam param);
/**
* 根据id查询
*
* @param industryId 行业id
* @return Industry
*/
Industry getByIdRel(Integer industryId);
}

View File

@@ -0,0 +1,54 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.LoginRecord;
import com.gxwebsoft.common.system.param.LoginRecordParam;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 登录日志Service
*
* @author WebSoft
* @since 2018-12-24 16:10:41
*/
public interface LoginRecordService extends IService<LoginRecord> {
/**
* 关联分页查询
*
* @param param 查询参数
* @return PageResult<LoginRecord>
*/
PageResult<LoginRecord> pageRel(LoginRecordParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<LoginRecord>
*/
List<LoginRecord> listRel(LoginRecordParam param);
/**
* 根据id查询
*
* @param id id
* @return LoginRecord
*/
LoginRecord getByIdRel(Integer id);
/**
* 异步添加
*
* @param username 用户账号
* @param type 操作类型
* @param comments 备注
* @param tenantId 租户id
* @param request HttpServletRequest
*/
void saveAsync(String username, Integer type, String comments, Integer tenantId, HttpServletRequest request);
}

View File

@@ -0,0 +1,18 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.system.entity.Menu;
import com.gxwebsoft.common.system.param.MenuParam;
/**
* 菜单Service
*
* @author WebSoft
* @since 2018-12-24 16:10:31
*/
public interface MenuService extends IService<Menu> {
Boolean cloneMenu(MenuParam param);
Boolean install(Integer id);
}

View File

@@ -0,0 +1,49 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.OperationRecord;
import com.gxwebsoft.common.system.param.OperationRecordParam;
import java.util.List;
/**
* 操作日志Service
*
* @author WebSoft
* @since 2018-12-24 16:10:01
*/
public interface OperationRecordService extends IService<OperationRecord> {
/**
* 关联分页查询
*
* @param param 查询参数
* @return PageResult<OperationRecord>
*/
PageResult<OperationRecord> pageRel(OperationRecordParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<OperationRecord>
*/
List<OperationRecord> listRel(OperationRecordParam param);
/**
* 根据id查询
*
* @param id id
* @return OperationRecord
*/
OperationRecord getByIdRel(Integer id);
/**
* 异步添加
*
* @param operationRecord OperationRecord
*/
void saveAsync(OperationRecord operationRecord);
}

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Organization;
import com.gxwebsoft.common.system.param.OrganizationParam;
import java.util.List;
/**
* 组织机构Service
*
* @author WebSoft
* @since 2020-03-14 11:29:04
*/
public interface OrganizationService extends IService<Organization> {
/**
* 关联分页查询
*
* @param param 查询参数
* @return PageResult<Organization>
*/
PageResult<Organization> pageRel(OrganizationParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Organization>
*/
List<Organization> listRel(OrganizationParam param);
/**
* 根据id查询
*
* @param organizationId 机构id
* @return Organization
*/
Organization getByIdRel(Integer organizationId);
}

View File

@@ -0,0 +1,44 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Plug;
import com.gxwebsoft.common.system.param.PlugParam;
import java.util.List;
/**
* 插件扩展Service
*
* @author 科技小王子
* @since 2023-05-18 11:57:37
*/
public interface PlugService extends IService<Plug> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Plug>
*/
PageResult<Plug> pageRel(PlugParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Plug>
*/
List<Plug> listRel(PlugParam param);
/**
* 根据id查询
*
* @param menuId 菜单id
* @return Plug
*/
Plug getByIdRel(Integer menuId);
Boolean cloneMenu(PlugParam param);
}

View File

@@ -0,0 +1,35 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.system.entity.Menu;
import com.gxwebsoft.common.system.entity.RoleMenu;
import java.util.List;
/**
* 角色菜单Service
*
* @author WebSoft
* @since 2018-12-24 16:10:44
*/
public interface RoleMenuService extends IService<RoleMenu> {
/**
* 查询用户对应的菜单
*
* @param userId 用户id
* @param menuType 菜单类型
* @return List<Menu>
*/
List<Menu> listMenuByUserId(Integer userId, Integer menuType);
/**
* 查询用户对应的菜单
*
* @param roleIds 角色id
* @param menuType 菜单类型
* @return List<Menu>
*/
List<Menu> listMenuByRoleIds(List<Integer> roleIds, Integer menuType);
}

View File

@@ -0,0 +1,14 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.system.entity.Role;
/**
* 角色Service
*
* @author WebSoft
* @since 2018-12-24 16:10:32
*/
public interface RoleService extends IService<Role> {
}

View File

@@ -0,0 +1,53 @@
package com.gxwebsoft.common.system.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Setting;
import com.gxwebsoft.common.system.param.SettingParam;
import java.util.List;
/**
* 系统设置Service
*
* @author WebSoft
* @since 2022-11-19 13:54:27
*/
public interface SettingService extends IService<Setting> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Setting>
*/
PageResult<Setting> pageRel(SettingParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Setting>
*/
List<Setting> listRel(SettingParam param);
/**
* 根据id查询
*
* @param settingId id
* @return Setting
*/
Setting getByIdRel(Integer settingId);
/**
* 通过key获取设置内容
* @param key key
* @return Setting
*/
JSONObject getBySettingKey(String key);
Setting getData(String settingKey);
JSONObject getCache(String key);
}

View File

@@ -0,0 +1,14 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.system.entity.UserFile;
/**
* 用户文件Service
*
* @author WebSoft
* @since 2022-07-21 14:34:40
*/
public interface UserFileService extends IService<UserFile> {
}

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.system.entity.Role;
import com.gxwebsoft.common.system.entity.UserRole;
import java.util.List;
/**
* 用户角色Service
*
* @author WebSoft
* @since 2018-12-24 16:10:35
*/
public interface UserRoleService extends IService<UserRole> {
/**
* 批量添加用户角色
*
* @param userId 用户id
* @param roleIds 角色id集合
* @return int
*/
int saveBatch(Integer userId, List<Integer> roleIds);
/**
* 根据用户id查询角色
*
* @param userId 用户id
* @return List<Role>
*/
List<Role> listByUserId(Integer userId);
/**
* 批量根据用户id查询角色
*
* @param userIds 用户id集合
* @return List<RoleResult>
*/
List<Role> listByUserIds(List<Integer> userIds);
}

View File

@@ -0,0 +1,107 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.param.UserParam;
import org.springframework.security.core.userdetails.UserDetailsService;
import java.util.List;
/**
* 用户Service
*
* @author WebSoft
* @since 2018-12-24 16:10:52
*/
public interface UserService extends IService<User>, UserDetailsService {
/**
* 关联分页查询用户
*
* @param param 查询参数
* @return PageResult<User>
*/
PageResult<User> pageRel(UserParam param);
/**
* 关联查询全部用户
*
* @param param 查询参数
* @return List<User>
*/
List<User> listRel(UserParam param);
void listRanking(UserParam param);
/**
* 根据id查询用户
*
* @param userId 用户id
* @return User
*/
User getByIdRel(Integer userId);
/**
* 根据账号查询用户
*
* @param username 账号
* @return User
*/
User getByUsername(String username);
/**
* 根据账号查询用户
*
* @param username 账号
* @param tenantId 租户id
* @return User
*/
User getByUsername(String username, Integer tenantId);
/**
* 添加用户
*
* @param user 用户信息
* @return boolean
*/
boolean saveUser(User user);
/**
* 修改用户
*
* @param user 用户信息
* @return boolean
*/
boolean updateUser(User user);
/**
* 比较用户密码
*
* @param dbPassword 数据库存储的密码
* @param inputPassword 用户输入的密码
* @return boolean
*/
boolean comparePassword(String dbPassword, String inputPassword);
/**
* md5加密用户密码
*
* @param password 密码明文
* @return 密文
*/
String encodePassword(String password);
/**
* 跟进手机号码查询用户
* @param phone 手机号码
* @return 用户信息
*/
User getByPhone(String phone);
User getByUnionId(UserParam userParam);
User getByOauthId(UserParam userParam);
List<User> listStatisticsRel(UserParam param);
}

View File

@@ -0,0 +1,47 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.mapper.AccessKeyMapper;
import com.gxwebsoft.common.system.service.AccessKeyService;
import com.gxwebsoft.common.system.entity.AccessKey;
import com.gxwebsoft.common.system.param.AccessKeyParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 访问凭证管理Service实现
*
* @author 科技小王子
* @since 2023-05-16 19:19:55
*/
@Service
public class AccessKeyServiceImpl extends ServiceImpl<AccessKeyMapper, AccessKey> implements AccessKeyService {
@Override
public PageResult<AccessKey> pageRel(AccessKeyParam param) {
PageParam<AccessKey, AccessKeyParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<AccessKey> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<AccessKey> listRel(AccessKeyParam param) {
List<AccessKey> list = baseMapper.selectListRel(param);
// 排序
PageParam<AccessKey, AccessKeyParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public AccessKey getByIdRel(Integer id) {
AccessKeyParam param = new AccessKeyParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -0,0 +1,55 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Company;
import com.gxwebsoft.common.system.mapper.CompanyMapper;
import com.gxwebsoft.common.system.param.CompanyParam;
import com.gxwebsoft.common.system.service.CompanyService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 企业信息Service实现
*
* @author 科技小王子
* @since 2023-05-27 14:57:34
*/
@Service
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
@Override
public PageResult<Company> pageRel(CompanyParam param) {
PageParam<Company, CompanyParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<Company> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Company> listRel(CompanyParam param) {
List<Company> list = baseMapper.selectListRel(param);
// 排序
PageParam<Company, CompanyParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public Company getByIdRel(Integer companyId) {
CompanyParam param = new CompanyParam();
param.setCompanyId(companyId);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public Company getByTenantIdRel(Integer tenantId) {
CompanyParam param = new CompanyParam();
// final Company one = param.getOne(baseMapper.selectListRel(param));
param.setAuthoritative(true);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -0,0 +1,52 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.utils.CommonUtil;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.DictData;
import com.gxwebsoft.common.system.mapper.DictDataMapper;
import com.gxwebsoft.common.system.param.DictDataParam;
import com.gxwebsoft.common.system.service.DictDataService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 字典数据Service实现
*
* @author WebSoft
* @since 2020-03-14 11:29:04
*/
@Service
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData>
implements DictDataService {
@Override
public PageResult<DictData> pageRel(DictDataParam param) {
PageParam<DictData, DictDataParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number");
return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal());
}
@Override
public List<DictData> listRel(DictDataParam param) {
PageParam<DictData, DictDataParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number");
return page.sortRecords(baseMapper.selectListRel(param));
}
@Override
public DictData getByIdRel(Integer dictDataId) {
DictDataParam param = new DictDataParam();
param.setDictDataId(dictDataId);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public DictData getByDictCodeAndName(String dictCode, String dictDataName) {
List<DictData> list = baseMapper.getByDictCodeAndName(dictCode, dictDataName);
return CommonUtil.listGetOne(list);
}
}

View File

@@ -0,0 +1,18 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.entity.Dict;
import com.gxwebsoft.common.system.mapper.DictMapper;
import com.gxwebsoft.common.system.service.DictService;
import org.springframework.stereotype.Service;
/**
* 字典Service实现
*
* @author WebSoft
* @since 2020-03-14 11:29:03
*/
@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements DictService {
}

View File

@@ -0,0 +1,52 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.utils.CommonUtil;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.DictionaryData;
import com.gxwebsoft.common.system.mapper.DictionaryDataMapper;
import com.gxwebsoft.common.system.param.DictionaryDataParam;
import com.gxwebsoft.common.system.service.DictionaryDataService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 字典数据Service实现
*
* @author WebSoft
* @since 2020-03-14 11:29:04
*/
@Service
public class DictionaryDataServiceImpl extends ServiceImpl<DictionaryDataMapper, DictionaryData>
implements DictionaryDataService {
@Override
public PageResult<DictionaryData> pageRel(DictionaryDataParam param) {
PageParam<DictionaryData, DictionaryDataParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number");
return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal());
}
@Override
public List<DictionaryData> listRel(DictionaryDataParam param) {
PageParam<DictionaryData, DictionaryDataParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number");
return page.sortRecords(baseMapper.selectListRel(param));
}
@Override
public DictionaryData getByIdRel(Integer dictDataId) {
DictionaryDataParam param = new DictionaryDataParam();
param.setDictDataId(dictDataId);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public DictionaryData getByDictCodeAndName(String dictCode, String dictDataName) {
List<DictionaryData> list = baseMapper.getByDictCodeAndName(dictCode, dictDataName);
return CommonUtil.listGetOne(list);
}
}

View File

@@ -0,0 +1,18 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.entity.Dictionary;
import com.gxwebsoft.common.system.mapper.DictionaryMapper;
import com.gxwebsoft.common.system.service.DictionaryService;
import org.springframework.stereotype.Service;
/**
* 字典Service实现
*
* @author WebSoft
* @since 2020-03-14 11:29:03
*/
@Service
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements DictionaryService {
}

View File

@@ -0,0 +1,72 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.entity.EmailRecord;
import com.gxwebsoft.common.system.mapper.EmailRecordMapper;
import com.gxwebsoft.common.system.service.EmailRecordService;
import org.beetl.core.Configuration;
import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import org.beetl.core.resource.ClasspathResourceLoader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.IOException;
import java.util.Map;
/**
* 邮件发送记录Service实现
*
* @author WebSoft
* @since 2019-06-19 04:07:54
*/
@Service
public class EmailRecordServiceImpl extends ServiceImpl<EmailRecordMapper, EmailRecord>
implements EmailRecordService {
// 发件邮箱
@Value("${spring.mail.username}")
private String formEmail;
@Resource
private JavaMailSender mailSender;
@Override
public void sendTextEmail(String title, String content, String[] toEmails) {
SimpleMailMessage message = new SimpleMailMessage();
message.setFrom(formEmail);
message.setTo(toEmails);
message.setSubject(title);
message.setText(content);
mailSender.send(message);
}
@Override
public void sendFullTextEmail(String title, String html, String[] toEmails) throws MessagingException {
MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
helper.setFrom(formEmail);
helper.setTo(toEmails);
helper.setSubject(title);
// 发送邮件
helper.setText(html, true);
mailSender.send(mimeMessage);
}
@Override
public void sendHtmlEmail(String title, String path, Map<String, Object> map, String[] toEmails)
throws MessagingException, IOException {
ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader("templates/");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Template t = gt.getTemplate(path); // 加载html模板
t.binding(map); // 填充数据
String html = t.render(); // 获得渲染后的html
sendFullTextEmail(title, html, toEmails); // 发送邮件
}
}

View File

@@ -0,0 +1,63 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.utils.CommonUtil;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.FileRecord;
import com.gxwebsoft.common.system.mapper.FileRecordMapper;
import com.gxwebsoft.common.system.param.FileRecordParam;
import com.gxwebsoft.common.system.service.FileRecordService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.io.File;
import java.util.List;
/**
* 文件上传记录Service实现
*
* @author WebSoft
* @since 2021-08-30 11:21:01
*/
@Service
public class FileRecordServiceImpl extends ServiceImpl<FileRecordMapper, FileRecord> implements FileRecordService {
@Override
public PageResult<FileRecord> pageRel(FileRecordParam param) {
PageParam<FileRecord, FileRecordParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal());
}
@Override
public List<FileRecord> listRel(FileRecordParam param) {
PageParam<FileRecord, FileRecordParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return page.sortRecords(baseMapper.selectListRel(param));
}
@Override
public FileRecord getByIdRel(Integer id) {
FileRecordParam param = new FileRecordParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public FileRecord getByIdPath(String path) {
return CommonUtil.listGetOne(baseMapper.getByIdPath(path));
}
@Async
@Override
public void deleteFileAsync(List<File> files) {
for (File file : files) {
try {
file.delete();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,47 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.mapper.IndustryMapper;
import com.gxwebsoft.common.system.service.IndustryService;
import com.gxwebsoft.common.system.entity.Industry;
import com.gxwebsoft.common.system.param.IndustryParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 企业行业记录表Service实现
*
* @author 科技小王子
* @since 2023-05-17 11:26:43
*/
@Service
public class IndustryServiceImpl extends ServiceImpl<IndustryMapper, Industry> implements IndustryService {
@Override
public PageResult<Industry> pageRel(IndustryParam param) {
PageParam<Industry, IndustryParam> page = new PageParam<>(param);
//page.setDefaultOrder("create_time desc");
List<Industry> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Industry> listRel(IndustryParam param) {
List<Industry> list = baseMapper.selectListRel(param);
// 排序
PageParam<Industry, IndustryParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public Industry getByIdRel(Integer industryId) {
IndustryParam param = new IndustryParam();
param.setIndustryId(industryId);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -0,0 +1,78 @@
package com.gxwebsoft.common.system.service.impl;
import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.http.useragent.UserAgent;
import cn.hutool.http.useragent.UserAgentUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.LoginRecord;
import com.gxwebsoft.common.system.mapper.LoginRecordMapper;
import com.gxwebsoft.common.system.param.LoginRecordParam;
import com.gxwebsoft.common.system.service.LoginRecordService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 登录日志Service实现
*
* @author WebSoft
* @since 2018-12-24 16:10:14
*/
@Service
public class LoginRecordServiceImpl extends ServiceImpl<LoginRecordMapper, LoginRecord>
implements LoginRecordService {
@Override
public PageResult<LoginRecord> pageRel(LoginRecordParam param) {
PageParam<LoginRecord, LoginRecordParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal());
}
@Override
public List<LoginRecord> listRel(LoginRecordParam param) {
PageParam<LoginRecord, LoginRecordParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return page.sortRecords(baseMapper.selectListRel(param));
}
@Override
public LoginRecord getByIdRel(Integer id) {
LoginRecordParam param = new LoginRecordParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
@Async
@Override
public void saveAsync(String username, Integer type, String comments, Integer tenantId,
HttpServletRequest request) {
if (username == null) {
return;
}
LoginRecord loginRecord = new LoginRecord();
loginRecord.setUsername(username);
loginRecord.setLoginType(type);
loginRecord.setComments(comments);
loginRecord.setTenantId(tenantId);
UserAgent ua = UserAgentUtil.parse(ServletUtil.getHeaderIgnoreCase(request, "User-Agent"));
if (ua != null) {
if (ua.getPlatform() != null) {
loginRecord.setOs(ua.getPlatform().toString());
}
if (ua.getOs() != null) {
loginRecord.setDevice(ua.getOs().toString());
}
if (ua.getBrowser() != null) {
loginRecord.setBrowser(ua.getBrowser().toString());
}
}
loginRecord.setIp(ServletUtil.getClientIP(request));
baseMapper.insert(loginRecord);
}
}

View File

@@ -0,0 +1,139 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.entity.Menu;
import com.gxwebsoft.common.system.entity.Role;
import com.gxwebsoft.common.system.entity.RoleMenu;
import com.gxwebsoft.common.system.mapper.MenuMapper;
import com.gxwebsoft.common.system.param.MenuParam;
import com.gxwebsoft.common.system.service.MenuService;
import com.gxwebsoft.common.system.service.RoleMenuService;
import com.gxwebsoft.common.system.service.RoleService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* 菜单Service实现
*
* @author WebSoft
* @since 2018-12-24 16:10:10
*/
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {
private Integer plugMenuId;
@Resource
private RoleService roleService;
@Resource
private RoleMenuService roleMenuService;
@Override
@Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE)
public Boolean cloneMenu(MenuParam param) {
System.out.println("准备待克隆的菜单数据 = " + param);
// 删除本项目菜单
baseMapper.delete(new LambdaQueryWrapper<Menu>().eq(Menu::getDeleted,0));
// 顶级栏目
param.setParentId(0);
// final List<Menu> list = baseMapper.getMenuByClone(param);
//// final List<Integer> menuIds = list.stream().map(Menu::getMenuId).collect(Collectors.toList());
doCloneMenu(baseMapper.getMenuByClone(param));
return true;
}
@Override
@Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE)
public Boolean install(Integer id) {
// 1.插件绑定的菜单ID
final MenuParam param = new MenuParam();
param.setMenuId(id);
final List<Menu> list = baseMapper.getMenuByClone(param);
// TODO 克隆当前插件到顶级菜单
doCloneMenu(list);
// 2.查找当前租户的超管权限的roleId
final Role superAdmin = roleService.getOne(new LambdaQueryWrapper<Role>().eq(Role::getRoleCode, "superAdmin"));
final Integer roleId = superAdmin.getRoleId();
final Integer tenantId = superAdmin.getTenantId();
// 3.勾选菜单根权限
final RoleMenu roleMenu0 = new RoleMenu();
roleMenu0.setRoleId(roleId);
roleMenu0.setMenuId(this.plugMenuId);
roleMenuService.save(roleMenu0);
// 4.勾选根节点下的子菜单权限
final MenuParam menuParam = new MenuParam();
menuParam.setParentId(this.plugMenuId);
menuParam.setTenantId(tenantId);
final List<Menu> menuList = baseMapper.getMenuByClone(menuParam);
menuList.forEach(d->{
RoleMenu roleMenu = new RoleMenu();
roleMenu.setRoleId(roleId);
roleMenu.setMenuId(d.getMenuId());
roleMenuService.save(roleMenu);
});
// 5.调整新插件的排序
final Menu menu = baseMapper.selectById(this.plugMenuId);
menu.setSortNumber(100);
baseMapper.updateById(menu);
return true;
}
// 克隆菜单
private void doCloneMenu(List<Menu> list) {
final MenuParam param = new MenuParam();
list.forEach(d -> {
Menu menu = new Menu();
menu.setParentId(0);
menu.setTitle(d.getTitle());
menu.setPath(d.getPath());
menu.setComponent(d.getComponent());
menu.setMenuType(d.getMenuType());
menu.setSortNumber(d.getSortNumber());
menu.setAuthority(d.getAuthority());
menu.setIcon(d.getIcon());
menu.setHide(d.getHide());
menu.setMeta(d.getMeta());
save(menu);
this.plugMenuId = menu.getMenuId();
// 二级菜单
param.setParentId(d.getMenuId());
final List<Menu> list1 = baseMapper.getMenuByClone(param);
list1.forEach(d1 -> {
final Menu menu1 = new Menu();
menu1.setParentId(menu.getMenuId());
menu1.setTitle(d1.getTitle());
menu1.setPath(d1.getPath());
menu1.setComponent(d1.getComponent());
menu1.setMenuType(d1.getMenuType());
menu1.setSortNumber(d1.getSortNumber());
menu1.setAuthority(d1.getAuthority());
menu1.setIcon(d1.getIcon());
menu1.setHide(d1.getHide());
menu1.setMeta(d1.getMeta());
save(menu1);
// 三级菜单
param.setParentId(d1.getMenuId());
final List<Menu> list2 = baseMapper.getMenuByClone(param);
list2.forEach(d2 -> {
final Menu menu2 = new Menu();
menu2.setParentId(menu1.getMenuId());
menu2.setTitle(d2.getTitle());
menu2.setPath(d2.getPath());
menu2.setComponent(d2.getComponent());
menu2.setMenuType(d2.getMenuType());
menu2.setSortNumber(d2.getSortNumber());
menu2.setAuthority(d2.getAuthority());
menu2.setIcon(d2.getIcon());
menu2.setHide(d2.getHide());
menu2.setMeta(d2.getMeta());
save(menu2);
});
});
});
}
}

View File

@@ -0,0 +1,52 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.OperationRecord;
import com.gxwebsoft.common.system.mapper.OperationRecordMapper;
import com.gxwebsoft.common.system.param.OperationRecordParam;
import com.gxwebsoft.common.system.service.OperationRecordService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 操作日志Service实现
*
* @author WebSoft
* @since 2018-12-24 16:10:02
*/
@Service
public class OperationRecordServiceImpl extends ServiceImpl<OperationRecordMapper, OperationRecord>
implements OperationRecordService {
@Override
public PageResult<OperationRecord> pageRel(OperationRecordParam param) {
PageParam<OperationRecord, OperationRecordParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal());
}
@Override
public List<OperationRecord> listRel(OperationRecordParam param) {
PageParam<OperationRecord, OperationRecordParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return page.sortRecords(baseMapper.selectListRel(param));
}
@Override
public OperationRecord getByIdRel(Integer id) {
OperationRecordParam param = new OperationRecordParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
@Async
@Override
public void saveAsync(OperationRecord operationRecord) {
baseMapper.insert(operationRecord);
}
}

View File

@@ -0,0 +1,45 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Organization;
import com.gxwebsoft.common.system.mapper.OrganizationMapper;
import com.gxwebsoft.common.system.param.OrganizationParam;
import com.gxwebsoft.common.system.service.OrganizationService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 组织机构Service实现
*
* @author WebSoft
* @since 2020-03-14 11:29:04
*/
@Service
public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Organization>
implements OrganizationService {
@Override
public PageResult<Organization> pageRel(OrganizationParam param) {
PageParam<Organization, OrganizationParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number");
return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal());
}
@Override
public List<Organization> listRel(OrganizationParam param) {
PageParam<Organization, OrganizationParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number");
return page.sortRecords(baseMapper.selectListRel(param));
}
@Override
public Organization getByIdRel(Integer organizationId) {
OrganizationParam param = new OrganizationParam();
param.setOrganizationId(organizationId);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -0,0 +1,112 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Plug;
import com.gxwebsoft.common.system.mapper.PlugMapper;
import com.gxwebsoft.common.system.param.PlugParam;
import com.gxwebsoft.common.system.service.PlugService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 插件扩展Service实现
*
* @author 科技小王子
* @since 2023-05-18 11:57:37
*/
@Service
public class PlugServiceImpl extends ServiceImpl<PlugMapper, Plug> implements PlugService {
@Override
public PageResult<Plug> pageRel(PlugParam param) {
PageParam<Plug, PlugParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<Plug> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Plug> listRel(PlugParam param) {
List<Plug> list = baseMapper.selectListRel(param);
// 排序
PageParam<Plug, PlugParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public Plug getByIdRel(Integer menuId) {
PlugParam param = new PlugParam();
param.setMenuId(menuId);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
@Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE)
public Boolean cloneMenu(PlugParam param) {
System.out.println("准备待克隆的菜单数据 = " + param);
// 删除本项目菜单
baseMapper.delete(new LambdaQueryWrapper<Plug>().eq(Plug::getDeleted,0));
// 顶级栏目
param.setParentId(0);
final List<Plug> list = baseMapper.getMenuByClone(param);
// final List<Integer> menuIds = list.stream().map(Menu::getMenuId).collect(Collectors.toList());
list.forEach(d -> {
Plug plug = new Plug();
plug.setParentId(0);
plug.setTitle(d.getTitle());
plug.setPath(d.getPath());
plug.setComponent(d.getComponent());
plug.setMenuType(d.getMenuType());
plug.setSortNumber(d.getSortNumber());
plug.setAuthority(d.getAuthority());
plug.setIcon(d.getIcon());
plug.setHide(d.getHide());
plug.setMeta(d.getMeta());
save(plug);
// 二级菜单
param.setParentId(d.getMenuId());
final List<Plug> list1 = baseMapper.getMenuByClone(param);
list1.forEach(d1 -> {
final Plug menu1 = new Plug();
menu1.setParentId(plug.getMenuId());
menu1.setTitle(d1.getTitle());
menu1.setPath(d1.getPath());
menu1.setComponent(d1.getComponent());
menu1.setMenuType(d1.getMenuType());
menu1.setSortNumber(d1.getSortNumber());
menu1.setAuthority(d1.getAuthority());
menu1.setIcon(d1.getIcon());
menu1.setHide(d1.getHide());
menu1.setMeta(d1.getMeta());
save(menu1);
// 三级菜单
param.setParentId(d1.getMenuId());
final List<Plug> list2 = baseMapper.getMenuByClone(param);
list2.forEach(d2 -> {
final Plug menu2 = new Plug();
menu2.setParentId(menu1.getMenuId());
menu2.setTitle(d2.getTitle());
menu2.setPath(d2.getPath());
menu2.setComponent(d2.getComponent());
menu2.setMenuType(d2.getMenuType());
menu2.setSortNumber(d2.getSortNumber());
menu2.setAuthority(d2.getAuthority());
menu2.setIcon(d2.getIcon());
menu2.setHide(d2.getHide());
menu2.setMeta(d2.getMeta());
save(menu2);
});
});
});
return true;
}
}

View File

@@ -0,0 +1,31 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.entity.Menu;
import com.gxwebsoft.common.system.entity.RoleMenu;
import com.gxwebsoft.common.system.mapper.RoleMenuMapper;
import com.gxwebsoft.common.system.service.RoleMenuService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 角色菜单Service实现
*
* @author WebSoft
* @since 2018-12-24 16:10:12
*/
@Service
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService {
@Override
public List<Menu> listMenuByUserId(Integer userId, Integer menuType) {
return baseMapper.listMenuByUserId(userId, menuType);
}
@Override
public List<Menu> listMenuByRoleIds(List<Integer> roleIds, Integer menuType) {
return baseMapper.listMenuByRoleIds(roleIds, menuType);
}
}

View File

@@ -0,0 +1,18 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.entity.Role;
import com.gxwebsoft.common.system.mapper.RoleMapper;
import com.gxwebsoft.common.system.service.RoleService;
import org.springframework.stereotype.Service;
/**
* 角色服务实现类
*
* @author WebSoft
* @since 2018-12-24 16:10:11
*/
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
}

View File

@@ -0,0 +1,77 @@
package com.gxwebsoft.common.system.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.exception.BusinessException;
import com.gxwebsoft.common.system.mapper.SettingMapper;
import com.gxwebsoft.common.system.service.SettingService;
import com.gxwebsoft.common.system.entity.Setting;
import com.gxwebsoft.common.system.param.SettingParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import lombok.val;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 系统设置Service实现
*
* @author WebSoft
* @since 2022-11-19 13:54:27
*/
@Service
public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> implements SettingService {
@Resource
private StringRedisTemplate stringRedisTemplate;
@Override
public PageResult<Setting> pageRel(SettingParam param) {
PageParam<Setting, SettingParam> page = new PageParam<>(param);
//page.setDefaultOrder("create_time desc");
List<Setting> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Setting> listRel(SettingParam param) {
List<Setting> list = baseMapper.selectListRel(param);
// 排序
PageParam<Setting, SettingParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public Setting getByIdRel(Integer settingId) {
SettingParam param = new SettingParam();
param.setSettingId(settingId);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public JSONObject getBySettingKey(String key) {
Setting setting = this.getOne(new QueryWrapper<Setting>().eq("setting_key", key), false);
return JSON.parseObject(setting.getContent());
}
@Override
public Setting getData(String settingKey) {
return query().eq("setting_key", settingKey).one();
}
@Override
public JSONObject getCache(String key) {
final String cache = stringRedisTemplate.opsForValue().get(key);
final JSONObject jsonObject = JSONObject.parseObject(cache);
if(jsonObject == null){
throw new BusinessException("域名未配置");
}
return jsonObject;
}
}

View File

@@ -0,0 +1,18 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.mapper.UserFileMapper;
import com.gxwebsoft.common.system.service.UserFileService;
import com.gxwebsoft.common.system.entity.UserFile;
import org.springframework.stereotype.Service;
/**
* 用户文件Service实现
*
* @author WebSoft
* @since 2022-07-21 14:34:40
*/
@Service
public class UserFileServiceImpl extends ServiceImpl<UserFileMapper, UserFile> implements UserFileService {
}

View File

@@ -0,0 +1,37 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.entity.Role;
import com.gxwebsoft.common.system.entity.UserRole;
import com.gxwebsoft.common.system.mapper.UserRoleMapper;
import com.gxwebsoft.common.system.service.UserRoleService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 用户角色Service实现
*
* @author WebSoft
* @since 2018-12-24 16:10:36
*/
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {
@Override
public int saveBatch(Integer userId, List<Integer> roleIds) {
return baseMapper.insertBatch(userId, roleIds);
}
@Override
public List<Role> listByUserId(Integer userId) {
return baseMapper.selectByUserId(userId);
}
@Override
public List<Role> listByUserIds(List<Integer> userIds) {
return baseMapper.selectByUserIds(userIds);
}
}

View File

@@ -0,0 +1,256 @@
package com.gxwebsoft.common.system.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.exception.BusinessException;
import com.gxwebsoft.common.core.utils.CacheClient;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Role;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.entity.UserRole;
import com.gxwebsoft.common.system.mapper.UserMapper;
import com.gxwebsoft.common.system.param.UserParam;
import com.gxwebsoft.common.system.service.CompanyService;
import com.gxwebsoft.common.system.service.RoleMenuService;
import com.gxwebsoft.common.system.service.UserRoleService;
import com.gxwebsoft.common.system.service.UserService;
import com.gxwebsoft.oa.entity.App;
import com.gxwebsoft.oa.service.AppService;
import com.gxwebsoft.shop.entity.Merchant;
import com.gxwebsoft.shop.entity.MerchantClerk;
import com.gxwebsoft.shop.service.MerchantClerkService;
import com.gxwebsoft.shop.service.MerchantService;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.gxwebsoft.common.core.constants.RedisConstants.TEN_ANT_SETTING_KEY;
import static com.gxwebsoft.common.core.constants.RedisConstants.USER_RANKING_BY_APPS;
/**
* 用户Service实现
*
* @author WebSoft
* @since 2018-12-24 16:10:14
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
@Resource
private UserRoleService userRoleService;
@Resource
private RoleMenuService roleMenuService;
@Resource
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Resource
private MerchantService merchantService;
@Resource
private MerchantClerkService merchantClerkService;
@Resource
private CacheClient cacheClient;
@Resource
private AppService appService;
@Resource
private CompanyService companyService;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Override
public PageResult<User> pageRel(UserParam param) {
PageParam<User, UserParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<User> list = baseMapper.selectPageRel(page, param);
// 查询用户的角色
selectUserRoles(list);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<User> listRel(UserParam param) {
List<User> list = baseMapper.selectListRel(param);
// 查询用户的角色
selectUserRoles(list);
// 排序
PageParam<User, UserParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public void listRanking(UserParam param) {
List<User> list = baseMapper.selectListRel(param);
Map<String, String> map = new HashMap<>();
list.forEach(d -> {
int count = appService.count(new LambdaQueryWrapper<App>()
.eq(App::getUserId, d.getUserId()));
// 更新全部用户的插件数量
cacheClient.zAdd(USER_RANKING_BY_APPS,d.getUserId(), (double) count);
});
}
@Override
public User getByIdRel(Integer userId) {
UserParam param = new UserParam();
param.setUserId(userId);
User user = param.getOne(baseMapper.selectListRel(param));
if (user != null) {
user.setRoles(userRoleService.listByUserId(user.getUserId()));
user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null));
user.setCompanyInfo(companyService.getByTenantIdRel(user.getTenantId()));
final String cache = cacheClient.get(TEN_ANT_SETTING_KEY.concat(":setting"));
user.setSetting(cache);
// 商户编号
Merchant merchant = merchantService.getOne(new QueryWrapper<Merchant>()
.eq("merchant_owner", user.getUserId()),false);
if(merchant != null){
user.setMerchantCode(merchant.getMerchantCode());
user.setMerchantName(merchant.getMerchantName());
}else{
MerchantClerk clerk = merchantClerkService.getOne(new QueryWrapper<MerchantClerk>().eq("user_id",user.getUserId()),false);
if(clerk != null) {
user.setMerchantCode(clerk.getMerchantCode());
}
}
}
return user;
}
@Override
public User getByUsername(String username) {
return getByUsername(username, null);
}
@Override
public User getByUsername(String username, Integer tenantId) {
if (StrUtil.isBlank(username)) {
return null;
}
User user = baseMapper.selectByUsername(username, tenantId);
if (user != null) {
user.setRoles(userRoleService.listByUserId(user.getUserId()));
user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null));
}
return user;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
return getByUsername(username);
}
@Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE)
@Override
public boolean saveUser(User user) {
if (StrUtil.isNotEmpty(user.getUsername()) && baseMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getUsername, user.getUsername())) > 0) {
throw new BusinessException("账号已存在");
}
if (StrUtil.isNotEmpty(user.getPhone()) && baseMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getPhone, user.getPhone())) > 0) {
throw new BusinessException("手机号已存在");
}
if (StrUtil.isNotEmpty(user.getEmail()) && baseMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getEmail, user.getEmail())) > 0) {
throw new BusinessException("邮箱已存在");
}
boolean result = baseMapper.insert(user) > 0;
if (result && user.getRoles() != null && user.getRoles().size() > 0) {
List<Integer> roleIds = user.getRoles().stream().map(Role::getRoleId).collect(Collectors.toList());
if (userRoleService.saveBatch(user.getUserId(), roleIds) < roleIds.size()) {
throw new BusinessException("用户角色添加失败");
}
}
return result;
}
@Transactional(rollbackFor = {Exception.class})
@Override
public boolean updateUser(User user) {
if (StrUtil.isNotEmpty(user.getUsername()) && baseMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getUsername, user.getUsername())
.ne(User::getUserId, user.getUserId())) > 0) {
throw new BusinessException("账号已存在");
}
if (StrUtil.isNotEmpty(user.getPhone()) && baseMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getPhone, user.getPhone())
.ne(User::getUserId, user.getUserId())) > 0) {
throw new BusinessException("手机号已存在");
}
if (StrUtil.isNotEmpty(user.getEmail()) && baseMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getEmail, user.getEmail())
.ne(User::getUserId, user.getUserId())) > 0) {
throw new BusinessException("邮箱已存在");
}
boolean result = baseMapper.updateById(user) > 0;
if (result && user.getRoles() != null && user.getRoles().size() > 0) {
userRoleService.remove(new LambdaUpdateWrapper<UserRole>().eq(UserRole::getUserId, user.getUserId()));
List<Integer> roleIds = user.getRoles().stream().map(Role::getRoleId).collect(Collectors.toList());
if (userRoleService.saveBatch(user.getUserId(), roleIds) < roleIds.size()) {
throw new BusinessException("用户角色添加失败");
}
}
return result;
}
@Override
public boolean comparePassword(String dbPassword, String inputPassword) {
return bCryptPasswordEncoder.matches(inputPassword, dbPassword);
}
@Override
public String encodePassword(String password) {
return password == null ? null : bCryptPasswordEncoder.encode(password);
}
@Override
public User getByPhone(String phone) {
return query().eq("phone", phone).one();
}
@Override
public User getByUnionId(UserParam param) {
return param.getOne(baseMapper.getOne(param));
}
@Override
public User getByOauthId(UserParam userParam) {
return userParam.getOne(baseMapper.getOne(userParam));
}
@Override
public List<User> listStatisticsRel(UserParam param) {
List<User> list = baseMapper.selectListStatisticsRel(param);
return list;
}
/**
* 批量查询用户的角色
*
* @param users 用户集合
*/
private void selectUserRoles(List<User> users) {
if (users != null && users.size() > 0) {
List<Integer> userIds = users.stream().map(User::getUserId).collect(Collectors.toList());
List<Role> userRoles = userRoleService.listByUserIds(userIds);
for (User user : users) {
List<Role> roles = userRoles.stream().filter(d -> user.getUserId().equals(d.getUserId()))
.collect(Collectors.toList());
user.setRoles(roles);
}
}
}
}