Bläddra i källkod

信产单位增加简称字段

tags/24080901
WendyYang 10 månader sedan
förälder
incheckning
c0caae3576
12 ändrade filer med 79 tillägg och 32 borttagningar
  1. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java
  2. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml
  3. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java
  4. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java
  5. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java
  6. +15
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java
  7. +15
    -12
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java
  8. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java
  9. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java
  10. +4
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java
  11. +4
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java
  12. +14
    -15
      hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java

+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java Visa fil

@@ -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;

}

+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml Visa fil

@@ -374,6 +374,12 @@
<if test="req.approveAmountMax != null">
and p.approval_amount &lt;= #{req.approveAmountMax}
</if>
<if test="req.reviewAmountMin != null">
and p.review_amount &gt;= #{req.reviewAmountMin}
</if>
<if test="req.reviewAmountMax != null">
and p.review_amount &lt;= #{req.reviewAmountMax}
</if>
<if test="req.userType != null and req.userType == 'normal'">
and p.build_org_code = #{req.userValue}
</if>


+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java Visa fil

@@ -108,4 +108,10 @@ public class ProjectListReq extends PagePo {

@ApiModelProperty("区域编码")
private String userRegionCode;

@ApiModelProperty("评审金额最小值")
private BigDecimal reviewAmountMin;

@ApiModelProperty("评审金额最大值")
private BigDecimal reviewAmountMax;
}

+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java Visa fil

@@ -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<MhUnitTreeDTO> getMhUnitTreeByStrip(Integer unitStrip) {
return mhUnitManage.getMhUnitTreeByStrip(unitStrip);
public List<MhUnitTreeDTO> getMhUnitStripTree() {
return mhUnitManage.getMhUnitStripTree();
}

@GetMapping("/page")


+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java Visa fil

@@ -14,6 +14,8 @@ import java.util.List;
*/
public interface MhUnitCache {

List<Long> getUnitIdPaths(Long unitId);

List<UnitDTO> all();

UnitDTO getById(Long id);


+ 15
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java Visa fil

@@ -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<Long, UnitDTO> cache;

private final Map<Long, List<Long>> childIdMap = new ConcurrentHashMap<>();
private final Map<Long, Long> parentIdMap = new ConcurrentHashMap<>();

private void putToChildIdMap(Long childId, Long parentId) {
List<Long> 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<Long> getUnitIdPaths(Long unitId) {
Assert.notNull(unitId, "单位ID不能为空");
List<Long> 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<Long> collect, Long parentId) {
List<Long> childIds = childIdMap.get(parentId);
if (childIds != null) {
@@ -139,5 +154,4 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean {
}
}


}

+ 15
- 12
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java Visa fil

@@ -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<MhUnitTreeDTO> getMhUnitTreeByStrip(Integer unitStrip) {
Assert.notNull(unitStrip, "领域不能为空");

public List<MhUnitTreeDTO> getMhUnitStripTree() {
List<UnitDTO> allUnits = mhUnitCache.all();
List<MhUnitTreeDTO> 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<MhUnitTreeDTO, Integer> 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<MhUnitListVO> page(MhUnitListReq req) {


+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java Visa fil

@@ -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);
}


+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java Visa fil

@@ -31,6 +31,8 @@ public class MhUnitTreeDTO implements ITree<Long, MhUnitTreeDTO> {

private Short sort;

private String shortName;

private List<MhUnitTreeDTO> children;

@Override


+ 4
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java Visa fil

@@ -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;


+ 4
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java Visa fil

@@ -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;


+ 14
- 15
hz-pm-api/src/test/java/com/hz/pm/api/todocenter/FlowableTest.java Visa fil

@@ -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<MhUnitDTO> units = JSONUtil.parseObj(s).getBeanList("data", MhUnitDTO.class);
for (MhUnitDTO unit : units) {
LambdaUpdateWrapper<MhUnit> 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<Long> unitIdPaths = mhUnitCache.getUnitIdPaths(2894L);
String orderSql = String.format(" order by field(id, %s) desc", CollUtils.joinByComma(unitIdPaths));
LambdaQueryWrapper<MhUnit> query = Wrappers.lambdaQuery(MhUnit.class)
.in(MhUnit::getId, unitIdPaths)
.last(orderSql + BizConst.LIMIT_1);
System.out.println(mhUnitService.getOne(query));
}

}

Laddar…
Avbryt
Spara