Browse Source

待挂接增加历史版本状态识别

hujie 1 year ago
parent
commit
5d4e5cb39f

+ 3 - 2
cn.com.taiji.system/src/main/java/cn/com/taiji/zhongxiao/domain/TinfoClass.java

@@ -411,13 +411,14 @@ public class TinfoClass implements Serializable {
      */
     @Column(name = "implementation_userid")
     private String implementationUserid;
-    
+
     /**
      * 实施状态:0-未实施 1-已实施
+     * 对于历史版本,则理解为:2-已实施(已停用)  胡杰 2024年02月27日17:51:59,不想继续追加字段了
      */
     @Column(name = "implementation_state")
     private String implementationState;
-    
+
     public Long getHitchSize() {
 		return hitchSize;
 	}

+ 5 - 0
cn.com.taiji.system/src/main/java/cn/com/taiji/zhongxiao/domain/TinfoClassRepository.java

@@ -14,6 +14,11 @@ public interface TinfoClassRepository extends JpaRepository<TinfoClass, String>,
     @Modifying
     @Query("update TinfoClass c set c.inprocess=:state  where c.id=:busId")
     void updateTinfoClassStateById(@Param("busId") String busId, @Param("state")String state);
+
+	@Transactional
+	@Modifying
+	@Query("update TinfoClass c set c.implementationState=:implementationState  where c.id=:id")
+	void updateImplementationState(@Param("id") String id, @Param("implementationState")String implementationState);
 	
 	//导出Word
 	@Query("select t from TinfoClass t where t.id in (?1)")

+ 12 - 9
cn.com.taiji.system/src/main/java/cn/com/taiji/zhongxiao/dto/TinfoClassDto.java

@@ -277,16 +277,19 @@ public class TinfoClassDto implements Serializable{
      * 实施用户id
      */
     private String implementationUserid;
-    
-    /**
-     * 实施状态:0-未实施 1-已实施
-     */
+
     private String implementationState;
-    
-    
-    
-    
-    
+
+    // 非数据库字段,计算得到 0 不存在历史版本  1 历史版本交换任务未停用  2 历史版本交换任务已停用
+    private Integer parentState = 0;
+
+    public Integer getParentState() {
+        return parentState;
+    }
+
+    public void setParentState(Integer parentState) {
+        this.parentState = parentState;
+    }
     
     public String getCjstartdate() {
 		return cjstartdate;

+ 22 - 2
cn.com.taiji.system/src/main/java/cn/com/taiji/zhongxiao/service/TinfoClassService.java

@@ -23,6 +23,7 @@ import javax.persistence.criteria.Join;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
+import cn.hutool.core.util.StrUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
@@ -537,6 +538,17 @@ public class TinfoClassService {
 
 	return pag;
     }
+
+	public void disableParent(String id) {
+		TinfoClass info = tinfoClassRepository.findOne(id);
+		if (info != null) {
+			TinfoClass parent = tinfoClassRepository.findOne(info.getParentid());
+			if (parent != null) {
+				tinfoClassRepository.updateImplementationState(parent.getId(), "2");
+			}
+		}
+	}
+
     public Pagination<TinfoClassDto> findTinfoClassYsList(final TinfoClassDto dto,
 	    Pagination<TinfoClassDto> pag,final User userInfo) {
 	List<Order> orders = new ArrayList<Sort.Order>();
@@ -686,8 +698,16 @@ public class TinfoClassService {
 	List<TinfoClassDto> dtolsit = new ArrayList<TinfoClassDto>();
 
 	for (TinfoClass u : dataList) {
-
-	    dtolsit.add(new TinfoClassDto(u));
+		TinfoClassDto temp = new TinfoClassDto(u);
+		if (StrUtil.isNotBlank(u.getParentid())) {
+			TinfoClass parent = tinfoClassRepository.findByPid(u.getParentid());
+			if (parent != null && "2".equals(parent.getImplementationState())) {
+				temp.setParentState(2);
+			} else {
+				temp.setParentState(1);
+			}
+		}
+	    dtolsit.add(temp);
 	}
 	pag.setPageResult(dtolsit);
 	pag.setPageCount(page.getTotalPages());

+ 9 - 1
cn.com.taiji.system/src/main/java/cn/com/taiji/zhongxiao/web/TinfoClassHitchController.java

@@ -183,7 +183,7 @@ public class TinfoClassHitchController {
 		dto.setHitchStatus(0);
 		dto.setGjcheckstate("1");
 	}else if("1".equals(gjzt)) {//已挂接
-		dto.setHitchStatus(Integer.parseInt(gjzt));
+		dto.setHitchStatus(1);
 		dto.setGjcheckstate("2");
 	}else {//未挂接
 		dto.setHitchStatus(Integer.parseInt(gjzt));
@@ -206,6 +206,14 @@ public class TinfoClassHitchController {
 	  map.put("count",pageinfo.getPageTotal() );
 	  return map;
     }
+
+	@RequestMapping(value="/disableParent")
+	public @ResponseBody Map disableParent(String id, HttpServletRequest request, HttpServletResponse response) {
+		tinfoClassService.disableParent(id);
+		Map<String, Object> map = new HashMap<>();
+		map.put("remark", "success");
+		return map;
+	}
     
     /**
      * 

+ 35 - 7
cn.com.taiji.system/src/main/resources/static/theme/tinfohitchclass/tinfoclass_yslist.js

@@ -25,15 +25,13 @@ layui.config({
          		 if(res.sharemodetypename!="接口"){
          			str+=  "<a class=\"layui-table-link\" href=\"javascript:void();\"   lay-event=\"gjchange\"><i class=\"iconfont icon-rizhichaxun1\"></i>变更</a>&nbsp;&nbsp;&nbsp;";
              		str+= "<a  class=\"layui-table-link\" href=\"javascript:viewHitchInfo(\'"+res.id+"\');\"><i class=\"iconfont icon-rizhichaxun1\"></i>查看</a>&nbsp;&nbsp;&nbsp;";
-             	  
-         		 }
-         		 else{
-         			 
          		 }
          	}else{
          		str+=  "<a class=\"layui-table-link\" href=\"javascript:void();\"   lay-event=\"gjqk\"><i class=\"iconfont icon-rizhichaxun1\"></i>挂接情况</a>&nbsp;&nbsp;&nbsp;";
-         	 }
-         	 
+				 if(res.parentState == 1) {
+					 str+=  "<a class=\"layui-table-link\" href=\"javascript:void();\"   lay-event=\"disableParent\"><i class=\"iconfont icon-rizhichaxun1\"></i>停用历史版本</a>&nbsp;&nbsp;&nbsp;";
+				 }
+			  }
          	   return str;
            }}
            ,{field:'gjcheckstate', title:'状态',
@@ -153,6 +151,9 @@ layui.config({
             layer.close(index);
           });
         }
+		else if(obj.event === 'disableParent'){
+			disableParent(data.id)
+		}
         else if(obj.event === 'gjqk'){
         	if(data.sharemodetypename=='接口'){
         		var index = layer.open({
@@ -248,7 +249,7 @@ layui.config({
 	}
   /*查看历史版本*/
   function viewVersionList(id){
-		var dgurl="../tinfoclass/tinfoclass_versionlist"+id;
+		var dgurl="../tinfohitchclass/tinfoclass_versionlist"+id;
 		var index = layer.open({
             type: 2,
             title:'历史版本信息',
@@ -261,6 +262,33 @@ layui.config({
           });
 		layer.full(index);
 	}
+
+function disableParent(id){
+
+	if(confirm("确定要设置为历史版本已停用吗?")){
+		var data1={"id":id};
+		$.ajax({
+			async:false,
+			type:"post",
+			url:"../tinfohitchclass/disableParent",
+			contentType: "application/x-www-form-urlencoded;charset=utf-8",
+			dataType: 'json',
+			data:data1,
+			success:function(result){
+				if(result.remark == "success"){
+					layer.msg('提交成功', {icon: 6});
+					window.location.reload();
+				}
+				else {
+					layer.msg('提交失败', {icon: 6});
+				}
+			},
+			error:function(){
+				layer.msg('服务器异常', {icon: 6});
+			}
+		});
+	}
+}
   
   function jianbiaosqlOra(id){
 		jianbiaosql(id,"oracle");