888
Jinquan_Ou
2023-04-21 923af8f8eb0d849b92afa8b567036aae2837f202
888
6个文件已修改
166 ■■■■ 已修改文件
zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java
@@ -32,13 +32,6 @@
    private Integer id;
    /**
     * 获得时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd")
    private Date getTime;
    /**
     * 类别
     */
    @Excel(name = "类别")
@@ -88,7 +81,7 @@
    /**
     * 所属家庭id
     */
    @Excel(name = "所属家庭编号")
    @Excel(name = "所属家庭编号(导入数据时请删除此栏)")
    private String familyId;
    /**
@@ -97,5 +90,30 @@
    @TableField(exist = false)
    private Integer ownData = 0;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;
    /**
     * 开始时间
     */
    @TableField(exist = false)
    private Date happenStartTime;
    /**
     * 结束时间
     */
    @TableField(exist = false)
    private Date happenEndTime;
    /**
     * 获得时间
     */
    @Excel(name = "发生时间", dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date happenTime;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
@@ -1,6 +1,7 @@
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -34,7 +35,6 @@
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd")
    private Date createTime;
    /**
@@ -63,7 +63,27 @@
    private String url;
    @Excel(name="家庭编号")
    @Excel(name="所属家庭编号(导入数据时请删除此栏)")
    private String familyId;
    /**
     * 开始时间
     */
    @TableField(exist = false)
    private Date happenStartTime;
    /**
     * 结束时间
     */
    @TableField(exist = false)
    private Date happenEndTime;
    /**
     * 发生时间
     */
    @Excel(name = "发生时间", dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date happenTime;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java
@@ -57,15 +57,21 @@
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd")
    private Date createTime;
    /**
     * 发生时间
     */
    @Excel(name = "发生时间", dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date happenTime;
    private String url;
    /**
     * 家庭id
     */
    @Excel(name = "所属家庭编号")
    @Excel(name = "所属家庭编号(导入数据时请删除此栏)")
    private String familyId;
    /**
@@ -74,8 +80,22 @@
    @TableField(exist = false)
    private Integer ownData = 0;
    /**
     * 数据状态
     */
    @Excel(name = "是否注销",readConverterExp = "0=正常,1=已注销")
    private Integer status;
    /**
     * 开始时间
     */
    @TableField(exist = false)
    private Date happenStartTime;
    /**
     * 结束时间
     */
    @TableField(exist = false)
    private Date happenEndTime;
}
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
@@ -22,6 +22,9 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@@ -38,14 +41,26 @@
@Service
public class IZfPropertyServiceImpl extends ServiceImpl<ZfPropertyMapper, ZfProperty> implements IZfPropertyService {
    @Resource
    IZfPropertyService zfPropertyService;
    @Resource
    ZInfoUserService zInfoUserService;
//    private Date getHappenTime(ZfProperty zfProperty) {
//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//        String happenTimeStr = format.format(zfProperty.getHappenTime());
//
//        Date happenTime = null;
//        try {
//            happenTime = format.parse(happenTimeStr);
//            System.out.println("方法里的:" + happenTime);
//        } catch (ParseException e) {
//            throw new RuntimeException("时间格式转换有误");
//        }
//        return happenTime;
//    }
    private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty) {
@@ -57,7 +72,8 @@
                .like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder())
                .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress())
                .like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark())
                .like(zfProperty.getCreateTime() != null, ZfProperty::getCreateTime, zfProperty.getCreateTime());
                .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime())
                .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
        return lqw;
    }
@@ -86,7 +102,7 @@
                    secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
                }
            }else{
            } else {
                setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
                //把后面的逗号去掉
                if (secondFamilyIdsBuffer.length() > 1) {
@@ -140,7 +156,7 @@
        }
        lqw.orderByDesc(ZfProperty::getId);
        lqw.orderByDesc(ZfProperty::getCreateTime);
        return lqw;
    }
