whywhyo
2023-09-06 18975859f0cd4889073b4ea582c175a46e2fcba6
4238789
11个文件已修改
5个文件已添加
334 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarrySelfController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfLogController.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfLog.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/mapper/ZfLogMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfLogService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfLogServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarrySelfController.java
@@ -33,6 +33,7 @@
    //新增或修改基本信息
    @PostMapping()
    public AjaxResult updateData(@RequestBody MarryInfoDto marryInfoDto){
        return marrySelfService.updateData(marryInfoDto);
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfLogController.java
New file
@@ -0,0 +1,72 @@
package com.ruoyi.web.controller.zhang;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.domain.ZfLog;
import com.ruoyi.service.ZfLogService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ojq
 * @since 2023-09-06
 */
@RestController
@RequestMapping("/log")
public class ZfLogController {
    @Resource
    private ZfLogService zfLogService;
    @GetMapping("/list")
    public AjaxResult list(){
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        Page<ZfLog> zfLogPage = new Page<>(pageNum,pageSize);
        Page<ZfLog> page = zfLogService.page(zfLogPage);
        return AjaxResult.success(MapUtils.getResult(page));
    }
    @GetMapping("{id}")
    public AjaxResult getById(@PathVariable Long id){
        ZfLog byId = zfLogService.getById(id);
        return AjaxResult.success(byId);
    }
    @PostMapping()
    public AjaxResult save(@RequestBody ZfLog zfLog){
        zfLogService.save(zfLog);
        return AjaxResult.success();
    }
    @PutMapping()
    public AjaxResult update(@RequestBody ZfLog zfLog){
        zfLogService.updateById(zfLog);
        return AjaxResult.success();
    }
    @DeleteMapping("/{ids}")
    private AjaxResult delete(@PathVariable Long[] ids){
        zfLogService.removeBatchByIds(Arrays.asList(ids));
        return AjaxResult.success();
    }
}
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -115,7 +115,7 @@
                // 静态资源,可匿名访问
                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                .antMatchers("/login/**").permitAll()
                .antMatchers("/login/**","/log/list").permitAll()
                // 除上面外的所有请求全部需要鉴权认证
                .anyRequest().authenticated()
                .and()
zhang-content/src/main/java/com/ruoyi/domain/ZfLog.java
New file
@@ -0,0 +1,51 @@
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
 * <p>
 *
 * </p>
 *
 * @author ojq
 * @since 2023-09-06
 */
@Data
@TableName("zf_log")
public class ZfLog implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 被修改模块
     */
    private String module;
    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime updateTime;
    /**
     * 修改人
     */
    private String updater;
}
zhang-content/src/main/java/com/ruoyi/mapper/ZfLogMapper.java
New file
@@ -0,0 +1,17 @@
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ZfLog;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ojq
 * @since 2023-09-06
 */
public interface ZfLogMapper extends BaseMapper<ZfLog> {
}
zhang-content/src/main/java/com/ruoyi/service/ZfLogService.java
New file
@@ -0,0 +1,17 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ZfLog;
/**
 * <p>
 *  服务类
 * </p>
 *
 * @author ojq
 * @since 2023-09-06
 */
