|  |  |  | 
|---|
|  |  |  | 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.InterfaceLogMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.InterfaceLog; | 
|---|
|  |  |  | import com.doumee.dao.business.model.WmsInterfaceLog; | 
|---|
|  |  |  | import com.doumee.service.business.InterfaceLogService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private InterfaceLogMapper interfaceLogMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(InterfaceLog interfaceLog) { | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<InterfaceLog> wrapper = new QueryWrapper<>(interfaceLog); | 
|---|
|  |  |  | return interfaceLogMapper.selectOne(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public  void  saveInterfaceLog(String url,String name,String  param,Integer success,String respone,int type){ | 
|---|
|  |  |  | if(interfaceLogMapper ==null){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | InterfaceLog log = new InterfaceLog(); | 
|---|
|  |  |  | log.setCreateDate(new Date()); | 
|---|
|  |  |  | log.setUrl(url); | 
|---|
|  |  |  | log.setEditDate(log.getCreateDate()); | 
|---|
|  |  |  | log.setPlat(Constants.ZERO); | 
|---|
|  |  |  | log.setName(name); | 
|---|
|  |  |  | log.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | log.setRequest(param); | 
|---|
|  |  |  | log.setType(type); | 
|---|
|  |  |  | log.setSuccess(success); | 
|---|
|  |  |  | log.setRepose(respone); | 
|---|
|  |  |  | interfaceLogMapper.insert(log); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<InterfaceLog> findList(InterfaceLog interfaceLog) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (pageWrap.getModel().getStartDate() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().ge(InterfaceLog::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate())); | 
|---|
|  |  |  | queryWrapper.lambda().ge(InterfaceLog::getCreateDate, pageWrap.getModel().getStartDate()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getEndDate() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().le(InterfaceLog::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getEndDate())); | 
|---|
|  |  |  | queryWrapper.lambda().le(InterfaceLog::getCreateDate, pageWrap.getModel().getEndDate()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageWrap.getModel().getIsdeleted() != null) { | 
|---|
|  |  |  | queryWrapper.lambda().eq(InterfaceLog::getIsdeleted, pageWrap.getModel().getIsdeleted()); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @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){} | 
|---|
|  |  |  | interfaceLogMapper.delete(new UpdateWrapper<InterfaceLog>().lambda() | 
|---|
|  |  |  | .apply("to_days(create_date)+15 < to_days(now())") | 
|---|
|  |  |  | .like(InterfaceLog::getUrl,"/artemis/api/")); | 
|---|
|  |  |  | .apply("to_days(create_date)+"+days+" < to_days(now())") ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|