fuliqi
2024-07-31 f284c5ef6a1aa6e9ba5d4e94e4b2abe83b6ea18c
ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java
@@ -12,7 +12,6 @@
import com.ycl.platform.domain.form.ReportForm;
import com.ycl.platform.domain.query.ReportQuery;
import com.ycl.platform.domain.vo.ReportVO;
import com.ycl.platform.domain.vo.WorkOrderVO;
import com.ycl.platform.mapper.ReportMapper;
import com.ycl.platform.mapper.YwPeopleMapper;
import com.ycl.platform.mapper.YwPointMapper;
@@ -21,9 +20,11 @@
import com.ycl.system.Result;
import com.ycl.system.page.PageUtil;
import com.ycl.utils.SecurityUtils;
import com.ycl.utils.uuid.IdUtils;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
@@ -61,6 +62,7 @@
        form.setUnitId(people.getBelongUnit());
        Report entity = ReportForm.getEntityByForm(form, null);
        entity.setStatus(0);
        entity.setIdentify(IdUtils.timeAddRandomNO(3));
        if(baseMapper.insert(entity) > 0) {
            return Result.ok("添加成功");
        }
@@ -76,14 +78,25 @@
    public Result update(ReportForm form) {
        Report entity = baseMapper.selectById(form.getId());
        // 为空抛IllegalArgumentException,做全局异常处理
        Assert.notNull(entity, "记录不存在");
        BeanUtils.copyProperties(form, entity);
        if (baseMapper.updateById(entity) > 0) {
            return Result.ok("修改成功");
        if (0 == entity.getStatus()) {
            // 待审核的直接改
            BeanUtils.copyProperties(form, entity);
            baseMapper.updateById(entity);
        } else if (2 == entity.getStatus()) {
            // 如果是未审核通过,进行修改,那么直接新增(为了保存审核记录)
            Report report = new Report();
            BeanUtils.copyProperties(entity, report);
            BeanUtils.copyProperties(form, report);
            report.setId(null);
            report.setStatus(0);
            report.setAuditingTime(null);
            report.setAuditOpinion(null);
            baseMapper.insert(report);
        }
        return Result.error("修改失败");
        return Result.ok("修改成功");
    }
    /**
@@ -174,8 +187,8 @@
        IPage<Report> page = new LambdaQueryChainWrapper<>(baseMapper)
                .eq(StringUtils.isNotBlank(query.getReportType()), Report::getReportType, query.getReportType())
                .le(Objects.nonNull(query.getBeginCreateTime()), Report::getBeginCreateTime, query.getBeginCreateTime())
                .ge(Objects.nonNull(query.getEndCreateTime()), Report::getEndCreateTime, query.getEndCreateTime())
//                .le(Objects.nonNull(query.getBeginCreateTime()), Report::getBeginCreateTime, query.getBeginCreateTime())
//                .ge(Objects.nonNull(query.getEndCreateTime()), Report::getEndCreateTime, query.getEndCreateTime())
                .in(!CollectionUtils.isEmpty(query.getPointIdList()), Report::getPointId, query.getPointIdList())
                .in(!CollectionUtils.isEmpty(query.getPeopleIdList()), Report::getPeopleId, query.getPeopleIdList())
                .orderByDesc(Report::getCreateTime)
@@ -200,9 +213,9 @@
    @Override
    public Result examineRecord() {
        return null;
    public Result auditingRecord(Integer id) {
        List<ReportVO> reportList = baseMapper.examineRecord(id);
        return Result.ok().data(reportList);
    }
    @Override