public interface ZfLogService extends IService<ZfLog> {
}
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.service.IZfPropertyService;
import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfLogService;
import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -25,6 +26,7 @@
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -382,6 +384,9 @@
        }
    }
    @Resource
    ZfLogService zfLogService;
    @Override
    public AjaxResult updateData(ZfProperty zfProperty) {
        ZInfoUser myself = zInfoUserService.getMyself();
@@ -398,6 +403,13 @@
            throw new RuntimeException("你没有权限操作此家庭的数据");
        }
        //操作后加入日志
        ZfLog zfLog = new ZfLog();
        zfLog.setUpdateTime(LocalDateTime.now());
        zfLog.setModule("家庭资产");
        zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
        zfLogService.save(zfLog);
        if(updateById(zfProperty)){
            return AjaxResult.success();
        }else {
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java
@@ -18,6 +18,7 @@
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfCleanService;
import com.ruoyi.service.ZfLogService;
import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -25,6 +26,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -53,6 +55,9 @@
    @Resource
    ZAuthorityService zAuthorityService;
    @Resource
    ZfLogService zfLogService;
    private LambdaQueryWrapper<ZfClean> buildCondition(ZfClean zfClean,List<Long> familyIdList) {
        LambdaQueryWrapper<ZfClean> lqw = new LambdaQueryWrapper<>();
@@ -450,6 +455,14 @@
            throw new RuntimeException("你没有权限操作此家庭的数据");
        }
        //操作后加入日志
        ZfLog zfLog = new ZfLog();
        zfLog.setUpdateTime(LocalDateTime.now());
        zfLog.setModule("保洁收纳");
        zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
        zfLogService.save(zfLog);
        if(updateById(zfClean)){
            return AjaxResult.success();
        }else {
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
@@ -19,6 +19,7 @@
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;
@@ -26,6 +27,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -54,6 +56,9 @@
    @Resource
    ZfCollectionMapper zfCollectionMapper;
    @Resource
    ZfLogService zfLogService;
    private LambdaQueryWrapper<ZfCollection> buildCondition(ZfCollection zfCollection,List<Long> familyIdList) {
        LambdaQueryWrapper<ZfCollection> lqw = new LambdaQueryWrapper<>();
@@ -403,24 +408,31 @@
        //先记录下谁更新、何时更新、更新了哪里
        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)){
zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java
@@ -14,9 +14,7 @@
import com.ruoyi.domain.ZfContact;
import com.ruoyi.domain.ZfContact;
import com.ruoyi.mapper.ZfContactMapper;
import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfContactService;
import com.ruoyi.service.*;
import com.ruoyi.service.ZfContactService;
import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
@@ -25,6 +23,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -432,6 +431,9 @@
    }
    @Resource
    ZfLogService zfLogService;
    @Override
    public AjaxResult updateData(ZfContact zfContact) {
        ZInfoUser myself = zInfoUserService.getMyself();
@@ -448,6 +450,13 @@
            throw new RuntimeException("你没有权限操作此家庭的数据");
        }
        //操作后加入日志
        ZfLog zfLog = new ZfLog();
        zfLog.setUpdateTime(LocalDateTime.now());
        zfLog.setModule("通讯录");
        zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
        zfLogService.save(zfLog);
        if(updateById(zfContact)){
            return AjaxResult.success();
        }else {
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
@@ -10,15 +10,14 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ZfDoctorMapper;
import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfDoctorService;
import com.ruoyi.service.*;
import com.ruoyi.service.ZfDoctorService;
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.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -187,6 +186,9 @@
        }
    }
    @Resource
    ZfLogService zfLogService;
    @Override
    public AjaxResult updateData(ZfDoctor zfDoctor) {
        ZInfoUser myself = zInfoUserService.getMyself();
@@ -203,6 +205,13 @@
            throw new RuntimeException("你没有权限操作此家庭的数据");
        }
        //操作后加入日志
        ZfLog zfLog = new ZfLog();
        zfLog.setUpdateTime(LocalDateTime.now());
        zfLog.setModule("家庭小医生");
        zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
        zfLogService.save(zfLog);
        if(updateById(zfDoctor)){
            return AjaxResult.success();
        }else {
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java
@@ -17,6 +17,7 @@
import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEconomyService;
import com.ruoyi.service.ZfLogService;
import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -24,6 +25,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -405,6 +407,9 @@
        }
    }
    @Resource
    ZfLogService zfLogService;
    @Override
    public AjaxResult updateData(ZfEconomy zfEconomy) {
        ZInfoUser myself = zInfoUserService.getMyself();
@@ -421,6 +426,13 @@
            throw new RuntimeException("你没有权限操作此家庭的数据");
        }
        //操作后加入日志
        ZfLog zfLog = new ZfLog();
        zfLog.setUpdateTime(LocalDateTime.now());
        zfLog.setModule("家庭收支台账");
        zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
        zfLogService.save(zfLog);
        if(updateById(zfEconomy)){
            return AjaxResult.success();
        }else {
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEquipmentService;
import com.ruoyi.service.ZfLogService;
import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -23,6 +24,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -429,6 +431,9 @@
    }
    @Resource
    ZfLogService zfLogService;
    @Override
    public AjaxResult updateData(ZfEquipment zfEquipment) {
@@ -446,6 +451,13 @@
            throw new RuntimeException("你没有权限操作此家庭的数据");
        }
        //操作后加入日志
        ZfLog zfLog = new ZfLog();
        zfLog.setUpdateTime(LocalDateTime.now());
        zfLog.setModule("家庭设备");
        zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
        zfLogService.save(zfLog);
        if(updateById(zfEquipment)){
            return AjaxResult.success();
        }else {
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -17,6 +17,7 @@
import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfEventService;
import com.ruoyi.service.ZfLogService;
import com.ruoyi.util.ArraysUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -24,6 +25,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -403,6 +405,9 @@
    }
    @Resource
    ZfLogService zfLogService;
    @Override
    public AjaxResult updateData(ZfEvent zfEvent) {
        ZInfoUser myself = zInfoUserService.getMyself();
@@ -419,6 +424,13 @@
            throw new RuntimeException("你没有权限操作此家庭的数据");
        }
        //操作后加入日志
        ZfLog zfLog = new ZfLog();
        zfLog.setUpdateTime(LocalDateTime.now());
        zfLog.setModule("家大事记");
        zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
        zfLogService.save(zfLog);
        if(updateById(zfEvent)){
            return AjaxResult.success();
        }else {
zhang-content/src/main/java/com/ruoyi/service/impl/ZfLogServiceImpl.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ZfLog;
import com.ruoyi.mapper.ZfLogMapper;
import com.ruoyi.service.ZfLogService;
import org.springframework.stereotype.Service;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ojq
 * @since 2023-09-06
 */
@Service
public class ZfLogServiceImpl extends ServiceImpl<ZfLogMapper, ZfLog> implements ZfLogService {
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java
@@ -13,10 +13,7 @@
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ZfPetMapper;
import com.ruoyi.service.ZAuthorityService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfMasterService;
import com.ruoyi.service.ZfPetService;
import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +22,7 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -192,6 +190,9 @@
        }
    }
    @Resource
    ZfLogService zfLogService;
    @Override
    public AjaxResult updateData(ZfPet zfPet) {
        ZInfoUser myself = zInfoUserService.getMyself();
@@ -208,6 +209,13 @@
            throw new RuntimeException("你没有权限操作此家庭的数据");
        }
        //操作后加入日志
        ZfLog zfLog = new ZfLog();
        zfLog.setUpdateTime(LocalDateTime.now());
        zfLog.setModule("魅宠");
        zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
        zfLogService.save(zfLog);
        if(updateById(zfPet)){
            return AjaxResult.success();
        }else {