org.openea.eap.module.system.service.language.I18nJsonDataServiceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eap-module-system-biz Show documentation
Show all versions of eap-module-system-biz Show documentation
system 模块下,我们放通用业务,支撑上层的核心业务。
例如说:用户、部门、权限、数据字典等等
The newest version!
package org.openea.eap.module.system.service.language;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.json.JSONObject;
import org.openea.eap.framework.common.pojo.PageResult;
import org.openea.eap.module.system.controller.admin.language.vo.I18nJsonDataCreateReqVO;
import org.openea.eap.module.system.controller.admin.language.vo.I18nJsonDataExportReqVO;
import org.openea.eap.module.system.controller.admin.language.vo.I18nJsonDataPageReqVO;
import org.openea.eap.module.system.controller.admin.language.vo.I18nJsonDataUpdateReqVO;
import org.openea.eap.module.system.convert.language.I18nJsonDataConvert;
import org.openea.eap.module.system.dal.dataobject.language.I18nJsonDataDO;
import org.openea.eap.module.system.dal.mysql.language.I18nJsonDataMapper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.openea.eap.framework.common.exception.util.ServiceExceptionUtil.exception;
import static org.openea.eap.module.system.enums.ErrorCodeConstants.I18N_JSON_DATA_NOT_EXISTS;
/**
* 翻译 Service 实现类
*
* @author eap
*/
@Service
@Validated
public class I18nJsonDataServiceImpl implements I18nJsonDataService {
@Resource
private I18nJsonDataMapper i18nJsonDataMapper;
@Override
public Long createI18nJsonData(I18nJsonDataCreateReqVO createReqVO) {
// 插入
I18nJsonDataDO i18nJsonData = I18nJsonDataConvert.INSTANCE.convert(createReqVO);
i18nJsonDataMapper.insert(i18nJsonData);
// 返回
return i18nJsonData.getId();
}
@Override
public void updateI18nJsonData(I18nJsonDataUpdateReqVO updateReqVO) {
// 校验存在
validateI18nJsonDataExists(updateReqVO.getId());
// 更新
I18nJsonDataDO updateObj = I18nJsonDataConvert.INSTANCE.convert(updateReqVO);
i18nJsonDataMapper.updateById(updateObj);
}
@Override
public void deleteI18nJsonData(Long id) {
// 校验存在
validateI18nJsonDataExists(id);
// 删除
i18nJsonDataMapper.deleteById(id);
}
private void validateI18nJsonDataExists(Long id) {
if (i18nJsonDataMapper.selectById(id) == null) {
throw exception(I18N_JSON_DATA_NOT_EXISTS);
}
}
@Override
public I18nJsonDataDO getI18nJsonData(Long id) {
return i18nJsonDataMapper.selectById(id);
}
@Override
public List getI18nJsonDataList(Collection ids) {
return i18nJsonDataMapper.selectBatchIds(ids);
}
@Override
public PageResult getI18nJsonDataPage(I18nJsonDataPageReqVO pageReqVO) {
return i18nJsonDataMapper.selectPage(pageReqVO);
}
@Override
public List getI18nJsonDataList(I18nJsonDataExportReqVO exportReqVO) {
return i18nJsonDataMapper.selectList(exportReqVO);
}
/**
* 批量添加国际化条目
*
* @param module 模块
* @param itemList map(key, desc, label)
*/
@Async
public void createI18nItemList(String module, List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy