| | |
| | | import com.ruoyi.service.ZAuthorityService; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import com.ruoyi.service.ZfCollectionService; |
| | | import com.ruoyi.service.ZfLogService; |
| | | import com.ruoyi.util.ArraysUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Resource |
| | | ZfCollectionMapper zfCollectionMapper; |
| | | |
| | | @Resource |
| | | ZfLogService zfLogService; |
| | | |
| | | private LambdaQueryWrapper<ZfCollection> buildCondition(ZfCollection zfCollection,List<Long> familyIdList) { |
| | | LambdaQueryWrapper<ZfCollection> lqw = new LambdaQueryWrapper<>(); |
| | |
| | | |
| | | //先记录下谁更新、何时更新、更新了哪里 |
| | | |
| | | LambdaQueryWrapper<ZfCollection> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfCollection::getId,zfCollection.getId()); |
| | | zfCollectionService.getOne(lqw); |
| | | ZfCollection oldData = getOne(lqw); |
| | | // LambdaQueryWrapper<ZfCollection> lqw = new LambdaQueryWrapper<>(); |
| | | // lqw.eq(ZfCollection::getId,zfCollection.getId()); |
| | | // zfCollectionService.getOne(lqw); |
| | | // ZfCollection oldData = getOne(lqw); |
| | | // |
| | | // String oldJson = JSONObject.toJSONString(oldData); |
| | | // String newJson = JSONObject.toJSONString(zfCollection); |
| | | // |
| | | // Map oldMap = JSONObject.parseObject(oldJson, Map.class); |
| | | // Map newMap = JSONObject.parseObject(newJson, Map.class); |
| | | // |
| | | // for (Object key : oldMap.keySet()) { |
| | | // if(newMap.get(key)!=null && !newMap.get(key).equals(oldMap.get(key))){ |
| | | // System.out.println(newMap.get(key)+" "+oldMap.get(key)); |
| | | // Date date = new Date(); |
| | | // System.out.println("用户"+myself.getNickName()+"在"+date+"这个时间"+"修改了<收藏荣誉>模块的"+key+"字段"); |
| | | // } |
| | | // } |
| | | |
| | | String oldJson = JSONObject.toJSONString(oldData); |
| | | String newJson = JSONObject.toJSONString(zfCollection); |
| | | |
| | | Map oldMap = JSONObject.parseObject(oldJson, Map.class); |
| | | Map newMap = JSONObject.parseObject(newJson, Map.class); |
| | | |
| | | for (Object key : oldMap.keySet()) { |
| | | if(newMap.get(key)!=null && !newMap.get(key).equals(oldMap.get(key))){ |
| | | System.out.println(newMap.get(key)+" "+oldMap.get(key)); |
| | | Date date = new Date(); |
| | | System.out.println("用户"+myself.getNickName()+"在"+date+"这个时间"+"修改了<收藏荣誉>模块的"+key+"字段"); |
| | | } |
| | | } |
| | | //操作后加入日志 |
| | | ZfLog zfLog = new ZfLog(); |
| | | zfLog.setUpdateTime(LocalDateTime.now()); |
| | | zfLog.setModule("收藏荣誉"); |
| | | zfLog.setUpdater(zInfoUserService.getMyself().getNickName()); |
| | | zfLogService.save(zfLog); |
| | | |
| | | |
| | | if(updateById(zfCollection)){ |