Explorar o código

合同增加删除和作废

[user3] %!s(int64=4) %!d(string=hai) anos
pai
achega
2ef9aa0d4b

+ 7 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/dao/WorkContractInfoDao.java

@@ -90,4 +90,11 @@ public interface WorkContractInfoDao extends CrudDao<WorkContractInfo> {
      * @return
      */
     List<User> getUserByRole(String roleName);
+
+    /**
+     * 获取该合同下被调用的次数
+     * @param id
+     * @return
+     */
+    Integer findContractBycount(String id);
 }

+ 10 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/entity/WorkContractInfo.java

@@ -151,6 +151,8 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 
 	private String contractInformation; //合同金额类别
 
+	private boolean cancelDelFalg; //合同作废和删除判定
+
 	public String getBeginInvestmentAmount() {
 		return beginInvestmentAmount;
 	}
@@ -1081,4 +1083,12 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 	public void setDescribeContent(String describeContent) {
 		this.describeContent = describeContent;
 	}
+
+	public boolean isCancelDelFalg() {
+		return cancelDelFalg;
+	}
+
+	public void setCancelDelFalg(boolean cancelDelFalg) {
+		this.cancelDelFalg = cancelDelFalg;
+	}
 }

+ 19 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractInfoService.java

@@ -3270,4 +3270,23 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 	public List<Integer> getYear(WorkContractListInfo workContractListInfo){
 		return dao.getYear(workContractListInfo);
 	}
+
+	/**
+	 * 获取该合同下被调用的次数
+	 * @param id
+	 * @return
+	 */
+	public Integer findContractBycount(String id){
+		return dao.findContractBycount(id);
+	}
+
+	/**
+	 * 逻辑删除
+	 * @param id
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public int deleteByLogic(String id){
+		return dao.deleteByLogic(id);
+	}
 }

+ 16 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/web/WorkContractInfoController.java

@@ -262,6 +262,13 @@ public class WorkContractInfoController extends BaseController {
                         break;
                     }
                 }
+                //查询合同是否被项目调用
+                Integer count=workContractInfoService.findContractBycount(info.getId());
+                if (count>0){
+                    info.setCancelDelFalg(false);
+                }else{
+                    info.setCancelDelFalg(true);
+                }
             }
         }
         model.addAttribute("page", page);
@@ -1259,6 +1266,15 @@ public class WorkContractInfoController extends BaseController {
         return "redirect:" + Global.getAdminPath() + "/workcontractinfo/workContractInfo/?repage";
     }
     /**
+     * 删除合同管理
+     */
+    @RequestMapping(value = "deleteContract")
+    public String deleteContract(WorkContractInfo workContractInfo, RedirectAttributes redirectAttributes) {
+        workContractInfoService.deleteByLogic(workContractInfo.getId());
+        addMessage(redirectAttributes, "删除合同完成成功");
+        return "redirect:" + Global.getAdminPath() + "/workcontractinfo/workContractInfo/?repage";
+    }
+    /**
      * 删除合同变更
      */
     @RequestMapping(value = "alterdelete")

+ 5 - 0
src/main/resources/mappings/modules/workcontractinfo/WorkContractInfoDao.xml

@@ -1325,5 +1325,10 @@
 		left join sys_role sr on sr.id = sur.role_id
 		where sr.name = #{roleName}
 	</select>
+    <select id="findContractBycount" resultType="java.lang.Integer">
+		select count(r.id) FROM  work_contract_info a
+	    LEFT JOIN rural_project_records r on r.contract_id=a.id
+		where a.id=#{id}
+	</select>
 
 </mapper>

+ 31 - 2
src/main/webapp/webpage/modules/workcontractinfo/workContractInfoList.jsp

@@ -830,7 +830,15 @@
 							if(d.giveBorrow != undefined && d.giveBorrow == "1")
 								xml +="<a href=\"${ctx}/workContractBorrow/workContractBorrow/updateGiveDate?id=" + d.borrowId + "&home=contract\" onclick=\"return confirmx('确认归还该合同信息吗?', this.href)\"   class=\"layui-btn layui-btn-xs layui-bg-orange\"> 归还合同</a>";
 						}
-                        xml+="</div>"
+                        //作废和删除
+						if (d.cancel != undefined && d.cancel == "1"){
+							xml += "<a href=\"${ctx}/workcontractinfo/workContractInfo/delete?id=" + d.id + "&contractState="+d.status+"\" onclick=\"return confirmx('确认要作废该合同信息吗?', this.href)\" class=\"layui-btn layui-btn-xs layui-bg-red\" > 合同作废</a>";
+						}
+						if (d.cancelDel != undefined && d.cancelDel == "1"){
+							xml += "<a href=\"${ctx}/workcontractinfo/workContractInfo/deleteContract?id=" + d.id + "\" onclick=\"return confirmx('确认要删除该合同吗?', this.href)\"   class=\"layui-btn layui-btn-xs layui-bg-red\"> 合同删除</a>";
+						}
+
+						xml+="</div>"
                         return xml;
 
                     }}
@@ -911,10 +919,31 @@
 						</c:choose>
 					</shiro:hasPermission>
 					<shiro:hasPermission name="workcontractrecord:workContractRecord:revert">,"giveBorrow":	<c:choose><c:when test="${workContractInfo.borrowStatus == '5' && workContractInfo.giveStatus != '5'}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose></shiro:hasPermission>
+					<c:choose>
+						<c:when test="${fns:getUser().id == workContractInfo.createBy.id}">
+							<c:if test="${workContractInfo.cancelDelFalg && workContractInfo.contrractRecordStatus !=2 && workContractInfo.contrractRecordStatus !=5}">
+								<c:if test="${workContractInfo.contractState != 7 && workContractInfo.contractState !=4}">
+									,"cancel":"1"
+								</c:if>
+								,"cancelDel":"1"
+							</c:if>
+						</c:when>
+						<c:otherwise>
+							<shiro:hasPermission name="workcontractinfo:workContractInfo:adminCancelDel">
+								<c:if test="${workContractInfo.cancelDelFalg && workContractInfo.contrractRecordStatus !=2 && workContractInfo.contrractRecordStatus !=5}">
+									<c:if test="${workContractInfo.contractState != 7 && workContractInfo.contractState !=4}">
+									,"cancel":"1"
+									</c:if>
+								,"cancelDel":"1"
+								</c:if>
+							</shiro:hasPermission>
+						</c:otherwise>
+					</c:choose>
                 }
                 </c:forEach>
                 </c:if>
-            ]
+
+				]
             // ,even: true
             // ,height: 315
         });