@@ -183,7 +199,7 @@
    }
    @Override
        public List<ZfProperty> selectByCondition(ZfProperty zfProperty) {
    public List<ZfProperty> selectByCondition(ZfProperty zfProperty) {
        String familyIds = listFamilyIds();
        String secondFamilyIds = listSecondFamilyIds();
        LambdaQueryWrapper<ZfProperty> lambdaQueryWrapper = buildCondition(zfProperty, familyIds, secondFamilyIds);
@@ -247,7 +263,7 @@
        if (flag) {
            if (save(zfProperty)) {
                return AjaxResult.success();
            }else {
            } else {
                return AjaxResult.error();
            }
@@ -257,33 +273,32 @@
    }
    @Override
    public AjaxResult addData2(ZfProperty zfProperty){
    public AjaxResult addData2(ZfProperty zfProperty) {
        ZInfoUser mySelf = getMySelf();
        String myFamilyId = mySelf.getFamilyId();
        if (StringUtils.isNotEmpty(zfProperty.getFamilyId())){
        if (StringUtils.isNotEmpty(zfProperty.getFamilyId())) {
            throw new RuntimeException("导入数据时您不能指定家庭号");
        }
        if(StringUtils.isEmpty(myFamilyId)){
        if (StringUtils.isEmpty(myFamilyId)) {
            throw new RuntimeException("您还未加入任何家庭");
        }
        if (myFamilyId.contains(",")){
        if (myFamilyId.contains(",")) {
            String[] myFamilyIds = myFamilyId.split(",");
            //默认添加第一个家庭的数据
            zfProperty.setFamilyId(myFamilyIds[0]);
        }else {
        } else {
            zfProperty.setFamilyId(myFamilyId);
        }
        if (save(zfProperty)) {
            return AjaxResult.success();
        }else {
        } else {
            return AjaxResult.error();
        }
    }
    @Override
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfCollection;
import com.ruoyi.domain.ZfCollection;
import com.ruoyi.domain.ZfCollection;
import com.ruoyi.mapper.ZfCollectionMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfCollectionService;
@@ -56,7 +57,8 @@
        lqw.like(StringUtils.isNotEmpty(zfCollection.getPrice()),ZfCollection::getPrice,zfCollection.getPrice());
        lqw.like(StringUtils.isNotEmpty(zfCollection.getLocation()),ZfCollection::getLocation,zfCollection.getLocation());
        lqw.like(StringUtils.isNotEmpty(zfCollection.getRemark()),ZfCollection::getRemark,zfCollection.getRemark());
        lqw.like(zfCollection.getGetTime()!=null,ZfCollection::getGetTime,zfCollection.getGetTime());
        lqw.eq(zfCollection.getHappenTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenTime());
        lqw.between(zfCollection.getHappenStartTime() != null && zfCollection.getHappenEndTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenStartTime(), zfCollection.getHappenEndTime());
        return lqw;
    }
@@ -139,7 +141,7 @@
        }
        lqw.orderByDesc(ZfCollection::getId);
        lqw.orderByDesc(ZfCollection::getCreateTime);
        return lqw;
    }
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -42,36 +42,36 @@
    @Resource
    ZfEventService zfEventService;
    private String listFamilyIds(){
    private String listFamilyIds() {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
        zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId,userId);
        zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
        ZInfoUser zInfoUser = zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
        return zInfoUser.getFamilyId();
    }
    @Override
    public AjaxResult selectEventList(ZfEvent zfEvent, Integer pageNum, Integer pageSize) {
        String familyIds = listFamilyIds();
        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent,familyIds);
        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, familyIds);
        Page<ZfEvent> ZfEventPage = new Page<>(pageNum,pageSize);
        Page<ZfEvent> ZfEventPage = new Page<>(pageNum, pageSize);
        Page<ZfEvent> pageResult = page(ZfEventPage, lqw);
        HashMap<String, Object> data = MapUtils.getResult(pageResult);
        return AjaxResult.success(data);
    }
    @Override
    public List<ZfEvent> selectByCondition(ZfEvent zfEvent) {
        String familyIds = listFamilyIds();
        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent,familyIds);
        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, familyIds);
        List<ZfEvent> list = list(lqw);
        log.info("返回的数据为:{}",list);
        log.info("返回的数据为:{}", list);
        return list;
    }
@@ -119,11 +119,12 @@
    private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent) {
        LambdaQueryWrapper<ZfEvent> lqw = new LambdaQueryWrapper<>();
        lqw.like(!StringUtils.isEmpty(zfEvent.getAddress()),ZfEvent::getAddress,zfEvent.getAddress());
        lqw.like(!StringUtils.isEmpty(zfEvent.getPeople()),ZfEvent::getPeople,zfEvent.getPeople());
        lqw.like(!StringUtils.isEmpty(zfEvent.getTitle()),ZfEvent::getTitle,zfEvent.getTitle());
        lqw.like(!StringUtils.isEmpty(zfEvent.getRemark()),ZfEvent::getRemark,zfEvent.getRemark());
        lqw.like(zfEvent.getCreateTime()!=null,ZfEvent::getCreateTime,zfEvent.getCreateTime());
        lqw.like(!StringUtils.isEmpty(zfEvent.getAddress()), ZfEvent::getAddress, zfEvent.getAddress());
        lqw.like(!StringUtils.isEmpty(zfEvent.getPeople()), ZfEvent::getPeople, zfEvent.getPeople());
        lqw.like(!StringUtils.isEmpty(zfEvent.getTitle()), ZfEvent::getTitle, zfEvent.getTitle());
        lqw.like(!StringUtils.isEmpty(zfEvent.getRemark()), ZfEvent::getRemark, zfEvent.getRemark());
        lqw.eq(zfEvent.getHappenTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenTime());
        lqw.between(zfEvent.getHappenStartTime() != null && zfEvent.getHappenEndTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenStartTime(), zfEvent.getHappenEndTime());
        return lqw;
    }
@@ -131,9 +132,9 @@
        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent);
        if (familyIds.contains(",")) {
            String[] familyList = familyIds.split(",");
            lqw.in(ZfEvent::getFamilyId,familyList);
        }else {
            lqw.eq(ZfEvent::getFamilyId,familyIds);
            lqw.in(ZfEvent::getFamilyId, familyList);
        } else {
            lqw.eq(ZfEvent::getFamilyId, familyIds);
        }
        return lqw;
    }