songhuangfeng123
2022-08-18 233fb69fa9d1694e97337d74fa3da72cacda04c1
目标统计
已修改6个文件
509 ■■■■■ 文件已修改
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/TargetExamineController.java 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/entity/TargetExamine.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/req/TargetExamineSaveOrUpdate.java 113 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/TargetExamineDto.java 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/TargetExamineService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/TargetExamineServiceImpl.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/TargetExamineController.java
@@ -3,16 +3,18 @@
import java.sql.Timestamp;
import com.gkhy.safePlatform.targetDuty.utils.DateUtils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.targetDuty.entity.ExamineItem;
import com.gkhy.safePlatform.targetDuty.entity.TargetDutyfileInfo;
import com.gkhy.safePlatform.targetDuty.entity.TargetExamine;
import com.gkhy.safePlatform.targetDuty.entity.TargetMng;
import com.gkhy.safePlatform.targetDuty.model.dto.req.ExamineTemplateSaveOrUpdate;
import com.gkhy.safePlatform.targetDuty.model.dto.req.TargetDutyfileInfoQueryCriteria;
import com.gkhy.safePlatform.targetDuty.model.dto.req.TargetExamineSaveOrUpdate;
import com.gkhy.safePlatform.targetDuty.model.dto.resp.ExamineTemplateDto;
import com.gkhy.safePlatform.targetDuty.model.dto.resp.TargetExamineDivideDto;
@@ -53,49 +55,75 @@
    @Resource
    private CommonService commonService;
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param targetId 主键
//     * @return 单条数据
//     */
//    @GetMapping(value = "/selectOne/{targetId}")
//    public ResultVO selectOne(@PathVariable Long targetId) {
//        TargetExamineDto dto = new TargetExamineDto();
//        TargetMng targetMng = targetMngService.getById(targetId);
//        if(targetMng == null) {
//            return new ResultVO<>(ResultCodes.CLIENT_PROJECT_NOT_EXIST);
//        }
//
//        TargetExamineQueryCriteria criteria = new TargetExamineQueryCriteria();
//        criteria.setTargetId(targetId);
//
//        List<TargetExamineDivideDto> respList = BeanCopyUtils.copyBeanList(this.targetExamineService.queryAll(criteria), TargetExamineDivideDto.class);
//
//
//        // --------------------------- 获取部门信息-----------------------
//        //收集所用到的部门ID
//        Set<Long> collectDepIdSet = new HashSet();
//        respList.forEach(f->{
//            collectDepIdSet.add(f.getDutyDepartmentId());
//            collectDepIdSet.add(f.getMakerDepartmentId());
//        });
//        //获取部门名集合
//        Map<Long,String> depNameMap = commonService.getDepName(collectDepIdSet);
//
//        respList.forEach(f->{
//            f.setDutyDepartmentName(depNameMap.get(f.getDutyDepartmentId()));
//            f.setMakerDepartmentName(depNameMap.get(f.getMakerDepartmentId()));
//        });
//
//        dto.setExamineList(respList);
//        dto.setId(targetMng.getId());
//        dto.setIndexNum(targetMng.getIndexNum());
//        dto.setqName(targetMng.getqName());
//        dto.setValue(targetMng.getValue());
//        dto.setYear(targetMng.getYear());
//        return new ResultVO<>(ResultCodes.OK,dto);
//    }
    /**
     * 分页查询所有数据
     *
     * @param pageQuery 查询实体
     * @return 所有数据
     */
    @PostMapping(value = "/page/list")
    public ResultVO selectAll(@RequestBody PageQuery<TargetExamineQueryCriteria> pageQuery){
        PageUtils.checkCheck(pageQuery);
        return this.targetExamineService.queryAll(pageQuery);
    }
    /**
     * 通过主键查询单条数据
     *
     * @param targetId 主键
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping(value = "/selectOne/{targetId}")
    public ResultVO selectOne(@PathVariable Long targetId) {
        TargetExamineDto dto = new TargetExamineDto();
        TargetMng targetMng = targetMngService.getById(targetId);
        if(targetMng == null) {
            return new ResultVO<>(ResultCodes.CLIENT_PROJECT_NOT_EXIST);
        }
        TargetExamineQueryCriteria criteria = new TargetExamineQueryCriteria();
        criteria.setTargetId(targetId);
        List<TargetExamineDivideDto> respList = BeanCopyUtils.copyBeanList(this.targetExamineService.queryAll(criteria), TargetExamineDivideDto.class);
        // --------------------------- 获取部门信息-----------------------
        //收集所用到的部门ID
        Set<Long> collectDepIdSet = new HashSet();
        respList.forEach(f->{
            collectDepIdSet.add(f.getDutyDepartmentId());
            collectDepIdSet.add(f.getMakerDepartmentId());
        });
        //获取部门名集合
        Map<Long,String> depNameMap = commonService.getDepName(collectDepIdSet);
        respList.forEach(f->{
            f.setDutyDepartmentName(depNameMap.get(f.getDutyDepartmentId()));
            f.setMakerDepartmentName(depNameMap.get(f.getMakerDepartmentId()));
        });
        dto.setExamineList(respList);
        dto.setId(targetMng.getId());
        dto.setIndexNum(targetMng.getIndexNum());
        dto.setqName(targetMng.getqName());
        dto.setValue(targetMng.getValue());
        dto.setYear(targetMng.getYear());
        return new ResultVO<>(ResultCodes.OK,dto);
    @GetMapping(value = "/selectOne/{id}")
    public ResultVO selectOne(@PathVariable Serializable id) {
        return new ResultVO<>(ResultCodes.OK,this.targetExamineService.getById(id));
    }
    /**
     * 新增或者修改数据
@@ -104,17 +132,14 @@
     * @return 修改结果
     */
    @PostMapping(value = "/addOrUpdate")
    public ResultVO update(@RequestBody TargetExamineSaveOrUpdate infoDto) {
        if(infoDto.getId() == null) {
            return new ResultVO<>(ResultCodes.CLIENT_PARAM_ERROR);
    public ResultVO update(@RequestBody TargetExamine infoDto) {
        infoDto.setExamineDate(new Timestamp(new Date().getTime()));
        if (infoDto.getId() == null) {
            return new ResultVO<>(ResultCodes.OK,targetExamineService.save(infoDto));
        } else {
            targetExamineService.update(infoDto,new UpdateWrapper<TargetExamine>().eq("id",infoDto.getId()));
            return new ResultVO<>(ResultCodes.OK);
        }
        TargetMng targetMng = targetMngService.getById(infoDto.getId());
        if(targetMng == null) {
            return new ResultVO<>(ResultCodes.CLIENT_PROJECT_NOT_EXIST);
        }
        targetExamineService.addOrUpdate(infoDto);
        return new ResultVO<>(ResultCodes.OK);
    }
    /**
@@ -135,23 +160,20 @@
    public static void main(String[] args) {
        TargetExamineSaveOrUpdate saveOrUpdate = new TargetExamineSaveOrUpdate();
        saveOrUpdate.setDelIds("1,2");
        List<TargetExamine> examineList = Lists.newArrayList();
        TargetExamine item = new TargetExamine();
        item.setDutyDepartmentId(12L);
        item.setExamineValue("3");
        item.setMakerDepartmentId(4L);
        item.setMakeDate(new Timestamp(new java.util.Date().getTime()));
        item.setUploadValue("2");
        item.setUploadDate(new Timestamp(new java.util.Date().getTime()));
        item.setExamineResult(1);
        item.setExaminePersonId(0L);
        item.setExamineDate(new Timestamp(new java.util.Date().getTime()));
        examineList.add(item);
        saveOrUpdate.setExamineList(examineList);
        System.out.println(JSONObject.toJSONString(saveOrUpdate));
//        TargetExamineSaveOrUpdate saveOrUpdate = new TargetExamineSaveOrUpdate();
//        saveOrUpdate.setDelIds("1,2");
//
//
//        List<TargetExamine> examineList = Lists.newArrayList();
//        TargetExamine item = new TargetExamine();
//        item.setTargetDivideDetailId(1L);
//        item.setUploadValue("2");
//        item.setUploadDate(new Timestamp(new java.util.Date().getTime()));
//        item.setExamineResult(1);
//        item.setExaminePersonId(0L);
//        item.setExamineDate(new Timestamp(new java.util.Date().getTime()));
//        examineList.add(item);
//        saveOrUpdate.setExamineList(examineList);
//        System.out.println(JSONObject.toJSONString(saveOrUpdate));
    }
}
}
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/entity/TargetExamine.java
@@ -11,7 +11,7 @@
 * 安全目标考核(TargetExamine)表实体类
 *
 * @author xurui
 * @since 2022-08-12 08:07:53
 * @since 2022-08-18 16:27:12
 */
@SuppressWarnings("serial")
@TableName("target_examine")
@@ -28,56 +28,15 @@
        this.id = id;
    }
                //关联的目标指标/外键
            private Long targetId;
                //关联的目标分解/外键
            private Long targetDivideDetailId;
        
    public Long getTargetId() {
        return targetId;
    public Long getTargetDivideDetailId() {
        return targetDivideDetailId;
    }
    public void setTargetId(Long targetId) {
        this.targetId = targetId;
    }
                //责任部门id/外键
            private Long dutyDepartmentId;
    public Long getDutyDepartmentId() {
        return dutyDepartmentId;
    }
    public void setDutyDepartmentId(Long dutyDepartmentId) {
        this.dutyDepartmentId = dutyDepartmentId;
    }
                //考核指标
            private String examineValue;
    public String getExamineValue() {
        return examineValue;
    }
    public void setExamineValue(String examineValue) {
        this.examineValue = examineValue;
    }
                //制定部门id/外键
            private Long makerDepartmentId;
    public Long getMakerDepartmentId() {
        return makerDepartmentId;
    }
    public void setMakerDepartmentId(Long makerDepartmentId) {
        this.makerDepartmentId = makerDepartmentId;
    }
                //制定日期
            @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Timestamp makeDate;
    public Timestamp getMakeDate() {
        return makeDate;
    }
    public void setMakeDate(Timestamp makeDate) {
        this.makeDate = makeDate;
    public void setTargetDivideDetailId(Long targetDivideDetailId) {
        this.targetDivideDetailId = targetDivideDetailId;
    }
                //上报值
            private String uploadValue;
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/req/TargetExamineSaveOrUpdate.java
@@ -2,16 +2,16 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gkhy.safePlatform.targetDuty.entity.ExamineItem;
import com.gkhy.safePlatform.targetDuty.entity.TargetExamine;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
public class TargetExamineSaveOrUpdate implements Serializable {
    @TableId(type = IdType.AUTO)
    private Long id;
    public Long getId() {
@@ -22,25 +22,110 @@
        this.id = id;
    }
    //关联的考核数据列表
    private List<TargetExamine> examineList = new ArrayList<>();
    //关联的目标分解/外键
    private Long targetDivideDetailId;
    public List<TargetExamine> getExamineList() {
        return examineList;
    public Long getTargetDivideDetailId() {
        return targetDivideDetailId;
    }
    public void setExamineList(List<TargetExamine> examineList) {
        this.examineList = examineList;
    public void setTargetDivideDetailId(Long targetDivideDetailId) {
        this.targetDivideDetailId = targetDivideDetailId;
    }
    //上报值
    private String uploadValue;
    public String getUploadValue() {
        return uploadValue;
    }
    //要删除的id集合,多个用逗号隔开
    private String delIds;
    public void setUploadValue(String uploadValue) {
        this.uploadValue = uploadValue;
    }
    //上报时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp uploadDate;
    public String getDelIds() {
        return delIds;
    public Timestamp getUploadDate() {
        return uploadDate;
    }
    public void setDelIds(String delIds) {
        this.delIds = delIds;
    public void setUploadDate(Timestamp uploadDate) {
        this.uploadDate = uploadDate;
    }
    //考核结果 1:合格 2:不合格
    private Integer examineResult;
    public Integer getExamineResult() {
        return examineResult;
    }
    public void setExamineResult(Integer examineResult) {
        this.examineResult = examineResult;
    }
    //考核人ID/外键
    private Long examinePersonId;
    public Long getExaminePersonId() {
        return examinePersonId;
    }
    public void setExaminePersonId(Long examinePersonId) {
        this.examinePersonId = examinePersonId;
    }
    //考核人名称
    private String examinePersonName;
    public String getExaminePersonName() {
        return examinePersonName;
    }
    public void setExaminePersonName(String examinePersonName) {
        this.examinePersonName = examinePersonName;
    }
    //考核时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp examineDate;
    public Timestamp getExamineDate() {
        return examineDate;
    }
    public void setExamineDate(Timestamp examineDate) {
        this.examineDate = examineDate;
    }
//
//    @TableId(type = IdType.AUTO)
//    private Long id;
//    public Long getId() {
//        return id;
//    }
//
//    public void setId(Long id) {
//        this.id = id;
//    }
//
//    //关联的考核数据列表
//    private List<TargetExamine> examineList = new ArrayList<>();
//
//    public List<TargetExamine> getExamineList() {
//        return examineList;
//    }
//
//    public void setExamineList(List<TargetExamine> examineList) {
//        this.examineList = examineList;
//    }
//
//    //要删除的id集合,多个用逗号隔开
//    private String delIds;
//
//    public String getDelIds() {
//        return delIds;
//    }
//
//    public void setDelIds(String delIds) {
//        this.delIds = delIds;
//    }
}
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/model/dto/resp/TargetExamineDto.java
@@ -1,5 +1,8 @@
package com.gkhy.safePlatform.targetDuty.model.dto.resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gkhy.safePlatform.targetDuty.entity.TargetExamine;
import java.sql.Timestamp;
@@ -9,17 +12,6 @@
public class TargetExamineDto implements Serializable {
    private Long id;
    //安全目标指标
    private String qName;
    //目标指标编号
    private String indexNum;
    //年度
    private String year;
    //指标值
    private String value;
    //关联的考核数据列表
    private List<TargetExamineDivideDto> examineList = new ArrayList<>();
    public Long getId() {
        return id;
    }
@@ -28,43 +20,142 @@
        this.id = id;
    }
    public String getqName() {
        return qName;
    //关联的目标指标/外键
    private Long targetId;
    public Long getTargetId() {
        return targetId;
    }
    public void setqName(String qName) {
        this.qName = qName;
    public void setTargetId(Long targetId) {
        this.targetId = targetId;
    }
    //责任部门id/外键
    private Long dutyDepartmentId;
    public Long getDutyDepartmentId() {
        return dutyDepartmentId;
    }
    public String getIndexNum() {
        return indexNum;
    public void setDutyDepartmentId(Long dutyDepartmentId) {
        this.dutyDepartmentId = dutyDepartmentId;
    }
    public void setIndexNum(String indexNum) {
        this.indexNum = indexNum;
    //责任部门名称
    private String dutyDepartmentName;
    //考核指标
    private String examineValue;
    public String getExamineValue() {
        return examineValue;
    }
    public String getYear() {
        return year;
    public void setExamineValue(String examineValue) {
        this.examineValue = examineValue;
    }
    //制定部门id/外键
    private Long makerDepartmentId;
    public Long getMakerDepartmentId() {
        return makerDepartmentId;
    }
    public void setYear(String year) {
        this.year = year;
    public void setMakerDepartmentId(Long makerDepartmentId) {
        this.makerDepartmentId = makerDepartmentId;
    }
    public String getValue() {
        return value;
    //制定部门名称
    private String makerDepartmentName;
    //制定日期
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp makeDate;
    public Timestamp getMakeDate() {
        return makeDate;
    }
    public void setValue(String value) {
        this.value = value;
    public void setMakeDate(Timestamp makeDate) {
        this.makeDate = makeDate;
    }
    //上报值
    private String uploadValue;
    public String getUploadValue() {
        return uploadValue;
    }
    public List<TargetExamineDivideDto> getExamineList() {
        return examineList;
    public void setUploadValue(String uploadValue) {
        this.uploadValue = uploadValue;
    }
    //上报时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp uploadDate;
    public Timestamp getUploadDate() {
        return uploadDate;
    }
    public void setExamineList(List<TargetExamineDivideDto> examineList) {
        this.examineList = examineList;
    public void setUploadDate(Timestamp uploadDate) {
        this.uploadDate = uploadDate;
    }
    //考核结果 1:合格 2:不合格
    private Integer examineResult;
    public Integer getExamineResult() {
        return examineResult;
    }
    public void setExamineResult(Integer examineResult) {
        this.examineResult = examineResult;
    }
    //考核人ID/外键
    private Long examinePersonId;
    public Long getExaminePersonId() {
        return examinePersonId;
    }
    public void setExaminePersonId(Long examinePersonId) {
        this.examinePersonId = examinePersonId;
    }
    //考核人名称
    private String examinePersonName;
    public String getExaminePersonName() {
        return examinePersonName;
    }
    public void setExaminePersonName(String examinePersonName) {
        this.examinePersonName = examinePersonName;
    }
    //考核时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp examineDate;
    public Timestamp getExamineDate() {
        return examineDate;
    }
    public void setExamineDate(Timestamp examineDate) {
        this.examineDate = examineDate;
    }
    public String getDutyDepartmentName() {
        return dutyDepartmentName;
    }
    public void setDutyDepartmentName(String dutyDepartmentName) {
        this.dutyDepartmentName = dutyDepartmentName;
    }
    public String getMakerDepartmentName() {
        return makerDepartmentName;
    }
    public void setMakerDepartmentName(String makerDepartmentName) {
        this.makerDepartmentName = makerDepartmentName;
    }
}
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/TargetExamineService.java
@@ -21,5 +21,5 @@
    
    List<TargetExamine> queryAll(TargetExamineQueryCriteria criteria);
    void addOrUpdate(TargetExamineSaveOrUpdate infoDto);
//    void addOrUpdate(TargetExamineSaveOrUpdate infoDto);
}
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/TargetExamineServiceImpl.java
@@ -64,19 +64,19 @@
        return baseMapper.selectList(QueryHelpPlus.getPredicate(TargetExamine.class, criteria));
    }
    @Override
    public void addOrUpdate(TargetExamineSaveOrUpdate infoDto) {
        if(StringUtils.hasText(infoDto.getDelIds())) {
            List<Long> idList = Arrays.stream(infoDto.getDelIds().split(",")).map(s-> Long.parseLong(s.trim()))
                    .collect(Collectors.toList());
            this.removeByIds(idList);
        }
        infoDto.getExamineList().forEach(f->{
            f.setTargetId(infoDto.getId());
        });
        this.saveOrUpdateBatch(infoDto.getExamineList());
    }
//    @Override
//    public void addOrUpdate(TargetExamineSaveOrUpdate infoDto) {
//
//
//        if(StringUtils.hasText(infoDto.getDelIds())) {
//            List<Long> idList = Arrays.stream(infoDto.getDelIds().split(",")).map(s-> Long.parseLong(s.trim()))
//                    .collect(Collectors.toList());
//            this.removeByIds(idList);
//        }
//
//        infoDto.getExamineList().forEach(f->{
//            f.setTargetId(infoDto.getId());
//        });
//        this.saveOrUpdateBatch(infoDto.getExamineList());
//    }
}