浏览代码

人员添加管理员功能,项目添加管理员删除功能和修改报告号功能

user5 2 年之前
父节点
当前提交
a48c2e0105

+ 12 - 15
src/main/java/com/jeeplus/modules/feedback/service/QuestionFeedbackService.java

@@ -5,14 +5,9 @@ package com.jeeplus.modules.feedback.service;
 
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.CrudService;
-import com.jeeplus.common.utils.Collections3;
-import com.jeeplus.common.utils.MenuStatusEnum;
 import com.jeeplus.common.utils.StringUtils;
-import com.jeeplus.modules.examplesingle.dao.ExampleSingleDao;
-import com.jeeplus.modules.examplesingle.entity.ExampleSingle;
 import com.jeeplus.modules.feedback.dao.QuestionFeedbackDao;
 import com.jeeplus.modules.feedback.entity.QuestionFeedback;
-import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,16 +39,18 @@ public class QuestionFeedbackService extends CrudService<QuestionFeedbackDao, Qu
 		List<QuestionFeedback> questionFeedbackList = findList(questionFeedback);
 		for (QuestionFeedback feedback : questionFeedbackList) {
 			User user=UserUtils.get(feedback.getCreateBy().getId());
-			feedback.setCreateBy(user);
-			if (feedback.getHandlingId()!=null && StringUtils.isNotBlank(feedback.getHandlingId().getId())){
-				User u=UserUtils.get(feedback.getHandlingId().getId());
-				feedback.setHandlingId(u);
-			}
-			User uu=UserUtils.getUser();
-			if (feedback.getCreateBy().getId()==uu.getId()){
-				feedback.setFlag("1");
-			}else{
-				feedback.setFlag("0");
+			if(null != user){
+				feedback.setCreateBy(user);
+				if (feedback.getHandlingId()!=null && StringUtils.isNotBlank(feedback.getHandlingId().getId())){
+					User u=UserUtils.get(feedback.getHandlingId().getId());
+					feedback.setHandlingId(u);
+				}
+				User uu=UserUtils.getUser();
+				if (feedback.getCreateBy().getId().equals(uu.getId())){
+					feedback.setFlag("1");
+				}else{
+					feedback.setFlag("0");
+				}
 			}
 		}
 		page.setList(questionFeedbackList);

+ 2 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectRecordsService.java

@@ -305,7 +305,8 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 
 	public Page<RuralProjectRecords> findPage(Page<RuralProjectRecords> page, RuralProjectRecords projectRecords) {
 		//设置数据权限
-        if(!UserUtils.getUser().isAdmin()) {
+		User user = UserUtils.getUser();
+		if(!UserUtils.getUser().getAdminFlag()) {
 			String dataScopeSql = null;
 			//判断查询为工程咨询信息
 			if("1".equals(projectRecords.getProjectType())){

+ 1 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectRecordsController.java

@@ -719,7 +719,7 @@ public class RuralCostProjectRecordsController extends BaseController {
     public String adminDelete(RuralProjectRecords projectRecords, RedirectAttributes redirectAttributes) {
         String flag = projectRecords.getCompanyType();
         int status = projectRecords.getProjectStatus();
-        if (status == ProjectStatusEnum.SIGNED.getValue()) {
+        if (status == ProjectStatusEnum.SIGNED.getValue() || status == ProjectStatusEnum.INVALID.getValue()) {
             projectRecordsService.adminDelete(projectRecords);
             addMessage(redirectAttributes, "管理员删除项目成功");
             return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralCostProjectRecords/?repage&companyType="+flag;

+ 13 - 3
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectRecordsController.java

@@ -130,7 +130,7 @@ public class RuralProjectRecordsController extends BaseController {
     @RequiresPermissions("ruralProject:ruralProjectRecords:list")
     @RequestMapping(value = {"list", ""})
     public String list(RuralProjectRecords projectRecords, HttpServletRequest request, HttpServletResponse response, Model model) {
-        //添加标识
+        //添加标识 companyType 0: 东兴; 1:赣能; 2:一达嘉鸿
         String flag = projectRecords.getCompanyType();
         model.addAttribute("companyType", flag);
         if (UserUtils.isManager()) {
@@ -504,8 +504,18 @@ public class RuralProjectRecordsController extends BaseController {
      */
     @RequestMapping(value = "adminModify")
     public String adminModify(RuralProjectRecords projectRecords, Model model) {
+        String companyType = projectRecords.getCompanyType();
+        model.addAttribute("companyType",companyType);
         projectRecords = projectRecordsService.get(projectRecords.getId());
+
+        //根据归属部门Id查询归属部门名称显示
+        String belongingDepartmentName = projectRecordsService.getBelongingDepartmentNameByBelongingDepartment(projectRecords.getBelongingDepartment());
+        model.addAttribute("belongingDepartmentName", belongingDepartmentName);
+
         projectRecordsService.queryProjectDetail(projectRecords);
+        //查询项目报告信息
+        ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(projectRecords.getId());
+        projectRecords.setReportData(projectReportData);
         ProjectPlanInfo projectPlanInfo = new ProjectPlanInfo();
         projectPlanInfo.setProjectId(projectRecords.getId());
         if (null != projectRecords.getWorkContractInfo()) {
@@ -544,7 +554,7 @@ public class RuralProjectRecordsController extends BaseController {
             }
         }
         //根据审核人id获取审核人
-        if (StringUtils.isNotBlank(projectRecords.getReviewerPersonId())) {
+        if(StringUtils.isNotBlank(projectRecords.getReviewerPersonId())){
 
             projectRecords.setReviewerPerson(userInfoService.findUserById(projectRecords.getReviewerPersonId()).getName());
         }
@@ -590,7 +600,7 @@ public class RuralProjectRecordsController extends BaseController {
     public String adminDelete(RuralProjectRecords projectRecords, RedirectAttributes redirectAttributes) {
         String flag = projectRecords.getCompanyType();
         int status = projectRecords.getProjectStatus();
-        if (status == ProjectStatusEnum.SIGNED.getValue()) {
+        if (status == ProjectStatusEnum.SIGNED.getValue() || status == ProjectStatusEnum.INVALID.getValue()) {
             projectRecordsService.adminDelete(projectRecords);
             addMessage(redirectAttributes, "管理员删除项目成功");
             return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralProjectRecords/?repage&companyType=" + flag;

+ 12 - 5
src/main/java/com/jeeplus/modules/sys/entity/User.java

@@ -11,12 +11,10 @@ import com.jeeplus.common.persistence.DataEntity;
 import com.jeeplus.common.utils.Collections3;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.utils.excel.annotation.ExcelField;
-import com.jeeplus.common.utils.excel.fieldtype.RoleListType;
 import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
 import org.hibernate.validator.constraints.Email;
 import org.hibernate.validator.constraints.Length;
 
-import javax.validation.constraints.NotNull;
 import java.util.Date;
 import java.util.List;
 
@@ -102,6 +100,7 @@ public class User extends DataEntity<User> {
 
     private String weChatId;
     private String auditUserId;  //总审人员id
+    private Boolean adminFlag;  //是否为admin(0:不是;1:是)
 
 	public String getWeChatId() {
 		return weChatId;
@@ -393,11 +392,11 @@ public class User extends DataEntity<User> {
 	public String getRoleNames() {
 		return Collections3.extractToString(roleList, "name", ",");
 	}
-	
+
 	public boolean isAdmin(){
 		return isAdmin(this.id);
 	}
-	
+
 	public static boolean isAdmin(String id){
 		return id != null && "1".equals(id);
 	}
@@ -587,7 +586,15 @@ public class User extends DataEntity<User> {
 	public void setAuditUserId(String auditUserId) {
 		this.auditUserId = auditUserId;
 	}
-	//	public String getPosition() {
+
+	public Boolean getAdminFlag() {
+		return adminFlag;
+	}
+
+	public void setAdminFlag(Boolean adminFlag) {
+		this.adminFlag = adminFlag;
+	}
+//	public String getPosition() {
 //		return position;
 //	}
 //

+ 2 - 0
src/main/resources/mappings/modules/sys/UserDao.xml

@@ -89,6 +89,7 @@
 		a.del_flag,
 		a.first_flag AS "firstFlag",
 		a.audit_user_id AS "auditUserId",
+		a.is_admin AS "adminFlag",
 		s.name AS "company.name",
 		s.parent_id AS "company.parent.id",
 		s.parent_ids AS "company.parentIds",
@@ -102,6 +103,7 @@
 		bo.id AS "branchOffice.id",
 		bo.name AS "branchOffice.name",
 		bo.parent_ids AS "branchOffice.parentIds",
+		bo.parent_ids AS "branchOffice.parentIds",
 		bo.parent_id AS "branchOffice.parent.id"<!-- ,
         r.id AS "role.id",
         r.office_id AS "role.office.id",

+ 7 - 3
src/main/webapp/webpage/modules/ruralprojectrecords/cost/ruralCostProjectRecordsList.jsp

@@ -629,7 +629,7 @@
                             xml+="<a href=\"${ctx}/ruralProject/ruralCostProjectRecords/revoke?id=" + d.id + "&processInstanceId=" + d.procId + "&companyType=${companyType}&projectStatus="+d.projectStatus+"\" onclick=\"return confirmx('确认要撤回该项目审批吗?', this.href)\" class=\"layui-btn layui-btn-xs layui-bg-red\" > 撤回</a>";
                         }
 						//项目在没有归档完成之前可对文档进行操作
-						if(d.recordStatus != undefined && d.recordStatus =="1")
+						if(d.recordStatus != undefined && d.recordStatus =="1" && d.projectStatus != "7" && d.projectStatus != "8")
 						{
 							xml+="<a href=\"#\" onclick=\"openDialogView('文件上传', '${ctx}/ruralProject/ruralCostProjectRecords/formAccessory?companyType=${companyType}&id=" + d.id + "','95%', '95%')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" > 上传文件</a>";
 							/*xml+="<a href=\"#\" onclick=\"btnImport('" + d.id + "')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" > 导入压缩文件</a>";*/
@@ -687,7 +687,7 @@
                     ,"canrecall":<c:choose><c:when test="${projectRecords.projectStatus == 3 && fns:getUser().id == projectRecords.createBy.id}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
                     </shiro:hasPermission>
                     ,"cancancel":<c:choose><c:when test="${projectRecords.projectStatus == 2 && fns:getUser().id == projectRecords.createBy.id}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
-                    ,"deleteAdmin":<c:choose><c:when test="${'1' == projectRecords.flagAdmin && projectRecords.projectStatus == 5}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
+
                     ,"modifyRecords":<c:choose><c:when test="${fns:getUser().id == projectRecords.createBy.id && '2' != projectRecords.projectReportStatus && '5' != projectRecords.projectReportStatus && projectRecords.projectStatus == 5}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
                     <c:if test="${'1' == projectRecords.flagAdmin}">
                         ,"reportDataFlag":<c:choose><c:when test="${'0' == projectRecords.reportDataFlag && projectRecords.projectStatus == 5}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
@@ -702,7 +702,6 @@
                     ,"canedit2":"0"
                     ,"canrecall":"0"
                     ,"cancancel":"0"
-                    ,"deleteAdmin":"0"
                     ,"recordStatus":"0"
                     </c:otherwise>
                     </c:choose>
@@ -731,6 +730,11 @@
 								<c:otherwise>"0"</c:otherwise>
 							</c:choose>
 					</shiro:hasPermission>
+
+					<shiro:hasPermission name="ruralProject:ruralProjectMessageAll:adminDelete">
+					,"deleteAdmin":<c:choose><c:when test="${'1' == projectRecords.projectStatus || '4' == projectRecords.projectStatus || '5' == projectRecords.projectStatus || '7' == projectRecords.projectStatus}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
+					</shiro:hasPermission>
+
 					<shiro:hasPermission name="ruralProject:ruralProjectView:costView">
 					,"showView":1
 					</shiro:hasPermission>

+ 30 - 0
src/main/webapp/webpage/modules/ruralprojectrecords/ruralProjectRecordsAdminModify.jsp

@@ -647,6 +647,29 @@
                 }
             })
         }
+        function reReportDataNumber(obj) {
+            var number=$(obj).val()
+            var reportDataId = $("#reportDataId").val();
+            var reportNumber='${projectRecords.reportData.number}'
+            $.ajax({
+                type : "POST",
+                url : "${ctx}/ruralProject/ruralProjectRecords/reReportDataNumber",
+                data : {'number':number,'reportDataId':reportDataId},
+                //请求成功
+                success : function(result) {
+                    if (result>0){
+                        if(reportNumber!=number){
+                            $(obj).val(reportNumber);
+                            parent.layer.msg("报告号已存在!",{icon:2});
+                        }
+                    }
+                }
+            })
+        }
+
+        function num(obj){
+            obj.value = obj.value.replace(/[^\d]/g,""); //清除"数字"以外的字符
+        }
 	</script>
 </head>
 <body >
@@ -654,6 +677,7 @@
     <div class="container">
 		<form:form id="inputForm" modelAttribute="projectRecords" enctype="multipart/form-data" action="${ctx}/ruralProject/ruralProjectRecords/adminUpdate" method="post" class="form-horizontal layui-form">
 		    <form:hidden path="id"/>
+            <form:hidden path="reportData.id" id="reportDataId" value="${reportData.id}"/>
             <form:hidden path="workContractInfo.client.id" id="contractClientId" value="${workContractInfo.client.id}"/>
             <input type="hidden" id="flagFile" value="">
 
@@ -763,6 +787,12 @@
                         </div>
                     </div>
                 </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>报告号:</label>
+                    <div class="layui-input-block">
+                        <form:input path="reportData.number" placeholder="请输入报告号" onchange="reReportDataNumber(this)" htmlEscape="false"  class="form-control layui-input required"/>
+                    </div>
+                </div>
                 <%--<div class="layui-item layui-col-sm6 lw7">--%>
                     <%--<label class="layui-form-label">规模类型:</label>--%>
                     <%--<div class="layui-input-block">--%>

+ 5 - 3
src/main/webapp/webpage/modules/ruralprojectrecords/ruralProjectRecordsList.jsp

@@ -566,7 +566,7 @@
                             xml+="<a href=\"${ctx}/ruralProject/ruralProjectRecords/revoke?companyType=${companyType}&id=" + d.id + "&processInstanceId=" + d.procId + "&projectStatus="+d.projectStatus+"\" onclick=\"return confirmx('确认要撤回该项目审批吗?', this.href)\" class=\"layui-btn layui-btn-xs layui-bg-red\" > 撤回</a>";
                         }
                         //项目在没有归档完成之前可对文档进行操作
-                        if(d.recordStatus != undefined && d.recordStatus =="1")
+						if(d.recordStatus != undefined && d.recordStatus =="1" && d.projectStatus != "7" && d.projectStatus != "8")
                         {
 							xml+="<a href=\"#\" onclick=\"openDialogView('文件上传', '${ctx}/ruralProject/ruralProjectRecords/formAccessory?companyType=${companyType}&id=" + d.id + "','95%', '95%')\" class=\"layui-btn layui-btn-xs layui-bg-blue\" > 上传文件</a>";
                         }
@@ -623,7 +623,6 @@
                     </shiro:hasPermission>
                     ,"cancancel":<c:choose><c:when test="${projectRecords.projectStatus == 2 && fns:getUser().id == projectRecords.createBy.id}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
 
-                    ,"deleteAdmin":<c:choose><c:when test="${'1' == projectRecords.flagAdmin && projectRecords.projectStatus == 5}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
 					,"modifyRecords":<c:choose><c:when test="${fns:getUser().id == projectRecords.createBy.id && '2' != projectRecords.projectReportStatus && '5' != projectRecords.projectReportStatus && projectRecords.projectStatus == 5}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
 					<c:if test="${'1' == projectRecords.flagAdmin}">
 						,"reportDataFlag":<c:choose><c:when test="${'0' == projectRecords.reportDataFlag && projectRecords.projectStatus == 5}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
@@ -638,7 +637,6 @@
                     ,"canedit2":"0"
                     ,"canrecall":"0"
                     ,"cancancel":"0"
-                    ,"deleteAdmin":"0"
                     ,"recordStatus":"0"
                     </c:otherwise>
                     </c:choose>
@@ -670,6 +668,10 @@
 					<shiro:hasPermission name="ruralProject:ruralProjectView:consultingView">
 					,"showView":1
 					</shiro:hasPermission>
+
+					<shiro:hasPermission name="ruralProject:ruralProjectMessageAll:adminDelete">
+					,"deleteAdmin":<c:choose><c:when test="${'1' == projectRecords.projectStatus || '4' == projectRecords.projectStatus || '5' == projectRecords.projectStatus || '7' == projectRecords.projectStatus}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
+					</shiro:hasPermission>
                 }
                 </c:forEach>
                 </c:if>