| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.google.common.base.Joiner; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.jeecg.common.desensitization.util.SensitiveInfoUtil; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.system.base.entity.DataVersion; |
| | | import org.jeecg.common.system.base.entity.SysUpload; |
| | | import org.jeecg.common.system.base.entity.SysUploadRela; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.*; |
| | | import org.jeecg.common.util.*; |
| | | import org.jeecg.common.util.dynamic.db.FreemarkerParseFactory; |
| | | import org.jeecg.modules.base.entity.Unit; |
| | | import org.jeecg.modules.base.service.IEnterpriseService; |
| | | import org.jeecg.modules.base.service.IUnitService; |
| | | import org.jeecg.modules.message.entity.SysMessageTemplate; |
| | | import org.jeecg.modules.message.handle.impl.DdSendMsgHandle; |
| | | import org.jeecg.modules.message.handle.impl.EmailSendMsgHandle; |
| | |
| | | import org.jeecg.modules.message.handle.impl.SystemSendMsgHandle; |
| | | import org.jeecg.modules.message.service.ISysMessageTemplateService; |
| | | import org.jeecg.modules.message.websocket.WebSocket; |
| | | import org.jeecg.modules.quartz.entity.QuartzJob; |
| | | import org.jeecg.modules.quartz.service.IQuartzJobService; |
| | | import org.jeecg.modules.system.entity.*; |
| | | import org.jeecg.modules.system.mapper.*; |
| | | import org.jeecg.modules.system.service.*; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.AntPathMatcher; |
| | | import org.springframework.util.PathMatcher; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.sql.DataSource; |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class SysBaseApiImpl implements ISysBaseAPI { |
| | | /** 当前系统数据库类型 */ |
| | | /** |
| | | * 当前系统数据库类型 |
| | | */ |
| | | private static String DB_TYPE = ""; |
| | | |
| | | @Autowired |
| | |
| | | private ISysDataLogService sysDataLogService; |
| | | @Autowired |
| | | private ISysFilesService sysFilesService; |
| | | |
| | | @Autowired |
| | | private IUploadRelaService uploadRelaService; |
| | | |
| | | @Autowired |
| | | private IUploadService uploadService; |
| | | |
| | | @Autowired |
| | | private IDataVersionService dataVersionService; |
| | | |
| | | @Autowired |
| | | private IUnitService unitService; |
| | | @Autowired |
| | | private IEnterpriseService enterpriseService; |
| | | |
| | | |
| | | @Autowired |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Override |
| | | //@SensitiveDecode |
| | |
| | | |
| | | @Override |
| | | public void sendSysAnnouncement(MessageDTO message) { |
| | | this.sendSysAnnouncement(message.getFromUser(), |
| | | message.getToUser(), |
| | | message.getTitle(), |
| | | message.getContent(), |
| | | message.getCategory()); |
| | | this.sendSysAnnouncement(message.getFromUser(), message.getToUser(), message.getTitle(), message.getContent(), message.getCategory()); |
| | | try { |
| | | // 同步发送第三方APP消息 |
| | | wechatEnterpriseService.sendMessage(message, true); |
| | |
| | | |
| | | @Override |
| | | public void sendBusAnnouncement(BusMessageDTO message) { |
| | | sendBusAnnouncement(message.getFromUser(), |
| | | message.getToUser(), |
| | | message.getTitle(), |
| | | message.getContent(), |
| | | message.getCategory(), |
| | | message.getBusType(), |
| | | message.getBusId()); |
| | | sendBusAnnouncement(message.getFromUser(), message.getToUser(), message.getTitle(), message.getContent(), message.getCategory(), message.getBusType(), message.getBusId()); |
| | | try { |
| | | // 同步发送第三方APP消息 |
| | | wechatEnterpriseService.sendMessage(message, true); |
| | |
| | | |
| | | /** |
| | | * 获取数据库类型 |
| | | * |
| | | * @param dataSource |
| | | * @return |
| | | * @throws SQLException |
| | | */ |
| | | @Resource |
| | | private String getDatabaseTypeByDataSource(DataSource dataSource) throws SQLException{ |
| | | if("".equals(DB_TYPE)) { |
| | | Connection connection = dataSource.getConnection(); |
| | |
| | | return json; |
| | | } |
| | | |
| | | @Override |
| | | // @Override |
| | | public List<ComboModel> queryAllRole() { |
| | | List<ComboModel> list = new ArrayList<ComboModel>(); |
| | | List<SysRole> roleList = roleMapper.selectList(new QueryWrapper<SysRole>()); |
| | |
| | | |
| | | /** |
| | | * 推送签到人员信息 |
| | | * |
| | | * @param userId |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 查询用户拥有的角色集合 |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询用户拥有的权限集合 |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 判断online菜单是否有权限 |
| | | * |
| | | * @param onlineAuthDTO |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询用户拥有的角色集合 common api 里面的接口实现 |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询用户拥有的权限集合 common api 里面的接口实现 |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 36根据多个用户账号(逗号分隔),查询返回多个用户信息 |
| | | * |
| | | * @param usernames |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 37根据多个部门编码(逗号分隔),查询返回多个部门信息 |
| | | * |
| | | * @param orgCodes |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 发消息 |
| | | * |
| | | * @param fromUser |
| | | * @param toUser |
| | | * @param title |
| | |
| | | |
| | | /** |
| | | * 发消息 带业务参数 |
| | | * |
| | | * @param fromUser |
| | | * @param toUser |
| | | * @param title |
| | |
| | | |
| | | /** |
| | | * 发送邮件消息 |
| | | * |
| | | * @param email |
| | | * @param title |
| | | * @param content |
| | |
| | | |
| | | /** |
| | | * 获取公司下级部门和所有用户id信息 |
| | | * |
| | | * @param orgCode |
| | | * @return |
| | | */ |
| | |
| | | obj.put(WebsocketConst.MSG_USER_ID, userId); |
| | | webSocket.sendMessage(userId, obj.toJSONString()); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUploadRela> listByBusIdAndBusType(String busId, String busType) { |
| | | return uploadRelaService.listByBusIdAndBusType(busId, busType); |
| | | } |
| | | |
| | | @Override |
| | | public SysUpload getUploadById(String id) { |
| | | return uploadService.getById(id); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveOrUpdateBatchUploadRela(List<SysUploadRela> sysUploadRelaList) { |
| | | return uploadRelaService.saveOrUpdateBatch(sysUploadRelaList); |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateBatchUploadById(List<SysUpload> sysUploadList) { |
| | | return uploadService.updateBatchById(sysUploadList); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUpload> batchUploadFile(String fileType, List<MultipartFile> multipartFileList, String description) throws Exception { |
| | | return uploadService.batchUploadFile(fileType, multipartFileList, description); |
| | | } |
| | | |
| | | @Override |
| | | public void saveOrUpdateUploadRale(String busId, String busType, String uploadId) { |
| | | uploadRelaService.saveOrUpdateUploadRale(busId, busType, uploadId); |
| | | } |
| | | |
| | | @Override |
| | | public void removeDataVersionByBusinessId(String businessId) { |
| | | dataVersionService.removeDataVersionByBusinessId(businessId); |
| | | } |
| | | |
| | | @Override |
| | | public void removeUploadById(String id) { |
| | | uploadService.removeById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void removeUploadRelaById(String id) { |
| | | uploadRelaService.removeById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void delSysUploadRelaByBusIdAndBusType(String busId, String busType) { |
| | | uploadRelaService.delSysUploadRelaByBusIdAndBusType(busId, busType); |
| | | } |
| | | |
| | | @Override |
| | | public String getUnitNameById(String unitId) { |
| | | Unit unit = unitService.getById(unitId); |
| | | String unitName = unit.getName(); |
| | | return unitName; |
| | | } |
| | | |
| | | @Override |
| | | public String queryDictTextByKey(String dictCode, String key) { |
| | | |
| | | return sysDictService.queryDictTextByKey(dictCode, key); |
| | | } |
| | | |
| | | @Override |
| | | public String getVersionStatusByVersionAndBusinessType(Integer version, String businessType) { |
| | | return dataVersionService.getVersionStatusByVersionAndBusinessType(version, businessType); |
| | | } |
| | | |
| | | @Override |
| | | public void saveDataVersion(DataVersion dataVersion) { |
| | | dataVersionService.save(dataVersion); |
| | | } |
| | | |
| | | @Override |
| | | public DataVersion getDataVersionByBusinessId(String id) { |
| | | |
| | | return dataVersionService.getById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void removeDataVersionById(String id) { |
| | | dataVersionService.removeById(id); |
| | | } |
| | | |
| | | /** |
| | | * 根据企业ID获取企业名称 |
| | | * |
| | | * @param enterpriseId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getEnterpriseNameById(String enterpriseId) { |
| | | String enterpriseName = enterpriseService.getById(enterpriseId).getName(); |
| | | return enterpriseName; |
| | | } |
| | | |
| | | @Override |
| | | public List<DataVersion> getLastDataVersion(String businessType, String enterpriseId, String isLastusable) { |
| | | List<DataVersion> dataVersionList = dataVersionService.getLastDataVersion(businessType, enterpriseId, isLastusable); |
| | | return dataVersionList; |
| | | } |
| | | |
| | | @Override |
| | | public List<DataVersion> getDataVersionList(String businessType, String enterpriseId, String versionStatus, String version) { |
| | | List<DataVersion> dataVersionList = dataVersionService.getDataVersionList(businessType, enterpriseId, versionStatus, version); |
| | | return dataVersionList; |
| | | } |
| | | |
| | | @Override |
| | | public void removeDataVersionByIds(String ids) { |
| | | dataVersionService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | } |
| | | |
| | | @Override |
| | | public void updateBatchDataVersion(List<DataVersion> dataVersionList) { |
| | | dataVersionService.saveOrUpdateBatch(dataVersionList); |
| | | } |
| | | |
| | | @Override |
| | | public void closeJobByClassName(String className) { |
| | | QuartzJob quartzJob = quartzJobService.getOne(new QueryWrapper<QuartzJob>().eq("job_class_name", className), true); |
| | | if (ObjectUtils.isNotNull(quartzJob)) { |
| | | quartzJobService.deleteAndStopJob(quartzJob); |
| | | } |
| | | } |
| | | } |