| ¶Ô±ÈÐÂÎļþ | 
|  |  |  | 
|---|
|  |  |  | package com.doumee.service.business.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.business.PlatformInterfaceLogMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.InterfaceLog; | 
|---|
|  |  |  | import com.doumee.dao.business.model.PlatformInterfaceLog; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformInterfaceLogService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * ä½ä¸è°åº¦å¹³å°æ¥å£äº¤äºè®°å½Serviceå®ç° | 
|---|
|  |  |  | * @author æ±è¹è¹ | 
|---|
|  |  |  | * @date 2024/06/28 10:03 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class PlatformInterfaceLogServiceImpl implements PlatformInterfaceLogService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformInterfaceLogMapper platformInterfaceLogMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(PlatformInterfaceLog platformInterfaceLog) { | 
|---|
|  |  |  | platformInterfaceLogMapper.insert(platformInterfaceLog); | 
|---|
|  |  |  | return platformInterfaceLog.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void deleteById(Integer id) { | 
|---|
|  |  |  | platformInterfaceLogMapper.deleteById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void delete(PlatformInterfaceLog platformInterfaceLog) { | 
|---|
|  |  |  | UpdateWrapper<PlatformInterfaceLog> deleteWrapper = new UpdateWrapper<>(platformInterfaceLog); | 
|---|
|  |  |  | platformInterfaceLogMapper.delete(deleteWrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void deleteByIdInBatch(List<Integer> ids) { | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(ids)) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | platformInterfaceLogMapper.deleteBatchIds(ids); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateById(PlatformInterfaceLog platformInterfaceLog) { | 
|---|
|  |  |  | platformInterfaceLogMapper.updateById(platformInterfaceLog); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateByIdInBatch(List<PlatformInterfaceLog> platformInterfaceLogs) { | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(platformInterfaceLogs)) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (PlatformInterfaceLog platformInterfaceLog: platformInterfaceLogs) { | 
|---|
|  |  |  | this.updateById(platformInterfaceLog); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PlatformInterfaceLog findById(Integer id) { | 
|---|
|  |  |  | return platformInterfaceLogMapper.selectById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PlatformInterfaceLog findOne(PlatformInterfaceLog platformInterfaceLog) { | 
|---|
|  |  |  | QueryWrapper<PlatformInterfaceLog> wrapper = new QueryWrapper<>(platformInterfaceLog); | 
|---|
|  |  |  | return platformInterfaceLogMapper.selectOne(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<PlatformInterfaceLog> findList(PlatformInterfaceLog platformInterfaceLog) { | 
|---|
|  |  |  | QueryWrapper<PlatformInterfaceLog> wrapper = new QueryWrapper<>(platformInterfaceLog); | 
|---|
|  |  |  | return platformInterfaceLogMapper.selectList(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PageData<PlatformInterfaceLog> findPage(PageWrap<PlatformInterfaceLog> pageWrap) { | 
|---|
|  |  |  | IPage<PlatformInterfaceLog> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
|---|
|  |  |  | QueryWrapper<PlatformInterfaceLog> queryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | Utils.MP.blankToNull(pageWrap.getModel()); | 
|---|
|  |  |  | queryWrapper.lambda() | 
|---|
|  |  |  | .eq(pageWrap.getModel().getId() != null, PlatformInterfaceLog::getId, pageWrap.getModel().getId()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getCreator() != null, PlatformInterfaceLog::getCreator, pageWrap.getModel().getCreator()) | 
|---|
|  |  |  | .ge(pageWrap.getModel().getCreateDate() != null, PlatformInterfaceLog::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())) | 
|---|
|  |  |  | .le(pageWrap.getModel().getCreateDate() != null, PlatformInterfaceLog::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getEditor() != null, PlatformInterfaceLog::getEditor, pageWrap.getModel().getEditor()) | 
|---|
|  |  |  | .ge(pageWrap.getModel().getEditDate() != null, PlatformInterfaceLog::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())) | 
|---|
|  |  |  | .le(pageWrap.getModel().getEditDate() != null, PlatformInterfaceLog::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getIsdeleted() != null, PlatformInterfaceLog::getIsdeleted, pageWrap.getModel().getIsdeleted()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getRemark() != null, PlatformInterfaceLog::getRemark, pageWrap.getModel().getRemark()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getType() != null, PlatformInterfaceLog::getType, pageWrap.getModel().getType()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getName() != null, PlatformInterfaceLog::getName, pageWrap.getModel().getName()) | 
|---|
|  |  |  | .ge(pageWrap.getModel().getUrl() != null, PlatformInterfaceLog::getUrl, Utils.Date.getStart(pageWrap.getModel().getUrl())) | 
|---|
|  |  |  | .le(pageWrap.getModel().getUrl() != null, PlatformInterfaceLog::getUrl, Utils.Date.getEnd(pageWrap.getModel().getUrl())) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getRequest() != null, PlatformInterfaceLog::getRequest, pageWrap.getModel().getRequest()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getRepose() != null, PlatformInterfaceLog::getRepose, pageWrap.getModel().getRepose()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getSuccess() != null, PlatformInterfaceLog::getSuccess, pageWrap.getModel().getSuccess()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getPlat() != null, PlatformInterfaceLog::getPlat, pageWrap.getModel().getPlat()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getObjType() != null, PlatformInterfaceLog::getObjType, pageWrap.getModel().getObjType()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getObjId() != null, PlatformInterfaceLog::getObjId, pageWrap.getModel().getObjId()) | 
|---|
|  |  |  | ; | 
|---|
|  |  |  | for(PageWrap.SortData sortData: pageWrap.getSorts()) { | 
|---|
|  |  |  | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { | 
|---|
|  |  |  | queryWrapper.orderByDesc(sortData.getProperty()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | queryWrapper.orderByAsc(sortData.getProperty()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return PageData.from(platformInterfaceLogMapper.selectPage(page, queryWrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public long count(PlatformInterfaceLog platformInterfaceLog) { | 
|---|
|  |  |  | QueryWrapper<PlatformInterfaceLog> wrapper = new QueryWrapper<>(platformInterfaceLog); | 
|---|
|  |  |  | return platformInterfaceLogMapper.selectCount(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void clearThreeMonthLog() { | 
|---|
|  |  |  | int days =15; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | days = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.HK_LOG_DEL_DAYS_LIMIT).getCode()); | 
|---|
|  |  |  | }catch (Exception e){} | 
|---|
|  |  |  | platformInterfaceLogMapper.delete(new UpdateWrapper<PlatformInterfaceLog>().lambda() | 
|---|
|  |  |  | .apply("to_days(create_date)+"+days+" < to_days(now())") ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|