diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java index 304b7f8..0a31a50 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java @@ -1,5 +1,6 @@ package com.hz.pm.api.external.model.dto; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -38,4 +39,9 @@ public class MhUnitDTO { */ private String unifiedSocialCreditCode; + /** + * 简称 + */ + private String shortName; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml index 403ccab..c1fa6af 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml @@ -374,6 +374,12 @@ and p.approval_amount <= #{req.approveAmountMax} + + and p.review_amount >= #{req.reviewAmountMin} + + + and p.review_amount <= #{req.reviewAmountMax} + and p.build_org_code = #{req.userValue} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java index 29339e5..e2e7de6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java @@ -108,4 +108,10 @@ public class ProjectListReq extends PagePo { @ApiModelProperty("区域编码") private String userRegionCode; + + @ApiModelProperty("评审金额最小值") + private BigDecimal reviewAmountMin; + + @ApiModelProperty("评审金额最大值") + private BigDecimal reviewAmountMax; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java index 814c5ac..abb7bce 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java @@ -1,9 +1,9 @@ package com.hz.pm.api.user.controller; -import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; import com.hz.pm.api.user.manage.MhUnitManage; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO; +import com.hz.pm.api.user.model.dto.UnitDTO; import com.hz.pm.api.user.model.po.MhUnitListReq; import com.hz.pm.api.user.model.po.UserTreeReq; import com.hz.pm.api.user.model.vo.MhUnitListVO; @@ -39,10 +39,10 @@ public class MhUnitController { return mhUnitManage.getMhUnitTree(); } - @GetMapping("/treeByStrip") + @GetMapping("/strip/tree") @ApiOperation("按照领域查询单位树") - public List getMhUnitTreeByStrip(Integer unitStrip) { - return mhUnitManage.getMhUnitTreeByStrip(unitStrip); + public List getMhUnitStripTree() { + return mhUnitManage.getMhUnitStripTree(); } @GetMapping("/page") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java index a8c5744..815148a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java @@ -14,6 +14,8 @@ import java.util.List; */ public interface MhUnitCache { + List getUnitIdPaths(Long unitId); + List all(); UnitDTO getById(Long id); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java index 629a2ad..b1c02d5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java @@ -3,6 +3,7 @@ package com.hz.pm.api.user.helper.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.IterUtil; +import cn.hutool.core.lang.Assert; import com.github.benmanes.caffeine.cache.CacheLoader; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; @@ -45,9 +46,11 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { private LoadingCache cache; private final Map> childIdMap = new ConcurrentHashMap<>(); + private final Map parentIdMap = new ConcurrentHashMap<>(); private void putToChildIdMap(Long childId, Long parentId) { List childIds = Lists.newArrayList(childId); + parentIdMap.put(childId, parentId); childIdMap.merge(parentId, childIds, (v1, v2) -> { v1.addAll(v2); return v1; @@ -131,6 +134,18 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { return childIds; } + @Override + public List getUnitIdPaths(Long unitId) { + Assert.notNull(unitId, "单位ID不能为空"); + List nodeIdPaths = new ArrayList<>(); + Long currUnitId = unitId, parentId; + while ((parentId = parentIdMap.get(currUnitId)) != null) { + nodeIdPaths.add(0, currUnitId); + currUnitId = parentId; + } + return nodeIdPaths; + } + private void collectChildId(List collect, Long parentId) { List childIds = childIdMap.get(parentId); if (childIds != null) { @@ -139,5 +154,4 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { } } - } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java index 66a4421..a6a0b1e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java @@ -1,12 +1,10 @@ package com.hz.pm.api.user.manage; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.lang.Assert; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.common.util.StrUtils; -import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; @@ -28,7 +26,9 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.List; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -57,18 +57,21 @@ public class MhUnitManage { return TreeUtil.convertToTree(nodes, 0L); } - public List getMhUnitTreeByStrip(Integer unitStrip) { - Assert.notNull(unitStrip, "领域不能为空"); - + public List getMhUnitStripTree() { List allUnits = mhUnitCache.all(); List nodes = allUnits.stream() - .filter(w -> w.getType() != null && w.getType().getStrip().eq(unitStrip)) - .map(w -> { - MhUnitTreeDTO node = BeanUtil.copyProperties(w, MhUnitTreeDTO.class); - node.setStrip(node.getStrip()); - return node; - }).collect(Collectors.toList()); - return convertToTree(nodes); + .filter(w -> MhUnitTypeEnum.SASAC.equals(w.getType()) || + ((MhUnitTypeEnum.REGION.equals(w.getType()) || MhUnitTypeEnum.NODE.equals(w.getType())) + && w.getName().endsWith("信创办"))) + .map(w -> BeanUtil.copyProperties(w, MhUnitTreeDTO.class)) + .collect(Collectors.toList()); + Function function = w -> w.getType().getStrip().getCode(); + nodes.sort(Comparator.comparing(MhUnitTreeDTO::getName) + .thenComparing(function, Comparator.reverseOrder())); + for (MhUnitTreeDTO node : nodes) { + System.out.println(node.getName()); + } + return nodes; } public PageVo page(MhUnitListReq req) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java index ebcfd9a..7288a0a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java @@ -179,6 +179,7 @@ public class SyncMhUserOrgManage { unit.setParentId(org.getUnitPid()); unit.setId(org.getUnitId()); unit.setType(org.getType()); + unit.setShortName(org.getShortName()); unit.setUnifiedSocialCreditCode(org.getUnifiedSocialCreditCode()); updateUnits.add(unit); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java index 9d57bd5..4bf0573 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java @@ -31,6 +31,8 @@ public class MhUnitTreeDTO implements ITree { private Short sort; + private String shortName; + private List children; @Override diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java index 065fbcd..133ae72 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java @@ -1,6 +1,7 @@ package com.hz.pm.api.user.model.dto; import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -18,6 +19,9 @@ public class UnitDTO { private String name; + @ApiModelProperty("简称") + private String shortName; + private Long parentId; private Short sort; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java index 93d9ff1..81c621d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @@ -42,6 +43,9 @@ public class MhUnit implements Serializable { */ private String unifiedSocialCreditCode; + @ApiModelProperty("简称") + private String shortName; + private LocalDateTime createOn; private LocalDateTime updateOn; diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java index 9af1a6d..07ac007 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java @@ -1,14 +1,15 @@ package com.hz.pm.api.todocenter; -import cn.hutool.core.io.FileUtil; import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.api.external.model.dto.MhUnitDTO; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.service.IMhUnitService; import com.ningdatech.basic.exception.BizException; -import com.hz.pm.api.AppTests; +import com.ningdatech.basic.util.CollUtils; import com.wflow.bean.entity.WflowCcTasks; import com.wflow.mapper.WflowCcTasksMapper; import com.wflow.utils.CodeUtil; @@ -24,7 +25,6 @@ import org.flowable.common.engine.impl.cmd.CustomSqlExecution; import org.flowable.engine.*; import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.history.HistoricProcessInstanceQuery; import org.flowable.engine.impl.cmd.AbstractCustomSqlExecution; import org.flowable.engine.runtime.Execution; import org.flowable.task.api.Task; @@ -316,18 +316,17 @@ public class FlowableTest extends AppTests { @Autowired private IMhUnitService mhUnitService; + @Autowired + private MhUnitCache mhUnitCache; @Test - public void test(){ - String s = FileUtil.readUtf8String("/Users/wendy/Desktop/response.json"); - List units = JSONUtil.parseObj(s).getBeanList("data", MhUnitDTO.class); - for (MhUnitDTO unit : units) { - LambdaUpdateWrapper set = Wrappers.lambdaUpdate(MhUnit.class) - .eq(MhUnit::getId, unit.getUnitId()) - .set(MhUnit::getUnifiedSocialCreditCode,unit.getUnifiedSocialCreditCode()) - .set(MhUnit::getType, unit.getType()); - mhUnitService.update(set); - } + public void test() { + List unitIdPaths = mhUnitCache.getUnitIdPaths(2894L); + String orderSql = String.format(" order by field(id, %s) desc", CollUtils.joinByComma(unitIdPaths)); + LambdaQueryWrapper query = Wrappers.lambdaQuery(MhUnit.class) + .in(MhUnit::getId, unitIdPaths) + .last(orderSql + BizConst.LIMIT_1); + System.out.println(mhUnitService.getOne(query)); } }