diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/CsStatisticalSetPO.java b/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/CsStatisticalSetPO.java new file mode 100644 index 000000000..c411c136f --- /dev/null +++ b/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/CsStatisticalSetPO.java @@ -0,0 +1,30 @@ +package com.njcn.system.pojo.po; + + +import com.baomidou.mybatisplus.annotation.TableName; +import com.github.jeffreyning.mybatisplus.anno.MppMultiId; +import lombok.Data; + +/** + * + * Description: + * Date: 2023/6/9 16:17【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +@TableName(value = "cs_statistical_set") +public class CsStatisticalSetPO { + /** + * 统计类型id + */ + @MppMultiId(value = "statisical_id") + private String statisicalId; + + /** + * 指标id + */ + @MppMultiId(value = "target_id") + private String targetId; +} \ No newline at end of file diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/SysDicTreePO.java b/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/SysDicTreePO.java new file mode 100644 index 000000000..c1617ab27 --- /dev/null +++ b/pqs-system/system-api/src/main/java/com/njcn/system/pojo/po/SysDicTreePO.java @@ -0,0 +1,72 @@ +package com.njcn.system.pojo.po; + +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 java.util.Date; + +import com.njcn.db.bo.BaseEntity; +import lombok.Data; + +/** + * + * Description: + * Date: 2023/6/9 14:00【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +@TableName(value = "sys_dic_tree") +public class SysDicTreePO extends BaseEntity { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + private String id; + + /** + * 父id + */ + @TableField(value = "pid") + private String pid; + + /** + * 父ids + */ + @TableField(value = "pids") + private String pids; + + /** + * 名称 + */ + @TableField(value = "`name`") + private String name; + + /** + * 编码 + */ + @TableField(value = "code") + private String code; + + /** + * 排序 + */ + @TableField(value = "sort") + private Integer sort; + + /** + * 描述 + */ + @TableField(value = "remark") + private String remark; + + /** + * 状态(字典 0正常 1停用 2删除) + */ + @TableField(value = "`status`") + private String status; + + +} \ No newline at end of file diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/CsStatisticalSetPOMapper.java b/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/CsStatisticalSetPOMapper.java new file mode 100644 index 000000000..b558e150e --- /dev/null +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/CsStatisticalSetPOMapper.java @@ -0,0 +1,16 @@ +package com.njcn.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; +import com.njcn.system.pojo.po.CsStatisticalSetPO; + +/** + * + * Description: + * Date: 2023/6/9 16:17【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface CsStatisticalSetPOMapper extends MppBaseMapper { +} \ No newline at end of file diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/SysDicTreePOMapper.java b/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/SysDicTreePOMapper.java new file mode 100644 index 000000000..52070a18d --- /dev/null +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/SysDicTreePOMapper.java @@ -0,0 +1,20 @@ +package com.njcn.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.system.pojo.po.SysDicTreePO; +import com.njcn.system.pojo.vo.DictTreeVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * + * Description: + * Date: 2023/6/9 14:00【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface SysDicTreePOMapper extends BaseMapper { + List queryByid(@Param("id") String id); +} \ No newline at end of file diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/mapping/SysDicTreePOMapper.xml b/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/mapping/SysDicTreePOMapper.xml new file mode 100644 index 000000000..74244b3f1 --- /dev/null +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/mapper/mapping/SysDicTreePOMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + id, pid, pids, `name`, code, sort, remark, `status`, create_time, create_by, update_time, + update_by + + + + \ No newline at end of file diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/CsStatisticalSetPOService.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/CsStatisticalSetPOService.java new file mode 100644 index 000000000..6335b7bc3 --- /dev/null +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/CsStatisticalSetPOService.java @@ -0,0 +1,27 @@ +package com.njcn.system.service; + +import com.github.jeffreyning.mybatisplus.service.IMppService; +import com.njcn.system.pojo.po.CsStatisticalSetPO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.system.pojo.po.EleEpdPqd; +import com.njcn.system.pojo.vo.CsStatisticalSetVO; + +import java.util.List; + +/** + * + * Description: + * Date: 2023/6/9 16:17【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface CsStatisticalSetPOService extends IMppService { + + + Boolean saveData(String id, List ids); + + CsStatisticalSetVO queryStatistical(String id); + + List queryStatisticalSelect(String id); +} diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/SysDicTreePOService.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/SysDicTreePOService.java new file mode 100644 index 000000000..54a0ae80c --- /dev/null +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/SysDicTreePOService.java @@ -0,0 +1,28 @@ +package com.njcn.system.service; + +import com.njcn.system.pojo.param.DictTreeParam; +import com.njcn.system.pojo.po.SysDicTreePO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.system.pojo.vo.DictTreeVO; + +import java.util.List; + +/** + * + * Description: + * Date: 2023/6/9 14:00【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface SysDicTreePOService extends IService{ + + + boolean addDictTree(DictTreeParam dictTreeParam); + + List queryByPid(String pid); + + DictTreeVO queryByCode(String code); + + List queryByid(String id); +} diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/CsStatisticalSetPOServiceImpl.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/CsStatisticalSetPOServiceImpl.java new file mode 100644 index 000000000..32493255f --- /dev/null +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/CsStatisticalSetPOServiceImpl.java @@ -0,0 +1,102 @@ +package com.njcn.system.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.system.pojo.po.EleEpdPqd; +import com.njcn.system.pojo.vo.CsStatisticalSetVO; +import com.njcn.system.pojo.vo.EleEpdPqdListVO; +import com.njcn.system.service.IEleEpdPqdService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.system.mapper.CsStatisticalSetPOMapper; +import com.njcn.system.pojo.po.CsStatisticalSetPO; +import com.njcn.system.service.CsStatisticalSetPOService; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * Description: + * Date: 2023/6/9 16:17【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Service +@RequiredArgsConstructor +public class CsStatisticalSetPOServiceImpl extends MppServiceImpl implements CsStatisticalSetPOService{ + + private final IEleEpdPqdService epdPqdService; + + @Override + @Transactional(rollbackFor = {Exception.class}) + public Boolean saveData(String id, List ids) { + List csStatisticalSetPOList = new ArrayList<>(); + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.lambda().eq(CsStatisticalSetPO::getStatisicalId, id); + this.getBaseMapper().delete(queryWrap); + ids.forEach(tempId -> { + CsStatisticalSetPO csStatisticalSetPO = new CsStatisticalSetPO(); + csStatisticalSetPO.setStatisicalId(id); + csStatisticalSetPO.setTargetId(tempId); + csStatisticalSetPOList.add(csStatisticalSetPO); + }); + boolean b = this.saveBatch(csStatisticalSetPOList); + return b; + } + + @Override + public CsStatisticalSetVO queryStatistical(String id) { + CsStatisticalSetVO csStatisticalSetVO = new CsStatisticalSetVO(); + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.lambda().eq(CsStatisticalSetPO::getStatisicalId, id); + List result = this.baseMapper.selectList(queryWrap); + List collect = result.stream().map(CsStatisticalSetPO::getTargetId).collect(Collectors.toList()); + List allList = epdPqdService.selectAll(); + List selectedList = new ArrayList<>(); + List unSelectedList = new ArrayList<>(); + + + + for (EleEpdPqdListVO temp :allList){ + EleEpdPqdListVO selected = new EleEpdPqdListVO(); + EleEpdPqdListVO unSelected = new EleEpdPqdListVO(); + List all = temp.getEleEpdPqdVOS(); + List selectedELe = all.stream().filter(tempEleEpdPqd -> collect.contains(tempEleEpdPqd.getId())).collect(Collectors.toList()); + List unSelectedELe = all.stream().filter(tempEleEpdPqd -> !collect.contains(tempEleEpdPqd.getId())).collect(Collectors.toList()); + + selected.setDataTypeName(temp.getDataTypeName()); + selected.setDataType(temp.getDataTypeName()); + selected.setEleEpdPqdVOS(selectedELe); + unSelected.setDataTypeName(temp.getDataTypeName()); + unSelected.setDataType(temp.getDataTypeName()); + unSelected.setEleEpdPqdVOS(unSelectedELe); + selectedList.add(selected); + unSelectedList.add(unSelected); + } + csStatisticalSetVO.setUnSelectedList(unSelectedList); + csStatisticalSetVO.setSelectedList(selectedList); + + + + return csStatisticalSetVO; + } + + @Override + public List queryStatisticalSelect(String id) { + QueryWrapper queryWrap = new QueryWrapper<>(); + queryWrap.lambda().eq(CsStatisticalSetPO::getStatisicalId, id); + List result = this.baseMapper.selectList(queryWrap); + List collect = result.stream().map(CsStatisticalSetPO::getTargetId).collect(Collectors.toList()); + List eleEpdPqds = epdPqdService.listByIds(collect); + return eleEpdPqds; + } +} + + diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/SysDicTreePOServiceImpl.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/SysDicTreePOServiceImpl.java new file mode 100644 index 000000000..6a5e69f1c --- /dev/null +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/SysDicTreePOServiceImpl.java @@ -0,0 +1,98 @@ +package com.njcn.system.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.njcn.system.pojo.param.DictTreeParam; +import com.njcn.system.pojo.vo.DictTreeVO; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.system.mapper.SysDicTreePOMapper; +import com.njcn.system.pojo.po.SysDicTreePO; +import com.njcn.system.service.SysDicTreePOService; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * Description: + * Date: 2023/6/9 14:00【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Service +public class SysDicTreePOServiceImpl extends ServiceImpl implements SysDicTreePOService{ + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean addDictTree(DictTreeParam dictTreeParam) { + SysDicTreePO sysDicTreePO = new SysDicTreePO(); + BeanUtils.copyProperties(dictTreeParam, sysDicTreePO); + if(!Objects.equals(sysDicTreePO.getPid(), "0")){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + + queryWrapper.eq("id", sysDicTreePO.getPid()); + SysDicTreePO instance = this.baseMapper.selectOne(queryWrapper); + + + sysDicTreePO.setPids(instance.getPids()+","+instance.getId()); + + }else{ + sysDicTreePO.setPids("0"); + } + sysDicTreePO.setStatus("0"); + boolean save = this.save(sysDicTreePO); + + return save; + } + + @Override + public List queryByPid(String pid) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.clear(); + query.eq(SysDicTreePO::getPid, pid).eq(SysDicTreePO::getStatus,"0"); + List resultList = this.list(query); + + SysDicTreePO byId = this.getById(pid); + + if (resultList != null && resultList.size() > 0) { + List collect = resultList.stream().map(temp -> { + DictTreeVO resultVO = new DictTreeVO(); + BeanUtils.copyProperties(temp, resultVO); + + resultVO.setPname(byId.getName()); + return resultVO; + }).collect(Collectors.toList()); + return collect; + } + return null; + } + + @Override + public DictTreeVO queryByCode(String code) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.clear(); + query.eq(SysDicTreePO::getCode, code).eq(SysDicTreePO::getStatus,"0"); + SysDicTreePO result = this.getOne(query); + + if (result != null) { + DictTreeVO resultVO = new DictTreeVO(); + BeanUtils.copyProperties(result, resultVO); + return resultVO; + } + + return null; + } + + @Override + public List queryByid(String id) { + List dictTreeVOS=this.baseMapper.queryByid(id); + return dictTreeVOS; + } + +}