| | |
| | | package com.ruoyi.service.impl; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.core.JsonParser; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.MapUtils; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.constant.MenuAuthority.*; |
| | |
| | | |
| | | @Resource |
| | | ZAuthorityService zAuthorityService; |
| | | |
| | | @Resource |
| | | ZfCollectionMapper zfCollectionMapper; |
| | | |
| | | private LambdaQueryWrapper<ZfCollection> buildCondition(ZfCollection zfCollection,List<Long> familyIdList) { |
| | | LambdaQueryWrapper<ZfCollection> lqw = new LambdaQueryWrapper<>(); |
| | |
| | | bean.setOwnData(0); |
| | | } |
| | | } |
| | | ).collect(Collectors.toList()); |
| | | ).sorted((a,b)-> b.getOwnData()-a.getOwnData()).collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | List<ZAuthority> authority = zAuthorityService.getAuthority(); |
| | | List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList()); |
| | | List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(COLLECTION_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList()); |
| | | familyIdList.add(familyId); |
| | | |
| | | if (zfCollection.getFamilyId()!=null && !familyIdList.contains(zfCollection.getFamilyId())) { |
| | |
| | | throw new RuntimeException("你没有权限操作此家庭的数据"); |
| | | } |
| | | |
| | | //先记录下谁更新、何时更新、更新了哪里 |
| | | |
| | | 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+"字段"); |
| | | } |
| | | } |
| | | |
| | | |
| | | if(updateById(zfCollection)){ |
| | | |
| | | return AjaxResult.success(); |
| | | }else { |
| | | return AjaxResult.error(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listType() { |
| | | List<String> result = zfCollectionMapper.listType(); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional |