Browse Source

1.设计变更审核功能
2.用户绑定道路模糊查询

wangzhun 3 years ago
parent
commit
1387551d97
18 changed files with 485 additions and 89 deletions
  1. 39 14
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/controller/CustomPrjController.java
  2. 16 6
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/controller/CustomPsHistoryAppController.java
  3. 16 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/entity/CheckEntity.java
  4. 9 2
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/service/CustomPsHistoryAppService.java
  5. 148 55
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/service/impl/CustomPsHistoryAppServiceImpl.java
  6. 8 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/entity/PsnodeHistory.java
  7. 7 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/entity/PspipeHistory.java
  8. 4 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/mapper/PsnodeHistoryMapper.java
  9. 5 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/mapper/PspipeHistoryMapper.java
  10. 8 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/service/PsnodeHistoryService.java
  11. 4 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/service/PspipeHistoryService.java
  12. 15 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/service/impl/PsnodeHistoryServiceImpl.java
  13. 15 0
      sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/service/impl/PspipeHistoryServiceImpl.java
  14. 24 5
      sxgk-projet/sxgk/src/main/resources/mapper/PsnodeHistoryMapper.xml
  15. 22 6
      sxgk-projet/sxgk/src/main/resources/mapper/PspipeHistoryMapper.xml
  16. 64 0
      sxgk-projet/sxgk/src/test/java/com/tofly/sxgk/custom/controller/CustomPrjControllerTest.java
  17. 73 0
      sxgk-projet/sxgk/src/test/java/com/tofly/sxgk/custom/controller/CustomPsHistoryAppControllerTest.java
  18. 8 1
      sxgk-projet/sxgk/src/test/java/service/Test2.java

+ 39 - 14
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/controller/CustomPrjController.java

@@ -2,6 +2,7 @@ package com.tofly.sxgk.custom.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.tofly.common.core.entity.ResultRespone;
 import com.tofly.common.core.util.Date8Util;
@@ -27,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * @author tuonbed
@@ -152,9 +154,11 @@ public class CustomPrjController {
     @ApiOperation(tags="用户道路绑定表接口过滤项目",value = "获取用户绑定道路列表")
     @GetMapping("/useroad/listRoadsFilterPrj")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "userId", value = "用户ID,如果不传则为当前登录人员", required = false, dataType = "Long")
+            @ApiImplicitParam(name = "userId", value = "用户ID,如果不传则为当前登录人员", required = false, dataType = "Long"),
+            @ApiImplicitParam(name = "roadName", value = "街道名称", required = false, dataType = "String")
+
     })
