| | |
| | | package cn.gistack.sm.log.service.impl; |
| | | |
| | | import cn.gistack.pwd.dto.CBCResultDTO; |
| | | import cn.gistack.pwd.dto.ResultDTO; |
| | | import cn.gistack.pwd.fegin.IPwdClient; |
| | | import cn.gistack.sm.log.entity.SmLogManage; |
| | | import cn.gistack.sm.log.mapper.SmLogManageMapper; |
| | | import cn.gistack.sm.log.service.ISmLogManageService; |
| | |
| | | import cn.gistack.sm.log.vo.AppStatisticsVO; |
| | | import cn.gistack.sm.log.vo.SmLogManageVO; |
| | | import cn.gistack.system.user.feign.IUserClient; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | @AllArgsConstructor |
| | | public class ISmLogManageServiceImpl extends BaseServiceImpl<SmLogManageMapper, SmLogManage> implements ISmLogManageService { |
| | | private IUserClient userClient; |
| | | private IPwdClient pwdClient; |
| | | |
| | | @Override |
| | | public AppStatisticsVO getAppStatistics(AppStatisticsVO appStatisticsVO) { |
| | |
| | | |
| | | @Override |
| | | public IPage<SmLogManageVO> selectPage(IPage<SmLogManageVO> page, SmLogManageVO smLogManage) { |
| | | return page.setRecords(baseMapper.selectMyPage(page,smLogManage)); |
| | | List<SmLogManageVO> list = baseMapper.selectMyPage(page, smLogManage); |
| | | |
| | | list.forEach(smLogManageVO ->{ |
| | | SmLogManage log = new SmLogManage(); |
| | | |
| | | log.setIp(smLogManageVO.getIp()); |
| | | log.setOperationDescription(smLogManageVO.getOperationDescription()); |
| | | log.setUrl(smLogManageVO.getUrl()); |
| | | log.setSource(smLogManage.getSource()); |
| | | |
| | | String message = JSONObject.toJSONString(log); |
| | | pwdClient.verify(smLogManageVO.getMaced(), |
| | | smLogManageVO.getSm4iv(), |
| | | smLogManageVO.getKeyindexs(), |
| | | message,smLogManageVO.getId().toString(),"sm_log_manage"); |
| | | }); |
| | | |
| | | return page.setRecords(list); |
| | | } |
| | | |
| | | @Override |
| | | public boolean save(SmLogManage entity) { |
| | | |
| | | String message = JSONObject.toJSONString(entity); |
| | | R<CBCResultDTO> cbcResultDTOR = pwdClient.getCBCMacEncipher(message); |
| | | |
| | | //保存加密字段 |
| | | String maced = cbcResultDTOR.getData().getMaced(); |
| | | String keyIndex = cbcResultDTOR.getData().getKeyIndex(); |
| | | String sm4iv = cbcResultDTOR.getData().getSm4IV(); |
| | | entity.setMaced(maced); |
| | | entity.setKeyindexs(keyIndex); |
| | | entity.setSm4iv(sm4iv); |
| | | |
| | | return super.save(entity); |
| | | } |
| | | } |