拆分think模块包
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.AppRenewMapper;
|
||||
import com.gxwebsoft.common.system.service.AppRenewService;
|
||||
import com.gxwebsoft.common.system.entity.AppRenew;
|
||||
import com.gxwebsoft.common.system.param.AppRenewParam;
|
||||
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-11-14 14:14:07
|
||||
*/
|
||||
@Service
|
||||
public class AppRenewServiceImpl extends ServiceImpl<AppRenewMapper, AppRenew> implements AppRenewService {
|
||||
|
||||
@Override
|
||||
public PageResult<AppRenew> pageRel(AppRenewParam param) {
|
||||
PageParam<AppRenew, AppRenewParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<AppRenew> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppRenew> listRel(AppRenewParam param) {
|
||||
List<AppRenew> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<AppRenew, AppRenewParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppRenew getByIdRel(Integer appRenewId) {
|
||||
AppRenewParam param = new AppRenewParam();
|
||||
param.setAppRenewId(appRenewId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.AppMapper;
|
||||
import com.gxwebsoft.common.system.service.AppService;
|
||||
import com.gxwebsoft.common.system.entity.App;
|
||||
import com.gxwebsoft.common.system.param.AppParam;
|
||||
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-10-30 22:20:23
|
||||
*/
|
||||
@Service
|
||||
public class AppServiceImpl extends ServiceImpl<AppMapper, App> implements AppService {
|
||||
|
||||
@Override
|
||||
public PageResult<App> pageRel(AppParam param) {
|
||||
PageParam<App, AppParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<App> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<App> listRel(AppParam param) {
|
||||
List<App> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<App, AppParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public App getByIdRel(Integer appId) {
|
||||
AppParam param = new AppParam();
|
||||
param.setAppId(appId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.AppUrlMapper;
|
||||
import com.gxwebsoft.common.system.service.AppUrlService;
|
||||
import com.gxwebsoft.common.system.entity.AppUrl;
|
||||
import com.gxwebsoft.common.system.param.AppUrlParam;
|
||||
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-10-30 22:20:23
|
||||
*/
|
||||
@Service
|
||||
public class AppUrlServiceImpl extends ServiceImpl<AppUrlMapper, AppUrl> implements AppUrlService {
|
||||
|
||||
@Override
|
||||
public PageResult<AppUrl> pageRel(AppUrlParam param) {
|
||||
PageParam<AppUrl, AppUrlParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<AppUrl> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppUrl> listRel(AppUrlParam param) {
|
||||
List<AppUrl> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<AppUrl, AppUrlParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUrl getByIdRel(Integer appUrlId) {
|
||||
AppUrlParam param = new AppUrlParam();
|
||||
param.setAppUrlId(appUrlId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.AppUserMapper;
|
||||
import com.gxwebsoft.common.system.service.AppUserService;
|
||||
import com.gxwebsoft.common.system.entity.AppUser;
|
||||
import com.gxwebsoft.common.system.param.AppUserParam;
|
||||
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-10-30 22:20:23
|
||||
*/
|
||||
@Service
|
||||
public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements AppUserService {
|
||||
|
||||
@Override
|
||||
public PageResult<AppUser> pageRel(AppUserParam param) {
|
||||
PageParam<AppUser, AppUserParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<AppUser> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppUser> listRel(AppUserParam param) {
|
||||
List<AppUser> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<AppUser, AppUserParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUser getByIdRel(Integer appUserId) {
|
||||
AppUserParam param = new AppUserParam();
|
||||
param.setAppUserId(appUserId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.ChatConversationMapper;
|
||||
import com.gxwebsoft.common.system.service.ChatConversationService;
|
||||
import com.gxwebsoft.common.system.entity.ChatConversation;
|
||||
import com.gxwebsoft.common.system.param.ChatConversationParam;
|
||||
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 2024-04-27 15:57:27
|
||||
*/
|
||||
@Service
|
||||
public class ChatConversationServiceImpl extends ServiceImpl<ChatConversationMapper, ChatConversation> implements ChatConversationService {
|
||||
|
||||
@Override
|
||||
public PageResult<ChatConversation> pageRel(ChatConversationParam param) {
|
||||
PageParam<ChatConversation, ChatConversationParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<ChatConversation> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChatConversation> listRel(ChatConversationParam param) {
|
||||
List<ChatConversation> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ChatConversation, ChatConversationParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatConversation getByIdRel(Integer id) {
|
||||
ChatConversationParam param = new ChatConversationParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.ChatMessageMapper;
|
||||
import com.gxwebsoft.common.system.service.ChatMessageService;
|
||||
import com.gxwebsoft.common.system.entity.ChatMessage;
|
||||
import com.gxwebsoft.common.system.param.ChatMessageParam;
|
||||
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 2024-04-27 15:57:27
|
||||
*/
|
||||
@Service
|
||||
public class ChatMessageServiceImpl extends ServiceImpl<ChatMessageMapper, ChatMessage> implements ChatMessageService {
|
||||
|
||||
@Override
|
||||
public PageResult<ChatMessage> pageRel(ChatMessageParam param) {
|
||||
PageParam<ChatMessage, ChatMessageParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<ChatMessage> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChatMessage> listRel(ChatMessageParam param) {
|
||||
List<ChatMessage> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ChatMessage, ChatMessageParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatMessage getByIdRel(Integer id) {
|
||||
ChatMessageParam param = new ChatMessageParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.web.ExistenceParam;
|
||||
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));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<Company> pageRelAll(CompanyParam param) {
|
||||
PageParam<Company, CompanyParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Company> list = baseMapper.selectPageRelAll(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByCompanyId(Company company) {
|
||||
baseMapper.updateByCompanyId(company);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCompanyAll(Integer companyId){
|
||||
if (baseMapper.removeCompanyAll(companyId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean undeleteAll(Integer companyId){
|
||||
if (baseMapper.undeleteAll(companyId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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 asc, create_time asc");
|
||||
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 asc, create_time asc");
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
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.scheduling.annotation.Async;
|
||||
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); // 发送邮件
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void sendEmail(String title, String content, String receiver) {
|
||||
// 发送邮件通知
|
||||
EmailRecord emailRecord = new EmailRecord();
|
||||
emailRecord.setTitle(title);
|
||||
emailRecord.setContent(content);
|
||||
emailRecord.setReceiver(receiver);
|
||||
emailRecord.setCreateUserId(42);
|
||||
sendTextEmail(title,content,receiver.split(","));
|
||||
save(emailRecord);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.EnvironmentMapper;
|
||||
import com.gxwebsoft.common.system.service.EnvironmentService;
|
||||
import com.gxwebsoft.common.system.entity.Environment;
|
||||
import com.gxwebsoft.common.system.param.EnvironmentParam;
|
||||
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-10-18 08:45:13
|
||||
*/
|
||||
@Service
|
||||
public class EnvironmentServiceImpl extends ServiceImpl<EnvironmentMapper, Environment> implements EnvironmentService {
|
||||
|
||||
@Override
|
||||
public PageResult<Environment> pageRel(EnvironmentParam param) {
|
||||
PageParam<Environment, EnvironmentParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<Environment> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Environment> listRel(EnvironmentParam param) {
|
||||
List<Environment> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Environment, EnvironmentParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Environment getByIdRel(Integer id) {
|
||||
EnvironmentParam param = new EnvironmentParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.oss.ClientException;
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.OSSException;
|
||||
import com.aliyun.oss.common.auth.CredentialsProvider;
|
||||
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.Company;
|
||||
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.CompanyService;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件上传记录Service实现
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2021-08-30 11:21:01
|
||||
*/
|
||||
@Service
|
||||
public class FileRecordServiceImpl extends ServiceImpl<FileRecordMapper, FileRecord> implements FileRecordService {
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private SettingService settingService;
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOssFileAsync(List<FileRecord> fileRecords) {
|
||||
// 读取云存储配置信息
|
||||
final FileRecord record = fileRecords.get(0);
|
||||
System.out.println("record = " + record);
|
||||
final JSONObject uploadConfig = settingService.getUploadConfig(record.getTenantId());
|
||||
String endpoint = uploadConfig.getString("bucketEndpoint");
|
||||
String bucketDomain = uploadConfig.getString("bucketDomain");
|
||||
String bucketName = uploadConfig.getString("bucketName");
|
||||
String accessKeyId = uploadConfig.getString("accessKeyId");
|
||||
String accessKeySecret = uploadConfig.getString("accessKeySecret");
|
||||
CredentialsProvider credentialsProvider = new DefaultCredentialProvider(accessKeyId, accessKeySecret);
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, credentialsProvider);
|
||||
for (FileRecord fileRecord : fileRecords) {
|
||||
fileRecord.setPath(StrUtil.replace(fileRecord.getPath(), bucketDomain.concat("/"), ""));
|
||||
try {
|
||||
// 删除远程文件
|
||||
ossClient.deleteObject(bucketName, fileRecord.getPath());
|
||||
// 释放空间大小
|
||||
if (fileRecord.getCompanyId() > 0) {
|
||||
Company company = companyService.getById(fileRecord.getCompanyId());
|
||||
company.setStorage(company.getStorage() - fileRecord.getLength());
|
||||
companyService.updateById(company);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
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.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.system.entity.*;
|
||||
import com.gxwebsoft.common.system.mapper.MenuMapper;
|
||||
import com.gxwebsoft.common.system.mapper.RoleMapper;
|
||||
import com.gxwebsoft.common.system.param.MenuParam;
|
||||
import com.gxwebsoft.common.system.param.RoleParam;
|
||||
import com.gxwebsoft.common.system.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
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;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private UserRoleService userRoleService;
|
||||
|
||||
@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);
|
||||
// 工单系统
|
||||
if (param.getTenantId().equals(10125)) {
|
||||
// 初始化数据
|
||||
initializedData();
|
||||
}
|
||||
// 开始克隆
|
||||
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());
|
||||
menu.setModules(d.getModules());
|
||||
menu.setModulesUrl(d.getModulesUrl());
|
||||
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());
|
||||
menu1.setModules(d1.getModules());
|
||||
menu1.setModulesUrl(d1.getModulesUrl());
|
||||
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());
|
||||
menu2.setModules(d2.getModules());
|
||||
menu2.setModulesUrl(d2.getModulesUrl());
|
||||
save(menu2);
|
||||
// 四级菜单
|
||||
param.setParentId(d2.getMenuId());
|
||||
final List<Menu> list3 = baseMapper.getMenuByClone(param);
|
||||
list3.forEach(d3 -> {
|
||||
final Menu menu3 = new Menu();
|
||||
menu3.setParentId(menu2.getMenuId());
|
||||
menu3.setTitle(d3.getTitle());
|
||||
menu3.setPath(d3.getPath());
|
||||
menu3.setComponent(d3.getComponent());
|
||||
menu3.setMenuType(d3.getMenuType());
|
||||
menu3.setSortNumber(d3.getSortNumber());
|
||||
menu3.setAuthority(d3.getAuthority());
|
||||
menu3.setIcon(d3.getIcon());
|
||||
menu3.setHide(d3.getHide());
|
||||
menu3.setMeta(d3.getMeta());
|
||||
menu3.setModules(d3.getModules());
|
||||
menu3.setModulesUrl(d3.getModulesUrl());
|
||||
save(menu3);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化数据
|
||||
private void initializedData(){
|
||||
Role role = new Role();
|
||||
User user = new User();
|
||||
UserRole userRole = new UserRole();
|
||||
if(roleService.count(new LambdaQueryWrapper<Role>().eq(Role::getRoleCode, "admin")) == 0){
|
||||
role.setRoleCode("admin");
|
||||
role.setRoleName("管理人员");
|
||||
role.setComments("工单分派管理专员");
|
||||
roleService.save(role);
|
||||
if(userService.count(new LambdaQueryWrapper<User>().eq(User::getUsername, "管理人员")) == 0){
|
||||
user.setUsername("刘备");
|
||||
user.setNickname("刘备");
|
||||
user.setPhone("13800138001");
|
||||
user.setPassword(userService.encodePassword("123456"));
|
||||
user.setSex("1");
|
||||
userService.save(user);
|
||||
// 添加用户角色
|
||||
userRole.setRoleId(role.getRoleId());
|
||||
userRole.setUserId(user.getUserId());
|
||||
userRoleService.save(userRole);
|
||||
// 添加统计表
|
||||
|
||||
}
|
||||
}
|
||||
if(roleService.count(new LambdaQueryWrapper<Role>().eq(Role::getRoleCode, "commander")) == 0){
|
||||
role.setRoleCode("commander");
|
||||
role.setRoleName("受理人员");
|
||||
role.setComments("负责解决问题的处理人员");
|
||||
roleService.save(role);
|
||||
if(userService.count(new LambdaQueryWrapper<User>().eq(User::getUsername, "commander")) == 0){
|
||||
user.setUsername("关羽");
|
||||
user.setNickname("关羽");
|
||||
user.setPhone("13800138002");
|
||||
user.setPassword(userService.encodePassword("123456"));
|
||||
user.setSex("1");
|
||||
userService.save(user);
|
||||
// 添加用户角色
|
||||
userRole.setRoleId(role.getRoleId());
|
||||
userRole.setUserId(user.getUserId());
|
||||
userRoleService.save(userRole);
|
||||
}
|
||||
}
|
||||
if(roleService.count(new LambdaQueryWrapper<Role>().eq(Role::getRoleCode, "promoter")) == 0){
|
||||
role.setRoleCode("promoter");
|
||||
role.setRoleName("工单发起人");
|
||||
role.setComments("问题及需求的发起人");
|
||||
roleService.save(role);
|
||||
if(userService.count(new LambdaQueryWrapper<User>().eq(User::getUsername, "promoter")) == 0){
|
||||
user.setUsername("张飞");
|
||||
user.setNickname("张飞");
|
||||
user.setPassword(userService.encodePassword("123456"));
|
||||
user.setSex("1");
|
||||
userService.save(user);
|
||||
// 添加用户角色
|
||||
userRole.setRoleId(role.getRoleId());
|
||||
userRole.setUserId(user.getUserId());
|
||||
userRoleService.save(userRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.MerchantAccount;
|
||||
import com.gxwebsoft.common.system.mapper.MerchantAccountMapper;
|
||||
import com.gxwebsoft.common.system.param.MerchantAccountParam;
|
||||
import com.gxwebsoft.common.system.service.MerchantAccountService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户账号Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-19 12:02:24
|
||||
*/
|
||||
@Service
|
||||
public class MerchantAccountServiceImpl extends ServiceImpl<MerchantAccountMapper, MerchantAccount> implements MerchantAccountService {
|
||||
|
||||
@Override
|
||||
public PageResult<MerchantAccount> pageRel(MerchantAccountParam param) {
|
||||
PageParam<MerchantAccount, MerchantAccountParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<MerchantAccount> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantAccount> listRel(MerchantAccountParam param) {
|
||||
List<MerchantAccount> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<MerchantAccount, MerchantAccountParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantAccount getByIdRel(Integer id) {
|
||||
MerchantAccountParam param = new MerchantAccountParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.MerchantApply;
|
||||
import com.gxwebsoft.common.system.mapper.MerchantApplyMapper;
|
||||
import com.gxwebsoft.common.system.param.MerchantApplyParam;
|
||||
import com.gxwebsoft.common.system.service.MerchantApplyService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户入驻申请Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-05 01:24:36
|
||||
*/
|
||||
@Service
|
||||
public class MerchantApplyServiceImpl extends ServiceImpl<MerchantApplyMapper, MerchantApply> implements MerchantApplyService {
|
||||
|
||||
@Override
|
||||
public PageResult<MerchantApply> pageRel(MerchantApplyParam param) {
|
||||
PageParam<MerchantApply, MerchantApplyParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<MerchantApply> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantApply> listRel(MerchantApplyParam param) {
|
||||
List<MerchantApply> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<MerchantApply, MerchantApplyParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantApply getByIdRel(Integer applyId) {
|
||||
MerchantApplyParam param = new MerchantApplyParam();
|
||||
param.setApplyId(applyId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.Merchant;
|
||||
import com.gxwebsoft.common.system.mapper.MerchantMapper;
|
||||
import com.gxwebsoft.common.system.param.MerchantParam;
|
||||
import com.gxwebsoft.common.system.service.MerchantService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-05 00:03:54
|
||||
*/
|
||||
@Service
|
||||
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {
|
||||
|
||||
@Override
|
||||
public PageResult<Merchant> pageRel(MerchantParam param) {
|
||||
PageParam<Merchant, MerchantParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<Merchant> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Merchant> listRel(MerchantParam param) {
|
||||
List<Merchant> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Merchant, MerchantParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Merchant getByIdRel(Integer merchantId) {
|
||||
MerchantParam param = new MerchantParam();
|
||||
param.setMerchantId(merchantId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.MerchantType;
|
||||
import com.gxwebsoft.common.system.mapper.MerchantTypeMapper;
|
||||
import com.gxwebsoft.common.system.param.MerchantTypeParam;
|
||||
import com.gxwebsoft.common.system.service.MerchantTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户类型Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-05 00:08:51
|
||||
*/
|
||||
@Service
|
||||
public class MerchantTypeServiceImpl extends ServiceImpl<MerchantTypeMapper, MerchantType> implements MerchantTypeService {
|
||||
|
||||
@Override
|
||||
public PageResult<MerchantType> pageRel(MerchantTypeParam param) {
|
||||
PageParam<MerchantType, MerchantTypeParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<MerchantType> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantType> listRel(MerchantTypeParam param) {
|
||||
List<MerchantType> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<MerchantType, MerchantTypeParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantType getByIdRel(Integer id) {
|
||||
MerchantTypeParam param = new MerchantTypeParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.ModulesMapper;
|
||||
import com.gxwebsoft.common.system.service.ModulesService;
|
||||
import com.gxwebsoft.common.system.entity.Modules;
|
||||
import com.gxwebsoft.common.system.param.ModulesParam;
|
||||
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-10-18 15:53:43
|
||||
*/
|
||||
@Service
|
||||
public class ModulesServiceImpl extends ServiceImpl<ModulesMapper, Modules> implements ModulesService {
|
||||
|
||||
@Override
|
||||
public PageResult<Modules> pageRel(ModulesParam param) {
|
||||
PageParam<Modules, ModulesParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<Modules> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Modules> listRel(ModulesParam param) {
|
||||
List<Modules> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Modules, ModulesParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Modules getByIdRel(Integer id) {
|
||||
ModulesParam param = new ModulesParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.NoticeMapper;
|
||||
import com.gxwebsoft.common.system.service.NoticeService;
|
||||
import com.gxwebsoft.common.system.entity.Notice;
|
||||
import com.gxwebsoft.common.system.param.NoticeParam;
|
||||
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-10-08 13:22:21
|
||||
*/
|
||||
@Service
|
||||
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {
|
||||
|
||||
@Override
|
||||
public PageResult<Notice> pageRel(NoticeParam param) {
|
||||
PageParam<Notice, NoticeParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Notice> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Notice> listRel(NoticeParam param) {
|
||||
List<Notice> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Notice, NoticeParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Notice getByIdRel(Integer noticeId) {
|
||||
NoticeParam param = new NoticeParam();
|
||||
param.setNoticeId(noticeId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.OrderInfoMapper;
|
||||
import com.gxwebsoft.common.system.service.OrderInfoService;
|
||||
import com.gxwebsoft.common.system.entity.OrderInfo;
|
||||
import com.gxwebsoft.common.system.param.OrderInfoParam;
|
||||
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 2024-05-10 18:02:54
|
||||
*/
|
||||
@Service
|
||||
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements OrderInfoService {
|
||||
|
||||
@Override
|
||||
public PageResult<OrderInfo> pageRel(OrderInfoParam param) {
|
||||
PageParam<OrderInfo, OrderInfoParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<OrderInfo> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderInfo> listRel(OrderInfoParam param) {
|
||||
List<OrderInfo> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<OrderInfo, OrderInfoParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderInfo getByIdRel(Integer id) {
|
||||
OrderInfoParam param = new OrderInfoParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Order;
|
||||
import com.gxwebsoft.common.system.entity.Payment;
|
||||
import com.gxwebsoft.common.system.mapper.OrderMapper;
|
||||
import com.gxwebsoft.common.system.param.OrderParam;
|
||||
import com.gxwebsoft.common.system.service.OrderService;
|
||||
import com.gxwebsoft.common.system.service.PaymentService;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.RSAConfig;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-04-24 13:46:21
|
||||
*/
|
||||
@Service
|
||||
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||
@Value("${spring.profiles.active}")
|
||||
String active;
|
||||
@Resource
|
||||
private ConfigProperties config;
|
||||
@Resource
|
||||
private SettingService settingService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private PaymentService paymentService;
|
||||
public static String privateKeyPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/apiclient_key.pem";
|
||||
public static String privateCertPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/apiclient_cert.pem";
|
||||
public static String serialNumber = "48749613B40AA8F1D768583FC352358E13EB5AF0";
|
||||
public static String merchantId = "1246610101";
|
||||
public static String appId = "wx541db955e7a62709";
|
||||
public static String apiV3Key = "zGufUcqa7ovgxRL0kF5OlPr482EZwtn9";
|
||||
|
||||
/**
|
||||
* 平台证书生成命令(勿删)
|
||||
* java -jar CertificateDownloader.jar -k zGufUcqa7ovgxRL0kF5OlPr482EZwtn9 -m 1246610101 -f /www/wwwroot/file.ws//file/20240511/280fb6cf7eec4c2d9661c2508123c6a8.pem -s 48749613B40AA8F1D768583FC352358E13EB5AF0 -o /www/cert/
|
||||
*/
|
||||
public static String wechatpayCertPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/wechatpay_4A3231584E93B6AE77820074D07EADEACCB7E223.pem"; // 平台证书
|
||||
|
||||
@Override
|
||||
public PageResult<Order> pageRel(OrderParam param) {
|
||||
PageParam<Order, OrderParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Order> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Order> listRel(OrderParam param) {
|
||||
List<Order> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Order, OrderParam> page = new PageParam<>();
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getByIdRel(Integer orderId) {
|
||||
OrderParam param = new OrderParam();
|
||||
param.setOrderId(orderId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getByOutTradeNo(String outTradeNo) {
|
||||
System.out.println("outTradeNo = " + outTradeNo);
|
||||
OrderParam param = new OrderParam();
|
||||
param.setOrderNo(outTradeNo);
|
||||
return param.getOne(baseMapper.getByOutTradeNo(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByOutTradeNo(Order order) {
|
||||
baseMapper.updateByOutTradeNo(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建微信支付
|
||||
*
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, String> createWxOrder(Order order) {
|
||||
// 服务器本地路径
|
||||
final String uploadPath = config.getUploadPath();
|
||||
final HashMap<String, String> orderInfo = new HashMap<>();
|
||||
// 微信小程序(微信支付)
|
||||
String key = "Payment:wxPay:".concat(order.getTenantId().toString());
|
||||
final Payment payment = redisUtil.get(key, Payment.class);
|
||||
|
||||
final JSONObject mpWx = settingService.getBySettingKey("mp-weixin");
|
||||
|
||||
// 计算金额
|
||||
BigDecimal decimal = order.getTotalPrice();
|
||||
final BigDecimal multiply = decimal.multiply(new BigDecimal(100));
|
||||
// 将 BigDecimal 转换为 Integer
|
||||
Integer money = multiply.intValue();
|
||||
String privateKey = uploadPath.concat("/file").concat(payment.getApiclientKey()); // 秘钥证书
|
||||
String apiclientCert = uploadPath.concat("/file").concat(payment.getApiclientCert());
|
||||
// 开发环境配置
|
||||
if(active.equals("dev")){
|
||||
privateKey = privateKeyPath;
|
||||
apiclientCert = wechatpayCertPath;
|
||||
}
|
||||
Config config =
|
||||
new RSAConfig.Builder()
|
||||
.merchantId(payment.getMchId())
|
||||
.privateKeyFromPath(privateKey)
|
||||
.merchantSerialNumber(payment.getMerchantSerialNumber())
|
||||
.wechatPayCertificatesFromPath(apiclientCert)
|
||||
.build();
|
||||
|
||||
// 构建service
|
||||
JsapiServiceExtension service = new JsapiServiceExtension.Builder().config(config).build();
|
||||
// 跟之前下单示例一样,填充预下单参数
|
||||
PrepayRequest request = new PrepayRequest();
|
||||
Amount amount = new Amount();
|
||||
amount.setTotal(money);
|
||||
amount.setCurrency("CNY");
|
||||
request.setAmount(amount);
|
||||
request.setAppid(mpWx.getString("appId"));
|
||||
request.setMchid(payment.getMchId());
|
||||
request.setDescription(order.getComments());
|
||||
request.setNotifyUrl("https://server.gxwebsoft.com/api/system/wx-pay/notify/" + order.getTenantId());
|
||||
request.setOutTradeNo(order.getOrderNo());
|
||||
request.setAttach(order.getTenantId().toString());
|
||||
final Payer payer = new Payer();
|
||||
payer.setOpenid(order.getOpenid());
|
||||
request.setPayer(payer);
|
||||
if (StrUtil.isNotBlank(payment.getNotifyUrl())) {
|
||||
request.setNotifyUrl(payment.getNotifyUrl().concat("/").concat(order.getTenantId().toString()));
|
||||
}
|
||||
// 测试金额
|
||||
if(active.equals("dev")){
|
||||
amount.setTotal(1);
|
||||
request.setAmount(amount);
|
||||
}
|
||||
System.out.println("request = " + request);
|
||||
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
|
||||
orderInfo.put("provider", "wxpay");
|
||||
orderInfo.put("timeStamp", response.getTimeStamp());
|
||||
orderInfo.put("nonceStr", response.getNonceStr());
|
||||
orderInfo.put("package", response.getPackageVal());
|
||||
orderInfo.put("signType", "RSA");
|
||||
orderInfo.put("paySign", response.getPaySign());
|
||||
return orderInfo;
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.PaymentMapper;
|
||||
import com.gxwebsoft.common.system.service.PaymentService;
|
||||
import com.gxwebsoft.common.system.entity.Payment;
|
||||
import com.gxwebsoft.common.system.param.PaymentParam;
|
||||
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 2024-05-11 12:39:11
|
||||
*/
|
||||
@Service
|
||||
public class PaymentServiceImpl extends ServiceImpl<PaymentMapper, Payment> implements PaymentService {
|
||||
|
||||
@Override
|
||||
public PageResult<Payment> pageRel(PaymentParam param) {
|
||||
PageParam<Payment, PaymentParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<Payment> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Payment> listRel(PaymentParam param) {
|
||||
List<Payment> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Payment, PaymentParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Payment getByIdRel(Integer id) {
|
||||
PaymentParam param = new PaymentParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.PlugMapper;
|
||||
import com.gxwebsoft.common.system.service.PlugService;
|
||||
import com.gxwebsoft.common.system.entity.Plug;
|
||||
import com.gxwebsoft.common.system.param.PlugParam;
|
||||
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-10-12 09:53:07
|
||||
*/
|
||||
@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 plugId) {
|
||||
PlugParam param = new PlugParam();
|
||||
param.setPlugId(plugId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.RechargeOrder;
|
||||
import com.gxwebsoft.common.system.mapper.RechargeOrderMapper;
|
||||
import com.gxwebsoft.common.system.param.RechargeOrderParam;
|
||||
import com.gxwebsoft.common.system.service.RechargeOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员充值订单表Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-26 23:18:48
|
||||
*/
|
||||
@Service
|
||||
public class RechargeOrderServiceImpl extends ServiceImpl<RechargeOrderMapper, RechargeOrder> implements RechargeOrderService {
|
||||
|
||||
@Override
|
||||
public PageResult<RechargeOrder> pageRel(RechargeOrderParam param) {
|
||||
PageParam<RechargeOrder, RechargeOrderParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<RechargeOrder> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeOrder> listRel(RechargeOrderParam param) {
|
||||
List<RechargeOrder> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<RechargeOrder, RechargeOrderParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RechargeOrder getByIdRel(Integer orderId) {
|
||||
RechargeOrderParam param = new RechargeOrderParam();
|
||||
param.setOrderId(orderId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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.param.RoleParam;
|
||||
import com.gxwebsoft.common.system.service.RoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色服务实现类
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2018-12-24 16:10:11
|
||||
*/
|
||||
@Service
|
||||
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
|
||||
|
||||
@Override
|
||||
public Role getByRoleCode(RoleParam roleParam) {
|
||||
final List<Role> roleList = baseMapper.selectListAll(roleParam);
|
||||
return roleList.get(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Setting;
|
||||
import com.gxwebsoft.common.system.mapper.SettingMapper;
|
||||
import com.gxwebsoft.common.system.param.SettingParam;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.RSAConfig;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiService;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 系统设置Service实现
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2022-11-19 13:54:27
|
||||
*/
|
||||
@Service
|
||||
public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> implements SettingService {
|
||||
// 本地缓存
|
||||
public static Map<String, Config> configMap = new HashMap<>();
|
||||
public static JsapiService service = null;
|
||||
public static Config config = null;
|
||||
@Resource
|
||||
private ConfigProperties pathConfig;
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@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);
|
||||
if(setting == null){
|
||||
if ("mp-weixin".equals(key)) {
|
||||
throw new BusinessException("小程序未配置");
|
||||
}
|
||||
if ("payment".equals(key)) {
|
||||
throw new BusinessException("支付未配置");
|
||||
}
|
||||
if ("sms".equals(key)) {
|
||||
throw new BusinessException("短信未配置");
|
||||
}
|
||||
if ("wx-work".equals(key)){
|
||||
throw new BusinessException("企业微信未配置");
|
||||
}
|
||||
if ("setting".equals(key)) {
|
||||
throw new BusinessException("基本信息未配置");
|
||||
}
|
||||
if ("wx-official".equals(key)) {
|
||||
throw new BusinessException("微信公众号未配置");
|
||||
}
|
||||
if ("printer".equals(key)) {
|
||||
throw new BusinessException("打印机未配置");
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initConfig(Setting data) {
|
||||
if (data.getSettingKey().equals("payment")) {
|
||||
final JSONObject jsonObject = JSONObject.parseObject(data.getContent());
|
||||
final String mchId = jsonObject.getString("mchId");
|
||||
final String apiclientKey = jsonObject.getString("apiclientKey");
|
||||
final String privateKey = pathConfig.getUploadPath().concat("file").concat(apiclientKey);
|
||||
final String apiclientCert = pathConfig.getUploadPath().concat("file").concat(jsonObject.getString("apiclientCert"));
|
||||
final String merchantSerialNumber = jsonObject.getString("merchantSerialNumber");
|
||||
final String apiV3key = jsonObject.getString("wechatApiKey");
|
||||
if(config == null){
|
||||
// config = new RSAAutoCertificateConfig.Builder()
|
||||
// .merchantId(mchId)
|
||||
// .privateKeyFromPath("/Users/gxwebsoft/Documents/uploads/file/20230622/fb193d3bfff0467b83dc498435a4f433.pem")
|
||||
// .merchantSerialNumber(merchantSerialNumber)
|
||||
// .apiV3Key(apiV3key)
|
||||
// .build();
|
||||
config =
|
||||
new RSAConfig.Builder()
|
||||
.merchantId("1246610101")
|
||||
.privateKeyFromPath("/Users/gxwebsoft/Documents/uploads/file/20230622/fb193d3bfff0467b83dc498435a4f433.pem")
|
||||
.merchantSerialNumber("2903B872D5CA36E525FAEC37AEDB22E54ECDE7B7")
|
||||
.wechatPayCertificatesFromPath("/Users/gxwebsoft/Documents/uploads/file/20230622/23329e924dae41af9b716825626dd44b.pem")
|
||||
.build();
|
||||
configMap.put(data.getTenantId().toString(),config);
|
||||
System.out.println("config = " + config);
|
||||
}
|
||||
if (service == null) {
|
||||
service = new JsapiService.Builder().config(config).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Config getConfig(Integer tenantId) {
|
||||
if(configMap.get(tenantId.toString()) == null){
|
||||
final Setting payment = getOne(new LambdaQueryWrapper<Setting>().eq(Setting::getSettingKey, "payment"));
|
||||
this.initConfig(payment);
|
||||
return configMap.get(tenantId.toString());
|
||||
}
|
||||
return configMap.get(tenantId.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getUploadConfig(Integer tenantId) {
|
||||
// 读取配置信息
|
||||
JSONObject settingInfo;
|
||||
String key3 = "Upload:" + tenantId;
|
||||
settingInfo = redisUtil.get(key3, JSONObject.class);
|
||||
if (settingInfo == null) {
|
||||
settingInfo = getBySettingKey("upload");
|
||||
if(settingInfo == null){
|
||||
return null;
|
||||
}
|
||||
redisUtil.set(key3,settingInfo);
|
||||
}
|
||||
// String endpoint = settingInfo.getString("bucketEndpoint");
|
||||
// String bucketDomain = settingInfo.getString("bucketDomain");
|
||||
// String bucketName = settingInfo.getString("bucketName");
|
||||
// String accessKeyId = settingInfo.getString("accessKeyId");
|
||||
// String accessKeySecret = settingInfo.getString("accessKeySecret");
|
||||
return settingInfo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,648 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.utils.DomainUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.system.entity.*;
|
||||
import com.gxwebsoft.common.system.mapper.TenantMapper;
|
||||
import com.gxwebsoft.common.system.service.*;
|
||||
import com.gxwebsoft.common.system.param.TenantParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 租户Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-17 17:49:53
|
||||
*/
|
||||
@Service
|
||||
public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> implements TenantService {
|
||||
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
@Resource
|
||||
private UserRoleService userRoleService;
|
||||
@Resource
|
||||
private DictService dictService;
|
||||
@Resource
|
||||
private DictDataService dictDataService;
|
||||
@Resource
|
||||
private EmailRecordService emailRecordService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public PageResult<Tenant> pageRel(TenantParam param) {
|
||||
PageParam<Tenant, TenantParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<Tenant> list = baseMapper.selectPageRel(page, param);
|
||||
// if (param.getSceneType() != null && param.getSceneType().equals("plug")) {
|
||||
// final Set<Integer> collectIds = list.stream().map(Tenant::getTenantId).collect(Collectors.toSet());
|
||||
// System.out.println("collectIds = " + collectIds);
|
||||
// final List<Company> companyList = companyService.list(new LambdaUpdateWrapper<Company>().in(Company::getTenantId, collectIds));
|
||||
// System.out.println("companyList = " + companyList);
|
||||
// final Map<Integer, List<Company>> collect = companyList.stream().collect(Collectors.groupingBy(Company::getTenantId));
|
||||
// list.forEach(d -> {
|
||||
// final List<Company> companies = collect.get(d.getTenantId());
|
||||
// if (!CollectionUtils.isEmpty(companies)) {
|
||||
// final Company c1 = companies.get(0);
|
||||
// final Company c2 = new Company();
|
||||
// c2.setCompanyName(c1.getCompanyName());
|
||||
// c2.setShortName(c1.getShortName());
|
||||
// c2.setPhone(DesensitizedUtil.mobilePhone(c1.getPhone()));
|
||||
// d.setCompany(c2);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Tenant> listRel(TenantParam param) {
|
||||
List<Tenant> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Tenant, TenantParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tenant getByIdRel(Integer tenantId) {
|
||||
TenantParam param = new TenantParam();
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Company initialization(Company company) {
|
||||
// 添加默认字典
|
||||
Dict dict = new Dict();
|
||||
dict.setDictName("性别");
|
||||
dict.setDictCode("sex");
|
||||
dict.setTenantId(company.getTid());
|
||||
dictService.save(dict);
|
||||
DictData dictData = new DictData();
|
||||
dictData.setDictId(dict.getDictId());
|
||||
dictData.setDictDataName("男");
|
||||
dictData.setDictDataCode("1");
|
||||
dictData.setSortNumber(100);
|
||||
dictData.setTenantId(company.getTid());
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("女");
|
||||
dictData.setDictDataCode("2");
|
||||
dictData.setTenantId(company.getTid());
|
||||
dictDataService.save(dictData);
|
||||
dict.setDictName("机构类型");
|
||||
dict.setDictCode("organizationType");
|
||||
dict.setTenantId(company.getTid());
|
||||
dictService.save(dict);
|
||||
dictData.setDictId(dict.getDictId());
|
||||
dictData.setDictDataName("公司");
|
||||
dictData.setDictDataCode("1");
|
||||
dictData.setTenantId(company.getTid());
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictId(dict.getDictId());
|
||||
dictData.setDictDataName("部门");
|
||||
dictData.setDictDataCode("2");
|
||||
dictData.setTenantId(company.getTid());
|
||||
dictDataService.save(dictData);
|
||||
|
||||
// 添加超级管理员
|
||||
User admin = new User();
|
||||
admin.setUsername("admin");
|
||||
admin.setNickname("超级管理员");
|
||||
admin.setPhone(company.getPhone());
|
||||
admin.setEmail(company.getEmail());
|
||||
admin.setIsAdmin(true);
|
||||
admin.setRealName(company.getBusinessEntity());
|
||||
admin.setCompanyName(company.getShortName());
|
||||
admin.setPassword(userService.encodePassword(company.getPassword()));
|
||||
admin.setTenantId(company.getTid());
|
||||
boolean result = userService.save(admin);
|
||||
Integer superAdminUserId = admin.getUserId();
|
||||
|
||||
// 企业资源配置
|
||||
company.setTenantId(company.getTid());
|
||||
company.setShortName(company.getShortName());
|
||||
company.setPhone(company.getPhone());
|
||||
company.setMembers(20);
|
||||
company.setServerUrl("https://server.gxwebsoft.com");
|
||||
company.setModulesUrl("https://modules.gxwebsoft.com");
|
||||
company.setSocketUrl("wss://server.gxwebsoft.com");
|
||||
company.setAdminUrl(DomainUtil.getAdminUrl(company.getTid().toString()));
|
||||
company.setWebsiteUrl(DomainUtil.getSiteUrl(company.getTid().toString()));
|
||||
// company.setH5Code("https://".concat("websoft.top"));
|
||||
// company.setAndroidUrl("http://".concat(company.getTid().toString()).concat(".android.wsdns.cn"));
|
||||
// company.setIosUrl("http://".concat(company.getTid().toString()).concat(".ios.wsdns.cn"));
|
||||
company.setVersion(10);
|
||||
company.setIndustryParent("");
|
||||
company.setIndustryChild("");
|
||||
company.setDepartments(10);
|
||||
company.setDepartments(10);
|
||||
company.setStorageMax(524288000L);
|
||||
company.setAuthoritative(true);
|
||||
company.setUsers(2);
|
||||
company.setClicks(1L);
|
||||
company.setLikes(0L);
|
||||
company.setTid(company.getTid());
|
||||
company.setCompanyType("企业");
|
||||
company.setEmail(company.getEmail());
|
||||
company.setUserId(admin.getUserId());
|
||||
company.setExpirationTime(DateUtil.nextMonth());
|
||||
companyService.save(company);
|
||||
|
||||
// 创建角色
|
||||
if (result) {
|
||||
Role role = new Role();
|
||||
role.setRoleName("超级管理员");
|
||||
role.setRoleCode("superAdmin");
|
||||
role.setComments("超级管理员");
|
||||
role.setTenantId(company.getTid());
|
||||
roleService.save(role);
|
||||
|
||||
// 保存超级管理员角色ID
|
||||
Integer superAdminRoleId = role.getRoleId();
|
||||
role.setRoleName("注册用户");
|
||||
role.setRoleCode("user");
|
||||
role.setComments("普通注册用户");
|
||||
roleService.save(role);
|
||||
// role.setRoleName("游客");
|
||||
// role.setRoleCode("guest");
|
||||
// role.setComments("用于未登录时的浏览权限");
|
||||
// roleService.save(role);
|
||||
role.setRoleName("商户管理员");
|
||||
role.setRoleCode("merchant");
|
||||
role.setComments("商户管理员/店长角色");
|
||||
roleService.save(role);
|
||||
role.setRoleName("商户账号");
|
||||
role.setRoleCode("merchantClerk");
|
||||
role.setRoleName("管理人员/店员");
|
||||
Integer guestRoleId = role.getRoleId();
|
||||
|
||||
// 添加游客账号
|
||||
// User www = new User();
|
||||
// www.setTenantId(company.getTid());
|
||||
// www.setUsername("www");
|
||||
// www.setNickname("游客");
|
||||
// www.setPassword(userService.encodePassword(CommonUtil.randomUUID16()));
|
||||
// userService.save(www);
|
||||
|
||||
// 添加超管用户角色
|
||||
UserRole userRole = new UserRole();
|
||||
userRole.setUserId(superAdminUserId);
|
||||
userRole.setRoleId(superAdminRoleId);
|
||||
userRole.setTenantId(company.getTid());
|
||||
boolean resultUserRole = userRoleService.save(userRole);
|
||||
|
||||
// 添加游客用户角色
|
||||
// userRole.setUserId(www.getUserId());
|
||||
// userRole.setRoleId(guestRoleId);
|
||||
// boolean resultUserRole = userRoleService.save(userRole);
|
||||
|
||||
// 添加系统菜单
|
||||
if (resultUserRole) {
|
||||
Menu menu = new Menu();
|
||||
menu.setMenuType(0);
|
||||
menu.setParentId(0);
|
||||
menu.setHide(1);
|
||||
menu.setTitle("扩展插件");
|
||||
menu.setPath("/system/plug");
|
||||
menu.setComponent("/system/plug");
|
||||
menu.setIcon("AppstoreAddOutlined");
|
||||
menu.setAuthority("sys:plug:list");
|
||||
menu.setSortNumber(0);
|
||||
menu.setTenantId(company.getTid());
|
||||
menuService.save(menu);
|
||||
// 10.系统管理
|
||||
menu.setTitle("系统管理");
|
||||
menu.setParentId(0);
|
||||
menu.setPath("/system");
|
||||
menu.setIcon("setting-outlined");
|
||||
menu.setSortNumber(999);
|
||||
menu.setHide(1);
|
||||
menu.setTenantId(company.getTid());
|
||||
menuService.save(menu);
|
||||
Integer parentId = menu.getMenuId();
|
||||
menu.setParentId(menu.getMenuId());
|
||||
menu.setTitle("企业信息");
|
||||
menu.setPath("/system/profile");
|
||||
menu.setComponent("/system/profile");
|
||||
menu.setIcon("AuditOutlined");
|
||||
menu.setAuthority("sys:company:profile");
|
||||
menu.setSortNumber(1);
|
||||
menu.setHide(0);
|
||||
menuService.save(menu);
|
||||
menu.setTitle("用户管理");
|
||||
menu.setPath("/system/user");
|
||||
menu.setComponent("/system/user");
|
||||
menu.setIcon("team-outlined");
|
||||
menu.setSortNumber(4);
|
||||
menuService.save(menu);
|
||||
Integer userParentId = menu.getMenuId();
|
||||
menu.setParentId(userParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setTitle("查询");
|
||||
menu.setIcon("");
|
||||
menu.setAuthority("sys:user:list");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(userParentId);
|
||||
menu.setTitle("添加");
|
||||
menu.setAuthority("sys:user:save");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(userParentId);
|
||||
menu.setTitle("修改");
|
||||
menu.setAuthority("sys:user:update");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(userParentId);
|
||||
menu.setTitle("删除");
|
||||
menu.setAuthority("sys:user:remove");
|
||||
menuService.save(menu);
|
||||
menu.setMenuType(0);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("部门管理");
|
||||
menu.setPath("/system/organization");
|
||||
menu.setComponent("/system/organization");
|
||||
menu.setIcon("bank-outlined");
|
||||
menu.setAuthority("");
|
||||
menu.setSortNumber(2);
|
||||
menuService.save(menu);
|
||||
Integer orgParentId = menu.getMenuId();
|
||||
menu.setParentId(orgParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menu.setIcon("");
|
||||
menu.setTitle("查询");
|
||||
menu.setAuthority("sys:org:list");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(orgParentId);
|
||||
menu.setTitle("添加");
|
||||
menu.setAuthority("sys:org:save");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(orgParentId);
|
||||
menu.setTitle("修改");
|
||||
menu.setAuthority("sys:org:update");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(orgParentId);
|
||||
menu.setTitle("删除");
|
||||
menu.setAuthority("sys:org:remove");
|
||||
menuService.save(menu);
|
||||
menu.setMenuType(0);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("角色管理");
|
||||
menu.setPath("/system/role");
|
||||
menu.setComponent("/system/role");
|
||||
menu.setIcon("idcard-outlined");
|
||||
menu.setAuthority("");
|
||||
menu.setSortNumber(5);
|
||||
menuService.save(menu);
|
||||
Integer roleParentId = menu.getMenuId();
|
||||
menu.setParentId(roleParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setIcon("");
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menu.setTitle("查询");
|
||||
menu.setAuthority("sys:role:list");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(roleParentId);
|
||||
menu.setTitle("添加");
|
||||
menu.setAuthority("sys:role:save");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(roleParentId);
|
||||
menu.setTitle("修改");
|
||||
menu.setAuthority("sys:role:update");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(roleParentId);
|
||||
menu.setTitle("删除");
|
||||
menu.setAuthority("sys:role:remove");
|
||||
menuService.save(menu);
|
||||
menu.setMenuType(0);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("菜单管理");
|
||||
menu.setPath("/system/menu");
|
||||
menu.setComponent("/system/menu");
|
||||
menu.setIcon("appstore-outlined");
|
||||
menu.setAuthority("");
|
||||
menu.setSortNumber(3);
|
||||
menuService.save(menu);
|
||||
Integer menuParentId = menu.getMenuId();
|
||||
menu.setParentId(menuParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setTitle("查询");
|
||||
menu.setAuthority("sys:menu:list");
|
||||
menu.setIcon("");
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(menuParentId);
|
||||
menu.setTitle("添加");
|
||||
menu.setAuthority("sys:menu:save");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(menuParentId);
|
||||
menu.setTitle("修改");
|
||||
menu.setAuthority("sys:menu:update");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(menuParentId);
|
||||
menu.setTitle("删除");
|
||||
menu.setAuthority("sys:menu:remove");
|
||||
menuService.save(menu);
|
||||
menu.setMenuType(0);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("字典管理");
|
||||
menu.setPath("/system/dict");
|
||||
menu.setComponent("/system/dict");
|
||||
menu.setIcon("profile-outlined");
|
||||
menu.setAuthority("");
|
||||
menu.setSortNumber(6);
|
||||
menuService.save(menu);
|
||||
Integer dictParentId = menu.getMenuId();
|
||||
menu.setParentId(dictParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setTitle("查询");
|
||||
menu.setAuthority("sys:dict:list");
|
||||
menu.setIcon("");
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(dictParentId);
|
||||
menu.setTitle("添加");
|
||||
menu.setAuthority("sys:dict:save");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(dictParentId);
|
||||
menu.setTitle("修改");
|
||||
menu.setAuthority("sys:dict:update");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(dictParentId);
|
||||
menu.setTitle("删除");
|
||||
menu.setAuthority("sys:dict:remove");
|
||||
menuService.save(menu);
|
||||
menu.setMenuType(0);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("登录日志");
|
||||
menu.setPath("/system/login-record");
|
||||
menu.setComponent("/system/login-record");
|
||||
menu.setIcon("calendar-outlined");
|
||||
menu.setAuthority("sys:login-record:list");
|
||||
menu.setSortNumber(7);
|
||||
menuService.save(menu);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("模块管理");
|
||||
menu.setPath("/system/modules");
|
||||
menu.setComponent("/system/modules");
|
||||
menu.setIcon("KeyOutlined");
|
||||
menu.setAuthority("sys:modules:list");
|
||||
menu.setSortNumber(7);
|
||||
menuService.save(menu);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("秘钥管理");
|
||||
menu.setPath("/system/access-key");
|
||||
menu.setComponent("/system/access-key");
|
||||
menu.setIcon("KeyOutlined");
|
||||
menu.setAuthority("sys:accessKey:list");
|
||||
menu.setSortNumber(8);
|
||||
menuService.save(menu);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("文件管理");
|
||||
menu.setPath("/system/file");
|
||||
menu.setComponent("/system/file");
|
||||
menu.setIcon("folder-outlined");
|
||||
menu.setAuthority("");
|
||||
menu.setSortNumber(6);
|
||||
menuService.save(menu);
|
||||
Integer fileParentId = menu.getMenuId();
|
||||
menu.setParentId(fileParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setTitle("查看记录");
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menu.setIcon("");
|
||||
menu.setAuthority("sys:file:list");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(fileParentId);
|
||||
menu.setTitle("上传文件");
|
||||
menu.setAuthority("sys:file:upload");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(fileParentId);
|
||||
menu.setTitle("修改文件");
|
||||
menu.setAuthority("sys:file:update");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(fileParentId);
|
||||
menu.setTitle("删除文件");
|
||||
menu.setAuthority("sys:org:remove");
|
||||
menuService.save(menu);
|
||||
menu.setMenuType(0);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("扩展插件");
|
||||
menu.setPath("/system/plug");
|
||||
menu.setComponent("/system/plug");
|
||||
menu.setIcon("AppstoreAddOutlined");
|
||||
menu.setAuthority("sys:plug:list");
|
||||
menu.setSortNumber(9);
|
||||
menuService.save(menu);
|
||||
Integer plugParentId = menu.getMenuId();
|
||||
menu.setParentId(plugParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setTitle("查询");
|
||||
menu.setAuthority("sys:dict:list");
|
||||
menu.setIcon("");
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(plugParentId);
|
||||
menu.setTitle("发布插件");
|
||||
menu.setAuthority("sys:plug:save");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(plugParentId);
|
||||
menu.setTitle("更新插件");
|
||||
menu.setAuthority("sys:plug:update");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(plugParentId);
|
||||
menu.setTitle("删除插件");
|
||||
menu.setAuthority("sys:plus:remove");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(plugParentId);
|
||||
menu.setTitle("安装插件");
|
||||
menu.setAuthority("sys:plug:save");
|
||||
menuService.save(menu);
|
||||
menu.setMenuType(0);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("系统设置");
|
||||
menu.setPath("/system/setting");
|
||||
menu.setComponent("/system/setting");
|
||||
menu.setIcon("setting-outlined");
|
||||
menu.setAuthority("sys:setting:save");
|
||||
menu.setSortNumber(10);
|
||||
menuService.save(menu);
|
||||
menu.setParentId(parentId);
|
||||
menu.setTitle("用户信息");
|
||||
menu.setPath("/system/user-info");
|
||||
menu.setComponent("/system/user-info");
|
||||
menu.setIcon("team-outlined");
|
||||
menu.setAuthority("");
|
||||
menu.setHide(1);
|
||||
menu.setMenuType(0);
|
||||
menu.setSortNumber(9);
|
||||
menuService.save(menu);
|
||||
Integer userInfoParentId = menu.getMenuId();
|
||||
menu.setParentId(userInfoParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setTitle("修改个人密码");
|
||||
menu.setAuthority("sys:auth:password");
|
||||
menu.setIcon("");
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(userInfoParentId);
|
||||
menu.setTitle("修改个人资料");
|
||||
menu.setAuthority("sys:auth:user");
|
||||
menuService.save(menu);
|
||||
// 1.控制台
|
||||
// menu.setParentId(0);
|
||||
// menu.setTitle("管理首页");
|
||||
// menu.setPath("/dashboard");
|
||||
// menu.setIcon("home-outlined");
|
||||
// menu.setComponent("/dashboard/workplace");
|
||||
// menu.setAuthority("");
|
||||
// menu.setSortNumber(1);
|
||||
// menu.setHide(0);
|
||||
// menu.setMenuType(0);
|
||||
// menuService.save(menu);
|
||||
|
||||
// 个人中心
|
||||
menu.setParentId(0);
|
||||
menu.setTitle("个人中心");
|
||||
menu.setPath("/user-center");
|
||||
menu.setIcon("UserOutlined");
|
||||
menu.setComponent("");
|
||||
menu.setAuthority("");
|
||||
menu.setMenuType(0);
|
||||
menu.setHide(1);
|
||||
menu.setSortNumber(999);
|
||||
menuService.save(menu);
|
||||
Integer userCenterParentId = menu.getMenuId();
|
||||
menu.setTitle("个人资料");
|
||||
menu.setPath("/user/profile");
|
||||
menu.setComponent("/user/profile");
|
||||
menu.setIcon("IdcardOutlined");
|
||||
menu.setParentId(userCenterParentId);
|
||||
menu.setMenuType(0);
|
||||
menu.setSortNumber(0);
|
||||
menuService.save(menu);
|
||||
Integer userProfileParentId = menu.getMenuId();
|
||||
menu.setParentId(userProfileParentId);
|
||||
menu.setMenuType(1);
|
||||
menu.setIcon("");
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menu.setTitle("修改资料");
|
||||
menu.setSortNumber(0);
|
||||
menu.setAuthority("sys:auth:user");
|
||||
menuService.save(menu);
|
||||
menu.setTitle("修改密码");
|
||||
menu.setAuthority("sys:auth:password");
|
||||
menuService.save(menu);
|
||||
|
||||
menu.setTitle("上传头像");
|
||||
menu.setAuthority("sys:file:upload");
|
||||
menuService.save(menu);
|
||||
menu.setTitle("预览头像");
|
||||
menu.setAuthority("sys:file:list");
|
||||
menuService.save(menu);
|
||||
menu.setTitle("保存头像");
|
||||
menu.setAuthority("sys:user:update");
|
||||
menuService.save(menu);
|
||||
menu.setTitle("我的消息");
|
||||
menu.setPath("/user/notice");
|
||||
menu.setComponent("/user/notice");
|
||||
menu.setIcon("sound-outlined");
|
||||
menu.setParentId(userCenterParentId);
|
||||
menu.setMenuType(0);
|
||||
menuService.save(menu);
|
||||
Integer userNoticeParentId = menu.getMenuId();
|
||||
menu.setParentId(userNoticeParentId);
|
||||
menu.setTitle("列表");
|
||||
menu.setAuthority("sys:notice:list");
|
||||
menu.setSortNumber(0);
|
||||
menu.setMenuType(1);
|
||||
menu.setIcon("");
|
||||
menu.setPath("");
|
||||
menu.setComponent("");
|
||||
menuService.save(menu);
|
||||
menu.setTitle("添加");
|
||||
menu.setAuthority("sys:notice:save");
|
||||
menuService.save(menu);
|
||||
menu.setTitle("编辑");
|
||||
menu.setAuthority("sys:notice:update");
|
||||
menuService.save(menu);
|
||||
menu.setTitle("删除");
|
||||
menu.setAuthority("sys:notice:remove");
|
||||
menuService.save(menu);
|
||||
menu.setParentId(userCenterParentId);
|
||||
menu.setTitle("用户注册");
|
||||
menu.setAuthority("sys:user:save");
|
||||
menuService.save(menu);
|
||||
menu.setTitle("字典查询");
|
||||
menu.setAuthority("sys:dict:list");
|
||||
|
||||
boolean resultMenu = menuService.save(menu);
|
||||
// 添加菜单ID到超级管理员所属角色ID
|
||||
if (resultMenu) {
|
||||
saveRedis(company);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 发送邮件通知
|
||||
String title = "恭喜!您的应用已创建成功";
|
||||
String appUrl = "\r\n应用地址:" + DomainUtil.getSiteUrl(company.getTid().toString());
|
||||
String appName = "\r\n应用名称:" + company.getShortName();
|
||||
String adminUrl = "\r\n后台管理:" + DomainUtil.getAdminUrl(company.getTid().toString());
|
||||
String account = "\r\n账号:admin";
|
||||
String password = "\r\n密码:" + company.getPassword();
|
||||
String content = title + appUrl + appName + adminUrl + account + password;
|
||||
// 发送邮件通知
|
||||
emailRecordService.sendEmail(title, content, company.getEmail());
|
||||
return company;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 缓存租户信息
|
||||
private void saveRedis(Company tenant) {
|
||||
String key = "tenant:" + tenant.getTenantId();
|
||||
if (StrUtil.isEmpty(tenant.getTenantCode())) {
|
||||
tenant.setTenantCode(CommonUtil.randomUUID16());
|
||||
}
|
||||
redisUtil.set(key, tenant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destructionAll(Integer tenantId){
|
||||
if (baseMapper.destructionAll(tenantId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.UserBalanceLog;
|
||||
import com.gxwebsoft.common.system.mapper.UserBalanceLogMapper;
|
||||
import com.gxwebsoft.common.system.param.UserBalanceLogParam;
|
||||
import com.gxwebsoft.common.system.service.UserBalanceLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户余额变动明细表Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-04-21 15:59:09
|
||||
*/
|
||||
@Service
|
||||
public class UserBalanceLogServiceImpl extends ServiceImpl<UserBalanceLogMapper, UserBalanceLog> implements UserBalanceLogService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserBalanceLog> pageRel(UserBalanceLogParam param) {
|
||||
PageParam<UserBalanceLog, UserBalanceLogParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<UserBalanceLog> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserBalanceLog> listRel(UserBalanceLogParam param) {
|
||||
List<UserBalanceLog> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<UserBalanceLog, UserBalanceLogParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserBalanceLog getByIdRel(Integer logId) {
|
||||
UserBalanceLogParam param = new UserBalanceLogParam();
|
||||
param.setLogId(logId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.UserCollectionMapper;
|
||||
import com.gxwebsoft.common.system.service.UserCollectionService;
|
||||
import com.gxwebsoft.common.system.entity.UserCollection;
|
||||
import com.gxwebsoft.common.system.param.UserCollectionParam;
|
||||
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 2024-04-28 18:08:32
|
||||
*/
|
||||
@Service
|
||||
public class UserCollectionServiceImpl extends ServiceImpl<UserCollectionMapper, UserCollection> implements UserCollectionService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserCollection> pageRel(UserCollectionParam param) {
|
||||
PageParam<UserCollection, UserCollectionParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<UserCollection> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserCollection> listRel(UserCollectionParam param) {
|
||||
List<UserCollection> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<UserCollection, UserCollectionParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserCollection getByIdRel(Integer id) {
|
||||
UserCollectionParam param = new UserCollectionParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -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.UserGradeMapper;
|
||||
import com.gxwebsoft.common.system.service.UserGradeService;
|
||||
import com.gxwebsoft.common.system.entity.UserGrade;
|
||||
import com.gxwebsoft.common.system.param.UserGradeParam;
|
||||
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-10-07 22:51:17
|
||||
*/
|
||||
@Service
|
||||
public class UserGradeServiceImpl extends ServiceImpl<UserGradeMapper, UserGrade> implements UserGradeService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserGrade> pageRel(UserGradeParam param) {
|
||||
PageParam<UserGrade, UserGradeParam> page = new PageParam<>(param);
|
||||
// page.setDefaultOrder("create_time desc");
|
||||
List<UserGrade> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserGrade> listRel(UserGradeParam param) {
|
||||
List<UserGrade> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<UserGrade, UserGradeParam> page = new PageParam<>();
|
||||
// page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserGrade getByIdRel(Integer gradeId) {
|
||||
UserGradeParam param = new UserGradeParam();
|
||||
param.setGradeId(gradeId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.UserGroupMapper;
|
||||
import com.gxwebsoft.common.system.service.UserGroupService;
|
||||
import com.gxwebsoft.common.system.entity.UserGroup;
|
||||
import com.gxwebsoft.common.system.param.UserGroupParam;
|
||||
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-10-28 15:16:39
|
||||
*/
|
||||
@Service
|
||||
public class UserGroupServiceImpl extends ServiceImpl<UserGroupMapper, UserGroup> implements UserGroupService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserGroup> pageRel(UserGroupParam param) {
|
||||
PageParam<UserGroup, UserGroupParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<UserGroup> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserGroup> listRel(UserGroupParam param) {
|
||||
List<UserGroup> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<UserGroup, UserGroupParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserGroup getByIdRel(Integer groupId) {
|
||||
UserGroupParam param = new UserGroupParam();
|
||||
param.setGroupId(groupId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.UserOauthMapper;
|
||||
import com.gxwebsoft.common.system.service.UserOauthService;
|
||||
import com.gxwebsoft.common.system.entity.UserOauth;
|
||||
import com.gxwebsoft.common.system.param.UserOauthParam;
|
||||
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-10-07 22:39:46
|
||||
*/
|
||||
@Service
|
||||
public class UserOauthServiceImpl extends ServiceImpl<UserOauthMapper, UserOauth> implements UserOauthService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserOauth> pageRel(UserOauthParam param) {
|
||||
PageParam<UserOauth, UserOauthParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<UserOauth> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserOauth> listRel(UserOauthParam param) {
|
||||
List<UserOauth> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<UserOauth, UserOauthParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserOauth getByIdRel(Integer id) {
|
||||
UserOauthParam param = new UserOauthParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.UserRefereeMapper;
|
||||
import com.gxwebsoft.common.system.service.UserRefereeService;
|
||||
import com.gxwebsoft.common.system.entity.UserReferee;
|
||||
import com.gxwebsoft.common.system.param.UserRefereeParam;
|
||||
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-10-07 22:56:36
|
||||
*/
|
||||
@Service
|
||||
public class UserRefereeServiceImpl extends ServiceImpl<UserRefereeMapper, UserReferee> implements UserRefereeService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserReferee> pageRel(UserRefereeParam param) {
|
||||
PageParam<UserReferee, UserRefereeParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<UserReferee> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserReferee> listRel(UserRefereeParam param) {
|
||||
List<UserReferee> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<UserReferee, UserRefereeParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserReferee getByIdRel(Integer id) {
|
||||
UserRefereeParam param = new UserRefereeParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.CommonUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
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.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.*;
|
||||
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.PlatformConstants.MP_WEIXIN;
|
||||
import static com.gxwebsoft.common.core.constants.PlatformConstants.WEB;
|
||||
|
||||
/**
|
||||
* 用户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 RoleService roleService;
|
||||
@Resource
|
||||
private RoleMenuService roleMenuService;
|
||||
@Resource
|
||||
private BCryptPasswordEncoder bCryptPasswordEncoder;
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public PageResult<User> pageRel(UserParam param) {
|
||||
PageParam<User, UserParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("user_id desc,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("user_id desc,create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@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));
|
||||
// // 系统配置信息
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// // 1)云存储
|
||||
// String key = "setting:upload:" + user.getTenantId();
|
||||
// final String upload = redisUtil.get(key);
|
||||
// if(upload != null){
|
||||
// final JSONObject object = JSONObject.parseObject(upload);
|
||||
// map.put("uploadMethod",object.getString("uploadMethod"));
|
||||
// map.put("bucketDomain",object.getString("bucketDomain"));
|
||||
// map.put("fileUrl",object.getString("fileUrl") + "/");
|
||||
// user.setSystem(map);
|
||||
// }
|
||||
// 企业信息
|
||||
// final Company company = companyService.getByTenantIdRel(user.getTenantId());
|
||||
// if (company != null) {
|
||||
// user.setCompanyId(company.getCompanyId());
|
||||
// user.setCompanyInfo(company);
|
||||
// }
|
||||
}
|
||||
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 user 用户信息
|
||||
*/
|
||||
@Override
|
||||
public void updateByUserId(User user) {
|
||||
baseMapper.updateByUserId(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User addUser(UserParam userParam) {
|
||||
User addUser = new User();
|
||||
// 注册用户
|
||||
addUser.setStatus(0);
|
||||
addUser.setUsername(userParam.getPhone());
|
||||
addUser.setNickname(DesensitizedUtil.mobilePhone(userParam.getPhone()));
|
||||
addUser.setPlatform(WEB);
|
||||
addUser.setGradeId(2);
|
||||
if(userParam.getPhone() != null){
|
||||
addUser.setPhone(userParam.getPhone());
|
||||
}
|
||||
addUser.setPassword(encodePassword(CommonUtil.randomUUID16()));
|
||||
addUser.setTenantId(userParam.getTenantId());
|
||||
addUser.setRecommend(0);
|
||||
Role role = roleService.getOne(new QueryWrapper<Role>().eq("role_code", "user"), false);
|
||||
addUser.setRoleId(role.getRoleId());
|
||||
if (saveUser(addUser)) {
|
||||
// 添加用户角色
|
||||
final UserRole userRole = new UserRole();
|
||||
userRole.setUserId(addUser.getUserId());
|
||||
userRole.setTenantId(addUser.getTenantId());
|
||||
userRole.setRoleId(addUser.getRoleId());
|
||||
userRoleService.save(userRole);
|
||||
}
|
||||
return addUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询用户的角色
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.VersionMapper;
|
||||
import com.gxwebsoft.common.system.service.VersionService;
|
||||
import com.gxwebsoft.common.system.entity.Version;
|
||||
import com.gxwebsoft.common.system.param.VersionParam;
|
||||
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 2024-01-15 18:52:24
|
||||
*/
|
||||
@Service
|
||||
public class VersionServiceImpl extends ServiceImpl<VersionMapper, Version> implements VersionService {
|
||||
|
||||
@Override
|
||||
public PageResult<Version> pageRel(VersionParam param) {
|
||||
PageParam<Version, VersionParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Version> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Version> listRel(VersionParam param) {
|
||||
List<Version> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Version, VersionParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Version getByIdRel(Integer id) {
|
||||
VersionParam param = new VersionParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.WhiteDomainMapper;
|
||||
import com.gxwebsoft.common.system.service.WhiteDomainService;
|
||||
import com.gxwebsoft.common.system.entity.WhiteDomain;
|
||||
import com.gxwebsoft.common.system.param.WhiteDomainParam;
|
||||
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 2024-03-26 00:22:21
|
||||
*/
|
||||
@Service
|
||||
public class WhiteDomainServiceImpl extends ServiceImpl<WhiteDomainMapper, WhiteDomain> implements WhiteDomainService {
|
||||
|
||||
@Override
|
||||
public PageResult<WhiteDomain> pageRel(WhiteDomainParam param) {
|
||||
PageParam<WhiteDomain, WhiteDomainParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<WhiteDomain> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WhiteDomain> listRel(WhiteDomainParam param) {
|
||||
List<WhiteDomain> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<WhiteDomain, WhiteDomainParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WhiteDomain getByIdRel(Integer id) {
|
||||
WhiteDomainParam param = new WhiteDomainParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user