-    public ResultRespone  listRoadsFilterPrj( @RequestParam(required = false)Long userId){
+    public ResultRespone  listRoadsFilterPrj( @RequestParam(required = false)Long userId, @RequestParam(required = false)String roadName){
         if(userId==null||userId.intValue()==0){
             userId=SecurityUtils.getUserId();
         }
@@ -165,10 +169,14 @@ public class CustomPrjController {
         if(s==null){
             //首先查询是否存在人工绑定
             List<Useroad> list = useroadService.list(Wrappers.<Useroad>lambdaQuery()
-                    .eq(Useroad::getUserId, userId).eq(Useroad::getPrjId,prjId1));
+                    .eq(Useroad::getUserId, userId).eq(Useroad::getPrjId,prjId1).like(StringUtils.isNotBlank(roadName),Useroad::getSdetailName,roadName));
+            List <Useroad> newList = new ArrayList<>();
             if(list!=null && list.size()>0){
-
-                return ResultRespone.success(list);
+                list.forEach(li->{
+                    li.setPrjId(prjId1);
+                    newList.add(li);
+                });
+                return ResultRespone.success(newList);
             }else{
                 Long deptId=SecurityUtils.getUserDeptId();
                 Long prjId = BaseInfoUtil.getPrjId(SecurityUtils.getUserId());
@@ -183,14 +191,14 @@ public class CustomPrjController {
                 List<Long> collect1 = psnodeService.list(Wrappers.<Psnode>query()
                         .select("distinct pid ").lambda()
                         .in(Psnode::getContractCode, collect)
-                        .or().in(Psnode::getDesignContractCode, collect))
+                        .or().in(Psnode::getDesignContractCode, collect).like(StringUtils.isNotBlank(roadName),Psnode::getDrawingProjectName,roadName))
                         .stream().map(Psnode::getPid).collect(Collectors.toList());
                 //
                 //通过合同信息查找pipe中的  查找 pid信息
                 List<Long> collect2 = pspipeService.list(Wrappers.<Pspipe>query()
                         .select("distinct pid ").lambda()
                         .in(Pspipe::getContractCode, collect)
-                        .or().in(Pspipe::getDesignContractCode, collect))
+                        .or().in(Pspipe::getDesignContractCode, collect).like(StringUtils.isNotBlank(roadName),Pspipe::getDrawingProjectName,roadName))
                         .stream().map(Pspipe::getPid).collect(Collectors.toList());
                 if(collect1!=null && collect1.size()>0){
                     collect1.addAll(collect2);
@@ -201,13 +209,30 @@ public class CustomPrjController {
                     return ResultRespone.success(null);
                 }else{
                     List<Structuredetail> detailLevel4desc = customPrjService.getDetailLevel4desc(collect1);
-                    List<Useroad> collect3 = detailLevel4desc.stream().map(st -> {
-                        Useroad useroad = new Useroad();
-                        useroad.setSdetailCode(st.getCode());
-                        useroad.setSdetailId(st.getId());
-                        useroad.setSdetailName(st.getName());
-                        return useroad;
-                    }).collect(Collectors.toList());
+                    List<Useroad> collect3;
+                    if(StringUtils.isNotBlank(roadName)){
+                         collect3 = detailLevel4desc.stream()
+                                .filter(d -> d.getName().indexOf(roadName)!=-1)
+                                .map(st -> {
+                                    Useroad useroad = new Useroad();
+                                    useroad.setSdetailCode(st.getCode());
+                                    useroad.setPrjId(prjId);
+                                    useroad.setSdetailId(st.getId());
+                                    useroad.setSdetailName(st.getName());
+                                    return useroad;
+                                }).collect(Collectors.toList());
+                    }else{
+                       collect3 = detailLevel4desc.stream()
+                                .map(st -> {
+                                    Useroad useroad = new Useroad();
+                                    useroad.setSdetailCode(st.getCode());
+                                    useroad.setSdetailId(st.getId());
+                                    useroad.setPrjId(prjId);
+                                    useroad.setSdetailName(st.getName());
+                                    return useroad;
+                                }).collect(Collectors.toList());
+                    }
+
 
 
                     return ResultRespone.success(collect3);

+ 16 - 6
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/controller/CustomPsHistoryAppController.java

@@ -3,6 +3,7 @@ package com.tofly.sxgk.custom.controller;
 
 import com.baomidou.mybatisplus.core.toolkit.Assert;
 import com.tofly.common.core.entity.ResultRespone;
+import com.tofly.sxgk.custom.entity.CheckEntity;
 import com.tofly.sxgk.custom.entity.CustomChildUnitVersionPublish;
 import com.tofly.sxgk.custom.service.CustomPsHistoryAppService;
 import com.tofly.sxgk.entity.PsnodeHistory;
@@ -43,7 +44,7 @@ private final CustomPsHistoryAppService customPsHistoryAppService;
     public ResultRespone nodeDesignUpdate(@RequestBody @Validated PsnodeHistory psnodeHistory){
         //新增
 
-        return  ResultRespone.success(customPsHistoryAppService.nodeUpdate(psnodeHistory,Boolean.TRUE));
+        return  ResultRespone.success(customPsHistoryAppService.nodeUpdate(psnodeHistory,Boolean.TRUE,Boolean.TRUE));
     }
 
     @ApiOperation(value = "管点删除")
@@ -79,7 +80,7 @@ private final CustomPsHistoryAppService customPsHistoryAppService;
     public ResultRespone pipeDesignUpdate(@RequestBody @Validated  PspipeHistory pspipeHistory){
 
 
-        return  ResultRespone.success(customPsHistoryAppService.pipeUpdate(pspipeHistory,Boolean.TRUE));
+        return  ResultRespone.success(customPsHistoryAppService.pipeUpdate(pspipeHistory,Boolean.TRUE,Boolean.TRUE));
     }
 
     @ApiOperation(value = "管线删除")
@@ -90,7 +91,7 @@ private final CustomPsHistoryAppService customPsHistoryAppService;
         customPsHistoryAppService.nodeDelete(pbsCode);
         return  ResultRespone.success();
     }
-    @ApiOperation(value = "版本发布  暂未实现")
+    @ApiOperation(value = "版本发布 ")
     @PostMapping(value = "/publish")
     @ResponseBody
     public  ResultRespone verionPublish(@RequestBody @Validated CustomChildUnitVersionPublish customChildUnitVersionPublish){
@@ -98,7 +99,16 @@ private final CustomPsHistoryAppService customPsHistoryAppService;
         return  ResultRespone.success(null);
     }
 
-
-
-
+    @ApiOperation(value = "管点审核")
+    @PostMapping(value = "/node/check")
+    @ResponseBody
+    public  ResultRespone nodeCheckPass(@RequestBody CheckEntity checkEntity){
+        return  ResultRespone.success(customPsHistoryAppService.nodeCheck(checkEntity));
+    }
+    @ApiOperation(value = "管线审核")
+    @PostMapping(value = "/pipe/check")
+    @ResponseBody
+    public  ResultRespone pipeCheckPass(@RequestBody CheckEntity checkEntity){
+        return  ResultRespone.success(customPsHistoryAppService.pipeCheck(checkEntity));
+    }
 }

+ 16 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/entity/CheckEntity.java

@@ -0,0 +1,16 @@
+package com.tofly.sxgk.custom.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class CheckEntity {
+    @ApiModelProperty(value = "pbs编码" ,required=true)
+    private String pbsCode;
+    @ApiModelProperty(value = "审核状态" ,required=true)
+    private String checkStatus;
+    @ApiModelProperty(value = "审核意见" ,required=false)
+    private String checkNote;
+
+    private Long userId;
+}

+ 9 - 2
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/service/CustomPsHistoryAppService.java

@@ -1,5 +1,6 @@
 package com.tofly.sxgk.custom.service;
 
+import com.tofly.sxgk.custom.entity.CheckEntity;
 import com.tofly.sxgk.custom.entity.CustomChildUnitVersionPublish;
 import com.tofly.sxgk.entity.PsnodeHistory;
 import com.tofly.sxgk.entity.PspipeHistory;
@@ -8,13 +9,13 @@ import org.springframework.stereotype.Service;
 public interface CustomPsHistoryAppService {
 
     public  PsnodeHistory nodeAdd(PsnodeHistory psnodeHistory);
-    public  PsnodeHistory nodeUpdate(PsnodeHistory psnodeHistory,boolean updateToPs);
+    public  PsnodeHistory nodeUpdate(PsnodeHistory psnodeHistory,boolean updateToPs,boolean isNeedCheck);
     public  void nodeDelete(String pbsCode);
 
 
 
     public PspipeHistory pipeAdd(PspipeHistory pspipeHistory);
-    public PspipeHistory pipeUpdate(PspipeHistory pspipeHistory,boolean updateToPs);
+    public PspipeHistory pipeUpdate(PspipeHistory pspipeHistory,boolean updateToPs,boolean isNeedCheck);
     public  void pipeDelete(String pbsCode);
 
     /**
@@ -23,4 +24,10 @@ public interface CustomPsHistoryAppService {
      * @return
      */
     public  String  childUntVersionPublish(CustomChildUnitVersionPublish customChildUnitVersionPublish);
+
+
+    public Boolean nodeCheck(CheckEntity checkEntity);
+
+
+    public Boolean pipeCheck(CheckEntity checkEntity);
 }

+ 148 - 55
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/custom/service/impl/CustomPsHistoryAppServiceImpl.java

@@ -1,9 +1,10 @@
 package com.tofly.sxgk.custom.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.Assert;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
 import com.tofly.common.oauth.util.SecurityUtils;
+import com.tofly.sxgk.custom.entity.CheckEntity;
 import com.tofly.sxgk.custom.entity.CustomChildUnitVersionPublish;
 import com.tofly.sxgk.custom.service.CustomPsHistoryAppService;
 import com.tofly.sxgk.custom.util.PbsCodeBuilderUtil;
@@ -38,8 +39,8 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
     private final  AreacompanyService areacompanyService;
 
     private final PbsprjService pbsprjService;
-
-
+    //是否需要审核
+    private final  static Boolean isNeedCheck=Boolean.FALSE;
     private final  static  short version_seq_default=1;
     private final  static  short version_default = 1;
     private  final static short modify_version_default=1;
@@ -49,13 +50,14 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
         psnodeHistory.setIsPublish("1");
         paraVerification(psnodeHistory,Boolean.TRUE);
         fillCode(psnodeHistory);
-        saveToNodeAndHistory(psnodeHistory,Boolean.TRUE);
+
+        saveToNodeAndHistory(psnodeHistory,Boolean.TRUE,isNeedCheck);
 
         return psnodeHistory;
 
     }
     @Override
-    public PsnodeHistory nodeUpdate(PsnodeHistory psnodeHistory,boolean updateToPs) {
+    public PsnodeHistory nodeUpdate(PsnodeHistory psnodeHistory,boolean updateToPs,boolean isNeedCheck) {
         paraVerification(psnodeHistory,Boolean.FALSE);
         //查询该pbs编码  最后一条记录
 
@@ -71,13 +73,15 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
             PsnodeHistory psnodeHistoryOld = new PsnodeHistory();
             BeanUtils.copyProperties(sourcePsnode,psnodeHistoryOld);
             psnodeHistoryOld.setId(null);
-            psnodeHistoryOld.setModifyVersion(modify_version_default);
+            psnodeHistoryOld.setModifyVersion(psnodeHistoryService.getMaxModifyVersion(pbsCode,modify_version_default));
             psnodeHistoryOld.setPublishVersion(psnodeHistoryService.
                     getMaxChildUnitVersion(getChildUnitCodeByPbsCode(psnodeHistory.getCode())));
             psnodeHistoryOld.setPublishVersionSeq(version_seq_default);
+            psnodeHistoryOld.setIsPublish("1");
+            psnodeHistoryOld.setIsNew("1");
             psnodeHistoryService.saveOrUpdate(psnodeHistoryOld);
         }else {
-            modifyVersion  = currentHistory.getModifyVersion();
+            modifyVersion  = psnodeHistoryService.getMaxModifyVersion(pbsCode,modify_version_default);
 
             if( psnodeHistory.getPublishVersionSeq()!=null){
                 publishVersionSeq  = psnodeHistory.getPublishVersionSeq();
@@ -96,26 +100,24 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
         psnodeHistory.setModifyVersion(modifyVersion);
         psnodeHistory.setPublishVersion(version);
         psnodeHistory.setPublishVersionSeq(publishVersionSeq);
-
+        psnodeHistory.setIsNew("0");
+        psnodeHistory.setIsPublish("1");
+        psnodeHistoryService.saveOrUpdate(psnodeHistory);
         //更新原有数据为isnew 0
+        if(!isNeedCheck){
+            synchronized (this){
+                updateNodeIsNew("0",currentHistory.getId());
+                psnodeHistory.setIsNew("1");
+                psnodeHistory.setModifyTime(new Date());
+                psnodeHistoryService.saveOrUpdate(psnodeHistory);
 
-        synchronized (this){
-            updateNodeIsNew("0",currentHistory.getId());
-            psnodeHistory.setIsNew("1");
-            psnodeHistory.setModifyTime(new Date());
-            psnodeHistoryService.saveOrUpdate(psnodeHistory);
-
+            }
         }
 
-    if(updateToPs){
-        //更新成果表
-        Psnode oldPsnode = psnodeService.getOne(Wrappers.<Psnode>lambdaQuery().eq(Psnode::getCode, psnodeHistory.getCode()));
-        Long oldPspipeId = oldPsnode.getId();
-
-        BeanUtils.copyProperties(psnodeHistory,oldPsnode);
-        oldPsnode.setId(oldPspipeId);
 
-        psnodeService.saveOrUpdate(oldPsnode);
+    if(updateToPs&&!isNeedCheck){
+        //更新成果表
+        updateNodeByHistory(psnodeHistory);
     }
 
 
@@ -140,14 +142,14 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
         pspipeHistory.setIsPublish("1");
         paraVerification(pspipeHistory,Boolean.TRUE);
         fillCode(pspipeHistory);
-        saveToPipeAndHistory(pspipeHistory);
+        saveToPipeAndHistory(pspipeHistory,Boolean.TRUE,isNeedCheck);
         return pspipeHistory;
 
 
     }
     @Override
     @Transactional
-    public PspipeHistory pipeUpdate(PspipeHistory pspipeHistory,boolean updateToPs) {
+    public PspipeHistory pipeUpdate(PspipeHistory pspipeHistory,boolean updateToPs,boolean isNeedCheck) {
 
         paraVerification(pspipeHistory,Boolean.FALSE);
 
@@ -166,14 +168,14 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
             PspipeHistory pspipeHistoryOld = new PspipeHistory();
             BeanUtils.copyProperties(sourcePspipe,pspipeHistoryOld);
             pspipeHistoryOld.setId(null);
-            pspipeHistoryOld.setModifyVersion(modify_version_default);
+            pspipeHistoryOld.setModifyVersion(pspipeHistoryService.getMaxModifyVersion(pbsCode,modify_version_default));
             //发布版本号 来源于其他
             pspipeHistoryOld.setPublishVersion(pspipeHistoryService.
                     getMaxChildUnitVersion(getChildUnitCodeByPbsCode(pspipeHistory.getCode())));
             pspipeHistoryOld.setPublishVersionSeq(version_seq_default);
             pspipeHistoryService.saveOrUpdate(pspipeHistoryOld);
         }else {
-            modifyVersion  = currentHistory.getModifyVersion();
+            modifyVersion = pspipeHistoryService.getMaxModifyVersion(pbsCode,modify_version_default);
             publishVersionSeq =  currentHistory.getPublishVersionSeq();
             version = currentHistory.getPublishVersion();
             modifyVersion++;
@@ -188,14 +190,22 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
 //            currentHistory.setIsNew("0");
 //            pspipeHistoryService.saveOrUpdate(currentHistory);
             //将原有的最新的数据更新为非最新
-            updatePipeIsNew("0",currentHistory.getId());
-            pspipeHistory.setIsNew("1");
-            pspipeHistory.setModifyTime(new Date());
-            pspipeHistoryService.saveOrUpdate(pspipeHistory);
+        pspipeHistory.setIsNew("0");
+        pspipeHistory.setIsPublish("1");
+        pspipeHistoryService.saveOrUpdate(pspipeHistory);
+        if(!isNeedCheck){
+            synchronized (this){
+                updatePipeIsNew("0",currentHistory.getId());
+                pspipeHistory.setIsNew("1");
+                pspipeHistory.setModifyTime(new Date());
+                pspipeHistoryService.saveOrUpdate(pspipeHistory);
+            }
+        }
 
 
 
-        if(updateToPs){
+
+        if(updateToPs&&!isNeedCheck){
             //更新成果表
             Pspipe oldPspipe = pspipeService.getOne(Wrappers.<Pspipe>lambdaQuery().eq(Pspipe::getCode, pspipeHistory.getCode()));
             Long oldPspipeId = oldPspipe.getId();
@@ -245,6 +255,64 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
 
     }
 
+    @Override
+    public Boolean nodeCheck(CheckEntity checkEntity) {
+
+        PsnodeHistory currentForCheckHistory =
+                psnodeHistoryService.findCurrentForCheckHistory(checkEntity.getPbsCode());
+        Assert.notNull(currentForCheckHistory,"该部件无法审核");
+        checkEntity.setUserId(SecurityUtils.getUserId());
+        currentForCheckHistory.setCheckNote(JSON.toJSONString(checkEntity));
+        //审核通过
+        if("1".equals(checkEntity.getCheckStatus())){
+            PsnodeHistory currentHistory = psnodeHistoryService.findCurrentHistory(checkEntity.getPbsCode());
+            currentForCheckHistory.setIsNew("1");
+            psnodeHistoryService.saveOrUpdate(currentForCheckHistory);
+            updateNodeIsNew("0",currentHistory.getId());
+            //更新成果表
+            updateNodeByHistory(currentForCheckHistory);
+
+        }else{
+         //审核未通过
+            currentForCheckHistory.setIsPublish("0");
+            psnodeHistoryService.saveOrUpdate(currentForCheckHistory);
+
+            psnodeHistoryService.removeById(currentForCheckHistory.getId());
+        }
+
+        return null;
+    }
+
+    @Override
+    @Transactional
+    public Boolean pipeCheck(CheckEntity checkEntity) {
+
+        PspipeHistory currentForCheckHistory =
+                pspipeHistoryService.findCurrentForCheckHistory(checkEntity.getPbsCode());
+        Assert.notNull(currentForCheckHistory,"该部件无法审核");
+        checkEntity.setUserId(SecurityUtils.getUserId());
+        currentForCheckHistory.setCheckNote(JSON.toJSONString(checkEntity));
+        //审核通过
+        if("1".equals(checkEntity.getCheckStatus())){
+            PspipeHistory currentHistory = pspipeHistoryService.findCurrentHistory(checkEntity.getPbsCode());
+            currentForCheckHistory.setIsNew("1");
+            pspipeHistoryService.saveOrUpdate(currentForCheckHistory);
+            updatePipeIsNew("0",currentHistory.getId());
+            //更新成果表
+            updatePipeByHistory(currentForCheckHistory);
+
+        }else{
+            //审核未通过
+            currentForCheckHistory.setIsPublish("0");
+            pspipeHistoryService.saveOrUpdate(currentForCheckHistory);
+
+            pspipeHistoryService.removeById(currentForCheckHistory.getId());
+        }
+
+        return Boolean.TRUE;
+    }
+
+
     private void publishPipeVersionToHistory(Structuredetail childUnitDetail, CustomChildUnitVersionPublish customChildUnitVersionPublish) {
         Short publishVersion = customChildUnitVersionPublish.getPublishVersion();
         if(publishVersion==null || publishVersion==0){
@@ -301,7 +369,7 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
         for(PsnodeHistory li:list){
             li.setPublishVersion(publishVersion);
             li.setPublishVersionSeq(version_seq_default);
-            nodeUpdate(li,Boolean.FALSE);
+            nodeUpdate(li,Boolean.FALSE,Boolean.FALSE);
         }
 
         //查询成果表具体数据
@@ -338,7 +406,7 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
     }
 
 
-    private void saveToPipeAndHistory(PspipeHistory pspipeHistory) {
+    private void saveToPipeAndHistory(PspipeHistory pspipeHistory,boolean isAddToPs,boolean isNeedCheck) {
         //保存到历史库  新增
         pspipeHistory.setModifyTime(new Date());
         pspipeHistory.setModifyVersion(modify_version_default);
@@ -354,13 +422,14 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
                 getMaxChildUnitVersion(getChildUnitCodeByPbsCode(pspipeHistory.getCode())));
         pspipeHistory.setIsNew("1");
         pspipeHistoryService.save(pspipeHistory);
-
-
+        if(isAddToPs&&!isNeedCheck){
             Pspipe pspipe = new Pspipe();
             BeanUtils.copyProperties(pspipeHistory,pspipe);
             pspipe.setId(null);
-
             pspipeService.saveOrUpdate(pspipe);
+        }
+
+
 
 
 
@@ -373,7 +442,7 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
      * addToPs  是否增加到成果表中
      */
     @Transactional
-     void saveToNodeAndHistory(PsnodeHistory psnodeHistory,boolean isAddToPs) {
+     void saveToNodeAndHistory(PsnodeHistory psnodeHistory,boolean isAddToPs,boolean isNeedCheck) {
 
         //保存到历史库  新增
         psnodeHistory.setModifyTime(new Date());
@@ -383,11 +452,17 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
 
         //struct 保存
         saveStructure(psnodeHistory);
-        psnodeHistory.setIsNew("1");
+        if(isNeedCheck){
+            psnodeHistory.setIsNew("0");
+        }else{
+            psnodeHistory.setIsNew("1");
+        }
+
         psnodeHistory.setPublishVersion(psnodeHistoryService.
                 getMaxChildUnitVersion(getChildUnitCodeByPbsCode(psnodeHistory.getCode())));
         psnodeHistoryService.save(psnodeHistory);
-            if(isAddToPs){
+            //如果此处不通过,则审核通过后再增加到成果表中
+            if(isAddToPs&&!isNeedCheck){
                 Psnode psnode = new Psnode();
                 BeanUtils.copyProperties(psnodeHistory,psnode);
                 psnode.setId(null);
@@ -401,6 +476,7 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
 
 
     }
+
     @Transactional
      void saveStructure(Object obj)  {
         Long prjId =null;
@@ -467,6 +543,9 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
             psnodeHistory.setId(null);
             //验证code  是否传入
             Assert.notNull(psnodeHistory.getCode(),"pbs编码未传入,请检查后传入");
+
+            PsnodeHistory currentForCheckHistory = psnodeHistoryService.findCurrentForCheckHistory(psnodeHistory.getCode());
+            Assert.isNull(currentForCheckHistory,"该部件存在待审核数据,请联系管理员审核后再修改");
         }
 
     }
@@ -490,6 +569,9 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
             pspipeHistory.setId(null);
             //验证code  是否传入
             Assert.notNull(pspipeHistory.getCode(),"pbs编码未传入,请检查后传入");
+            //验证是否存在待审核数据
+            PspipeHistory currentForCheckHistory = pspipeHistoryService.findCurrentForCheckHistory(pspipeHistory.getCode());
+            Assert.isNull(currentForCheckHistory,"该部件存在待审核数据,请联系管理员审核后再修改");
         }
 
     }
@@ -548,24 +630,14 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
     }
 
 
-    private synchronized void updatePipeIsNew(String isNew,Long... id){
-        synchronized (CustomPsHistoryAppServiceImpl.class){
-            boolean update1 = pspipeHistoryService.update(Wrappers.<PspipeHistory>lambdaUpdate()
-                    .eq(PspipeHistory::getId, id).eq(PspipeHistory::getIsNew, "1").set(PspipeHistory::getIsNew, isNew));
-            if(!update1){
-
-            }
-        }
+    private synchronized void updatePipeIsNew(String isNew,Long  id){
+             pspipeHistoryService.update(Wrappers.<PspipeHistory>lambdaUpdate()
+                    .eq(PspipeHistory::getId, id).set(PspipeHistory::getIsNew, isNew));
     }
 
-    private  synchronized void updateNodeIsNew(String isNew,Long... id){
-        synchronized (CustomPsHistoryAppServiceImpl.class){
-            boolean update1 = psnodeHistoryService.update(Wrappers.<PsnodeHistory>lambdaUpdate()
-                    .in(PsnodeHistory::getId, id).eq(PsnodeHistory::getIsNew, "1").set(PsnodeHistory::getIsNew, isNew));
-            if(!update1){
-
-            }
-        }
+    private  synchronized void updateNodeIsNew(String isNew,Long id){
+        psnodeHistoryService.update(Wrappers.<PsnodeHistory>lambdaUpdate()
+                    .eq(PsnodeHistory::getId, id).set(PsnodeHistory::getIsNew, isNew));
     }
 
 
@@ -578,4 +650,25 @@ public class CustomPsHistoryAppServiceImpl implements CustomPsHistoryAppService
     }
 
 
+    private void updateNodeByHistory(PsnodeHistory currentForCheckHistory){
+        Psnode oldPsnode = psnodeService.getOne(Wrappers.<Psnode>lambdaQuery().eq(Psnode::getCode, currentForCheckHistory.getCode()));
+        Long oldPspipeId = null;
+        if(oldPsnode!=null){
+            oldPspipeId =  oldPsnode.getId();
+        }
+        BeanUtils.copyProperties(currentForCheckHistory,oldPsnode);
+        oldPsnode.setId(oldPspipeId);
+        psnodeService.saveOrUpdate(oldPsnode);
+    }
+
+    private void updatePipeByHistory(PspipeHistory currentForCheckHistory){
+        Pspipe oldPspipe = pspipeService.getOne(Wrappers.<Pspipe>lambdaQuery().eq(Pspipe::getCode, currentForCheckHistory.getCode()));
+        Long oldPspipeId = null;
+        if(oldPspipe!=null){
+            oldPspipeId =  oldPspipe.getId();
+        }
+        BeanUtils.copyProperties(currentForCheckHistory,oldPspipe);
+        oldPspipe.setId(oldPspipeId);
+        pspipeService.saveOrUpdate(oldPspipe);
+    }
 }

+ 8 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/entity/PsnodeHistory.java

@@ -577,4 +577,12 @@ public class PsnodeHistory extends Model<PsnodeHistory> {
 
     @ApiModelProperty(value = "是否最新  0否1 是")
     private  String isNew;
+
+
+    @ApiModelProperty(value = "审核意见")
+    private  String checkNote;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "通知的监理手机号")
+    private String phone;
 }

+ 7 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/entity/PspipeHistory.java

@@ -660,4 +660,11 @@ public class PspipeHistory extends Model<PspipeHistory> {
     private String childUnitName;
     @ApiModelProperty(value = "是否最新  0否1 是")
     private  String isNew;
+
+    @ApiModelProperty(value = "审核意见")
+    private  String checkNote;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "通知的监理手机号")
+    private String phone;
 }

+ 4 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/mapper/PsnodeHistoryMapper.java

@@ -21,4 +21,8 @@ public interface PsnodeHistoryMapper extends BaseMapper<PsnodeHistory> {
 
     public short getMaxChildUnitVersion(@Param("childUnitCode")String childUnitCode);
 
+    public PsnodeHistory findCurrentForCheckHistory(@Param("code")String pbsCode);
+
+    public Short getMaxModifyVersion(@Param("code") String pbsCode);
+
 }

+ 5 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/mapper/PspipeHistoryMapper.java

@@ -23,4 +23,9 @@ public interface PspipeHistoryMapper extends BaseMapper<PspipeHistory> {
     public PspipeHistory findCurrentHistory(@Param("code") String code);
 
     public short getMaxChildUnitVersion(@Param("childUnitCode")String childUnitCode);
+
+
+    public PspipeHistory findCurrentForCheckHistory(@Param("code") String pbsCode);
+
+    public Short getMaxModifyVersion(@Param("code") String pbsCode);
 }

+ 8 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/service/PsnodeHistoryService.java

@@ -6,6 +6,7 @@ package com.tofly.sxgk.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.tofly.sxgk.entity.PsnodeHistory;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 管点普查历史数据变更表
@@ -20,4 +21,11 @@ public interface PsnodeHistoryService extends IService<PsnodeHistory> {
 
 
     public short  getMaxChildUnitVersion(String childUnitCode);
+
+
+    public PsnodeHistory findCurrentForCheckHistory(String pbsCode);
+
+
+
+    public Short getMaxModifyVersion(String pbsCode,Short defaultValue);
 }

+ 4 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/service/PspipeHistoryService.java

@@ -17,4 +17,8 @@ import com.tofly.sxgk.entity.PspipeHistory;
 public interface PspipeHistoryService extends IService<PspipeHistory> {
     public PspipeHistory findCurrentHistory(String code);
     public short  getMaxChildUnitVersion(String childUnitCode);
+
+    public PspipeHistory findCurrentForCheckHistory(String pbsCode);
+
+    public Short getMaxModifyVersion(String pbsCode,Short defaultValue);
 }

+ 15 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/service/impl/PsnodeHistoryServiceImpl.java

@@ -30,4 +30,19 @@ public class PsnodeHistoryServiceImpl extends ServiceImpl<PsnodeHistoryMapper, P
         return baseMapper.getMaxChildUnitVersion(childUnitCode);
     }
 
+    @Override
+    public PsnodeHistory findCurrentForCheckHistory(String pbsCode) {
+        return baseMapper.findCurrentForCheckHistory(pbsCode);
+    }
+
+    @Override
+    public Short getMaxModifyVersion(String pbsCode,Short defaultValue) {
+        Short maxModifyVersion = baseMapper.getMaxModifyVersion(pbsCode);
+        if(maxModifyVersion==null){
+            return  defaultValue;
+        }else{
+            return  maxModifyVersion;
+        }
+    }
+
 }

+ 15 - 0
sxgk-projet/sxgk/src/main/java/com/tofly/sxgk/service/impl/PspipeHistoryServiceImpl.java

@@ -30,4 +30,19 @@ public class PspipeHistoryServiceImpl extends ServiceImpl<PspipeHistoryMapper, P
         return baseMapper.getMaxChildUnitVersion(childUnitCode);
     }
 
+    @Override
+    public PspipeHistory findCurrentForCheckHistory(String pbsCode) {
+        return baseMapper.findCurrentForCheckHistory(pbsCode);
+    }
+
+    @Override
+    public Short getMaxModifyVersion(String pbsCode,Short defaultValue) {
+        Short maxModifyVersion = baseMapper.getMaxModifyVersion(pbsCode);
+        if(maxModifyVersion==null){
+            return  defaultValue;
+        }else{
+            return  maxModifyVersion;
+        }
+    }
+
 }

+ 24 - 5
sxgk-projet/sxgk/src/main/resources/mapper/PsnodeHistoryMapper.xml

@@ -109,16 +109,21 @@
         <result property="publishVersionSeq" column="publish_version_seq"/>
         <result property="modifyNote" column="modify_note"/>
         <result property="isNew" column="is_new"/>
+        <result property="checkNote" column="check_note"/>
     </resultMap>
 
 
     <select id="findCurrentHistory" resultMap="psnodeHistoryMap">
-        select *from (
-                         select a.*, rank() over(partition by code order by modify_version desc) rk
-                         from tf_ywpn_psnode_history_w a
-                         where code = #{code}
-                     ) where rk = 1
 
+
+                     select *    from tf_ywpn_psnode_history_w a
+                         where code = #{code} and a.is_new='1'
+
+
+    </select>
+    <select id="getMaxModifyVersion" resultType="java.lang.Short">
+        select MAX(modify_version)   from tf_ywpn_psnode_history_w a
+        where code = #{code}
     </select>
 
     <select id="getMaxChildUnitVersion" resultType="java.lang.Short">
@@ -127,4 +132,18 @@
 
 
     </select>
+
+
+    <select id="findCurrentForCheckHistory" resultMap="psnodeHistoryMap">
+        select *
+        from tf_ywpn_psnode_history_w
+        where code = #{code}
+          and is_new = '0'
+          and is_publish = '1'
+          and modify_version =
+              (select max(modify_version)
+               from tf_ywpn_psnode_history_w
+               where code = #{code})
+
+    </select>
 </mapper>

+ 22 - 6
sxgk-projet/sxgk/src/main/resources/mapper/PspipeHistoryMapper.xml

@@ -127,20 +127,36 @@
         <result property="publishVersionSeq" column="PUBLISH_VERSION_SEQ"/>
         <result property="modifyNote" column="modify_note"/>
         <result property="isNew" column="is_new"/>
-
+        <result property="checkNote" column="check_note"/>
     </resultMap>
 
     <select id="findCurrentHistory" resultMap="pspipeHistoryMap">
-        select *from (
-                         select a.*, rank() over(partition by code order by modify_version desc) rk
-                         from tf_ywpn_pspipe_history_w a
-                         where code = #{code}
-                     ) where rk = 1
+        select *    from tf_ywpn_pspipe_history_w a
+        where code = #{code} and a.is_new='1' and a.is_publish='1'
+    </select>
 
+    <select id="getMaxModifyVersion" resultType="java.lang.Short">
+        select MAX(modify_version)   from tf_ywpn_pspipe_history_w a
+        where code = #{code}
     </select>
 
+
     <select id="getMaxChildUnitVersion" resultType="java.lang.Short">
         select nvl(max(PUBLISH_VERSION),0) max_version from tf_ywpn_pspipe_history_w
         where code like #{childUnitCode} ||'%'
     </select>
+
+
+    <select id="findCurrentForCheckHistory" resultMap="pspipeHistoryMap">
+        select *
+        from tf_ywpn_pspipe_history_w
+        where code = #{code}
+          and is_new = '0'
+          and is_publish = '1'
+          and modify_version =
+              (select max(modify_version)
+               from tf_ywpn_pspipe_history_w
+               where code = #{code})
+
+    </select>
 </mapper>

+ 64 - 0
sxgk-projet/sxgk/src/test/java/com/tofly/sxgk/custom/controller/CustomPrjControllerTest.java

@@ -0,0 +1,64 @@
+package com.tofly.sxgk.custom.controller;
+
+import com.tofly.common.core.entity.ResultRespone;
+import com.tofly.sxgk.custom.service.CustomPrjService;
+import com.tofly.sxgk.custom.service.base.BaseTest;
+import com.tofly.sxgk.entity.Structuredetail;
+import com.tofly.sxgk.entity.Useroad;
+import org.checkerframework.checker.units.qual.A;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CustomPrjControllerTest extends BaseTest {
+
+    @Autowired
+    private CustomPrjController customPrjController;
+    @Autowired
+    CustomPrjService customPrjService;
+    @Test
+    @Transactional
+    void updateById() {
+    }
+
+    @Test
+    @Transactional
+    void getList() {
+    }
+
+    @Test
+    @Transactional
+    void getUserList() {
+    }
+
+    @Test
+    @Transactional
+    void listRoadsFilterPrj() {
+
+    }
+
+    @Test
+    @Transactional
+    void addUserRoads() {
+    }
+
+    @Test
+    @Transactional
+    void getUserPrjs() {
+    }
+
+    @Test
+    @Transactional
+    void listPrjInfo() {
+    }
+
+    @Test
+    @Transactional
+    void test1() {
+    }
+}

+ 73 - 0
sxgk-projet/sxgk/src/test/java/com/tofly/sxgk/custom/controller/CustomPsHistoryAppControllerTest.java

@@ -0,0 +1,73 @@
+package com.tofly.sxgk.custom.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.tofly.sxgk.custom.service.CustomPsHistoryAppService;
+import com.tofly.sxgk.custom.service.base.BaseTest;
+import com.tofly.sxgk.entity.Psnode;
+import com.tofly.sxgk.entity.PsnodeHistory;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CustomPsHistoryAppControllerTest extends BaseTest {
+    @Autowired
+    private  CustomPsHistoryAppService customPsHistoryAppService;
+
+    PsnodeHistory psnodeHistory;
+
+
+    @BeforeEach
+    void setUp() {
+       String jsonStr = "{\"latitude\":2,\"longitude\":3,\"pipeId\":\"WW32-test3\",\"prjId\":1,\"pipeCategory\":\"雨水\",\"type\":\"检查井\",\"designSurfaceElev\":\"1\",\"designDepth\":100,\"xcoor\":0,\"ycoor\":0,\"childUnitName\":\"红日社区雨污分流改造工程\"}\n";
+         psnodeHistory = JSON.parseObject(jsonStr, PsnodeHistory.class);
+
+
+    }
+
+    @Test
+    void nodeDesignAdd() {
+        psnodeHistory = customPsHistoryAppService.nodeAdd(psnodeHistory);
+
+    }
+
+    @Test
+    void nodeDesignUpdate() {
+        psnodeHistory.setYCoor(9d);
+        customPsHistoryAppService.nodeUpdate(psnodeHistory,Boolean.TRUE,Boolean.FALSE);
+    }
+
+    @Test
+    @Transactional
+    void nodeDesigndelete() {
+
+        customPsHistoryAppService.nodeDelete(psnodeHistory.getCode());
+    }
+
+    @Test
+    @Transactional
+    void pipeDesignAdd() {
+    }
+
+    @Test
+    @Transactional
+    void pipeDesignUpdate() {
+    }
+
+    @Test
+    @Transactional
+    void pipeDesigndelete() {
+    }
+
+    @Test
+    @Transactional
+    void verionPublish() {
+    }
+
+    @Test
+    @Transactional
+    void checkPass() {
+    }
+}

+ 8 - 1
sxgk-projet/sxgk/src/test/java/service/Test2.java

@@ -3,11 +3,18 @@ package service;
 import com.tofly.sxgk.utils.DateUtils;
 import org.junit.jupiter.api.Test;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
 
 public class Test2 {
     @Test
     public void test2(){
-        System.out.println(DateUtils.getDateListByDays(new Date(),7));
+       List<String> li = new ArrayList<String>();
+       li.add("家园");
+       li.add("国家");
+
+        System.out.println(li.stream().filter(d -> d.equals("家园")).collect(Collectors.toList()).toString());
     }
 }