Browse Source

新增页面显示归属部门,涉及添加修改页面,新增一个tag,officecontroller,service的修改,以及sql语句的修改

[user3] 3 years ago
parent
commit
9962730d31

+ 7 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/dao/RuralProjectMessageDao.java

@@ -150,4 +150,11 @@ public interface RuralProjectMessageDao extends CrudDao<RuralProjectRecords> {
      * @return
      */
     Area getProjectReportedAreaByName(@Param("name") String name,@Param("parentId") String parentId);
+
+    /**
+     * 查询开票信息
+     * @param ruralProjectRecords
+     * @return
+     */
+//    Integer findKaiPiao(RuralProjectRecords ruralProjectRecords);
 }

+ 9 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectRecords.java

@@ -280,6 +280,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	private User reportSignatureUploadFileUser;		//签章文件上传人信息
 	private Date reportSignatureUploadDate;		//签章文件上传时间
 
+	private String belongingDepartment;    //归属部门
 
 
 	private List<String> civilProjectList = Lists.newArrayList();
@@ -2027,4 +2028,12 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	public void setSignatureDownloadUrl(String signatureDownloadUrl) {
 		this.signatureDownloadUrl = signatureDownloadUrl;
 	}
+
+	public String getBelongingDepartment() {
+		return belongingDepartment;
+	}
+
+	public void setBelongingDepartment(String belongingDepartment) {
+		this.belongingDepartment = belongingDepartment;
+	}
 }

+ 9 - 0
src/main/java/com/jeeplus/modules/sys/dao/OfficeDao.java

@@ -95,4 +95,13 @@ public interface OfficeDao extends TreeDao<Office> {
 	 * @return
 	 */
 	List<String> getChildrenOffice(String parentId);
+
+
+	/**
+	 * 查询工程一部-五部及其附属的部门信息
+	 * @param office
+	 * @return
+	 */
+	List<Office> findByBelongingDepartment(Office office);
+
 }

+ 11 - 0
src/main/java/com/jeeplus/modules/sys/service/OfficeService.java

@@ -137,6 +137,17 @@ public class OfficeService extends TreeService<OfficeDao, Office> {
 		return offices;
 	}
 
+	//新增显示工程一-五部及五部附属
+	@Transactional(readOnly = true)
+	public List<Office> findByBelongingDepartment(Office office){
+		office.setId(office.getParentIds());
+		office.setParentIds(office.getParentIds()+"%");
+		Office company = UserUtils.getSelectCompany();
+		office.setIsSon(company.getIsSon());
+		List<Office> offices = dao.findByBelongingDepartment(office);
+		return offices;
+	}
+
 	@Transactional(readOnly = true)
 	public List<Office> findByParentIdsByProjectId(Office office){
 		office.setId(office.getParentIds());

+ 46 - 0
src/main/java/com/jeeplus/modules/sys/web/OfficeController.java

@@ -590,6 +590,52 @@ public class OfficeController extends BaseController {
     }
 
     /**
+     * 获取工程一到五部及五部附属的JSON数据。
+     *
+     * @param extId    排除的ID
+     * @param type     类型(1:公司;2:部门/小组/其它:3:用户)
+     * @param grade    显示级别
+     * @param response
+     * @return
+     */
+    @RequiresPermissions("user")
+    @ResponseBody
+    @RequestMapping(value = "treeDataAllByBelongingDepartment")
+    public List<Map<String, Object>> treeDataAllByBelongingDepartment(@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false) String selectName,
+                                                 @RequestParam(required = false) Long grade, @RequestParam(required = false) Boolean isAll, HttpServletResponse response) {
+        List<Map<String, Object>> mapList = Lists.newArrayList();
+        Office office = new Office();
+        office.setParentIds(UserUtils.getSelectCompany().getId());
+        if ("2".equals(type)){
+            //存放部门搜索添加
+            office.setOldName(selectName);
+        }
+//        HashSet<Map<String, Object>> mapSet = new HashSet<>();
+        //查询所有有关部门
+        List<Office> list = officeService.findByBelongingDepartment(office);
+        for (int i = 0; i < list.size(); i++) {
+            Office e = list.get(i);
+            if ((StringUtils.isBlank(extId) || (extId != null && !extId.equals(e.getId()) && e.getParentIds().indexOf("," + extId + ",") == -1))
+                    && (type == null || (type != null && (type.equals("1") ? type.equals(e.getType()) : true)))
+                    && (grade == null || (grade != null && Integer.parseInt(e.getGrade()) <= grade.intValue()))
+                    && Global.YES.equals(e.getUseable())) {
+                Map<String, Object> map = Maps.newHashMap();
+                map.put("id", e.getId());
+                map.put("pId", e.getParentId());
+                map.put("pIds", e.getParentIds());
+                map.put("name", e.getTopCompany());
+                map.put("selectName", selectName);
+
+                mapList.add(map);
+            }
+        }
+
+
+        return mapList;
+    }
+
+
+    /**
      * 获取机构JSON数据。
      *
      * @param extId    排除的ID

+ 10 - 5
src/main/resources/mappings/modules/ruralprojectrecords/RuralProjectRecordsDao.xml

@@ -62,7 +62,8 @@
 		a.report_signature_invalid_document_id as "reportSignatureInvalidDocumentId",
 		a.report_signature_file_name as "reportSignatureFileName",
 		a.report_signature_upload_file_user as "reportSignatureUploadFileUser.id",
-		a.report_signature_upload_date as "reportSignatureUploadDate"
+		a.report_signature_upload_date as "reportSignatureUploadDate",
+		a.belonging_department as "belongingDepartment"
 	</sql>
 
 	<sql id="projectRecordsJoins">
@@ -573,7 +574,8 @@
 			project_properties,
 			submit_scale,
 			emergency_project,
-			reported_state
+			reported_state,
+			belonging_department
 		) VALUES (
 			#{id},
 			#{createBy.id},
@@ -625,7 +627,8 @@
 		    #{projectProperties},
 		    #{submitScale},
 		    #{emergencyProject},
-		    #{reportedState}
+		    #{reportedState},
+		    #{belongingDepartment}
 		)
 	</insert>
 
@@ -669,7 +672,8 @@
 		    estimate_total_fees = #{estimateTotalFees},
 			construction_unit = #{constructionUnit},
 			construction_linkman = #{constructionLinkman},
-			attachment_project_sort = #{attachmentProjectSort}
+			attachment_project_sort = #{attachmentProjectSort},
+			belonging_department = #{belongingDepartment}
 			<if test="projectMasterId != null and projectMasterId != ''">
 				,project_master_id = #{projectMasterId}
 			</if>
@@ -738,7 +742,8 @@
 		    estimate_total_fees = #{estimateTotalFees},
 		    attachment_project_sort = #{attachmentProjectSort},
 			submit_scale = #{submitScale},
-			emergency_project=#{emergencyProject}
+			emergency_project = #{emergencyProject},
+			belonging_department = #{belongingDepartment}
 			<if test="engineeringType != null and engineeringType != ''">
 				,engineering_type =#{engineeringType}
 			</if>

+ 14 - 0
src/main/resources/mappings/modules/sys/OfficeDao.xml

@@ -768,4 +768,18 @@
 	<select id="getChildrenOffice" resultType="java.lang.String">
 		SELECT id FROM sys_office a WHERE a.parent_ids like CONCAT('%',#{parentId},'%') and del_flag = 0
 	</select>
+
+	<select id="findByBelongingDepartment" resultType="Office">
+		SELECT
+		<include refid="officeColumns"/>
+		FROM sys_office a
+		<include refid="officeJoins"/>
+		WHERE a.del_flag = #{DEL_FLAG_NORMAL} AND a.useable = '1' AND (a.code LIKE
+		<if test="dbName == 'mysql'">concat('%','01100','%')</if>
+		OR a.id = #{id} or a.code between 10001008 and 10001012)
+		<if test="oldName != null and oldName != ''">
+			and a.name like concat('%',#{oldName},'%')
+		</if>
+		ORDER BY a.code
+	</select>
 </mapper>

+ 106 - 0
src/main/webapp/WEB-INF/tags/sys/treeselectbelongingDepartment.tag

@@ -0,0 +1,106 @@
+<%@ tag language="java" pageEncoding="UTF-8"%>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<%@ attribute name="id" type="java.lang.String" required="true" description="编号"%>
+<%@ attribute name="name" type="java.lang.String" required="true" description="隐藏域名称(ID)"%>
+<%@ attribute name="value" type="java.lang.String" required="true" description="隐藏域值(ID)"%>
+<%@ attribute name="labelName" type="java.lang.String" required="true" description="输入框名称(Name)"%>
+<%@ attribute name="labelValue" type="java.lang.String" required="true" description="输入框值(Name)"%>
+<%@ attribute name="title" type="java.lang.String" required="true" description="选择框标题"%>
+<%@ attribute name="url" type="java.lang.String" required="true" description="树结构数据地址"%>
+<%@ attribute name="checked" type="java.lang.Boolean" required="false" description="是否显示复选框,如果不需要返回父节点,请设置notAllowSelectParent为true"%>
+<%@ attribute name="extId" type="java.lang.String" required="false" description="排除掉的编号(不能选择的编号)"%>
+<%@ attribute name="isAll" type="java.lang.Boolean" required="false" description="是否列出全部数据,设置true则不进行数据权限过滤(目前仅对Office有效)"%>
+<%@ attribute name="notAllowSelectRoot" type="java.lang.Boolean" required="false" description="不允许选择根节点"%>
+<%@ attribute name="notAllowSelectParent" type="java.lang.Boolean" required="false" description="不允许选择父节点"%>
+<%@ attribute name="module" type="java.lang.String" required="false" description="过滤栏目模型(只显示指定模型,仅针对CMS的Category树)"%>
+<%@ attribute name="selectScopeModule" type="java.lang.Boolean" required="false" description="选择范围内的模型(控制不能选择公共模型,不能选择本栏目外的模型)(仅针对CMS的Category树)"%>
+<%@ attribute name="allowClear" type="java.lang.Boolean" required="false" description="是否允许清除"%>
+<%@ attribute name="allowInput" type="java.lang.Boolean" required="false" description="文本框可填写"%>
+<%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%>
+<%@ attribute name="cssStyle" type="java.lang.String" required="false" description="css样式"%>
+<%@ attribute name="smallBtn" type="java.lang.Boolean" required="false" description="缩小按钮显示"%>
+<%@ attribute name="hideBtn" type="java.lang.Boolean" required="false" description="是否显示按钮"%>
+<%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择,如果限制,设置为disabled"%>
+<%@ attribute name="dataMsgRequired" type="java.lang.String" required="false" description=""%>
+<%@ attribute name="rule" type="java.lang.String" required="false" description="考勤规则模块用"%>
+<input id="${id}Id" name="${name}" class="${cssClass}" type="hidden" value="${value}" />
+<div class="input-group">
+    <input id="${id}Name" placeholder="请选择${title}" name="${labelName}"  type="text" value="${labelValue}" data-msg-required="${dataMsgRequired}"
+           class="${cssClass}" style="${cssStyle}"/>
+    <span class="input-group-btn">
+	       		 <button type="button"  id="${id}Button" class="btn <c:if test="${fn:contains(cssClass, 'input-sm')}"> btn-sm </c:if><c:if test="${fn:contains(cssClass, 'input-lg')}"> btn-lg </c:if>  btn-primary ${disabled} ${hideBtn ? 'hide' : ''}"><i class="fa fa-search"></i>
+	             </button>
+       		 </span>
+
+</div>
+<label id="${id}Name-error" class="error" for="${id}Name" style="display:none"></label>
+<script type="text/javascript">
+    $("#${id}Button").click(function(){
+        // 是否限制选择,如果限制,设置为disabled
+        if ($("#${id}Button").hasClass("disabled")){
+            return true;
+        }
+        // 正常打开
+        top.layer.open({
+            type: 2,
+            area: ['300px', '420px'],
+            title:"选择${title}",
+            ajaxData:{selectIds: $("#${id}Id").val()},
+            content: "${ctx}/tag/treeselect?url="+encodeURIComponent("${url}")+"&module=${module}&checked=${checked}&extId=${extId}&isAll=${isAll}&unit=${unit}" ,
+            btn: ['确定', '关闭']
+            ,yes: function(index, layero){ //或者使用btn1
+                var tree = layero.find("iframe")[0].contentWindow.tree;//h.find("iframe").contents();
+                var ids = [], names = [], nodes = [];
+                if ("${checked}" == "true"){
+                    nodes = tree.getCheckedNodes(true);
+                }else{
+                    nodes = tree.getSelectedNodes();
+                }
+                for(var i=0; i<nodes.length; i++) {//<c:if test="${checked && notAllowSelectParent}">
+                    if (nodes[i].isParent){
+                        continue; // 如果为复选框选择,则过滤掉父节点
+                    }//</c:if><c:if test="${notAllowSelectRoot}">
+                    if (nodes[i].level == 0){
+                        //top.$.jBox.tip("不能选择根节点("+nodes[i].name+")请重新选择。");
+                        top.layer.msg("不能选择根节点("+nodes[i].name+")请重新选择。", {icon: 0});
+                        return false;
+                    }//</c:if><c:if test="${notAllowSelectParent}">
+                    if (nodes[i].isParent){
+                        //top.$.jBox.tip("不能选择父节点("+nodes[i].name+")请重新选择。");
+                        //layer.msg('有表情地提示');
+                        top.layer.msg("不能选择父节点("+nodes[i].name+")请重新选择。", {icon: 0});
+                        return false;
+                    }//</c:if><c:if test="${not empty module && selectScopeModule}">
+                    if (nodes[i].module == ""){
+                        //top.$.jBox.tip("不能选择公共模型("+nodes[i].name+")请重新选择。");
+                        top.layer.msg("不能选择公共模型("+nodes[i].name+")请重新选择。", {icon: 0});
+                        return false;
+                    }else if (nodes[i].module != "${module}"){
+                        //top.$.jBox.tip("不能选择当前栏目以外的栏目模型,请重新选择。");
+                        top.layer.msg("不能选择当前栏目以外的栏目模型,请重新选择。", {icon: 0});
+                        return false;
+                    }//</c:if>
+                    ids.push(nodes[i].id);
+                    names.push(nodes[i].name);//<c:if test="${!checked}">
+                    break; // 如果为非复选框选择,则返回第一个选择  </c:if>
+                }
+                $("#${id}Id").val(ids.join(",").replace(/u_/ig,"")).change();
+                $("#${id}Name").val(names.join(",")).change();
+                $("#${id}Name").focus();
+                var rule="${rule}";
+                var id="${id}";
+                if(rule=='rule'){
+                    var _placeName =  id.split("_")[0]+"_placeName";
+                    var _itude =  id.split("_")[0]+"_itude";
+                    $("#"+_placeName).val("");
+                    $("#"+_itude).val("");
+                }
+                top.layer.close(index);
+            },
+            cancel: function(index){ //或者使用btn2
+                //按钮【按钮二】的回调
+            }
+        });
+
+    });
+</script>

+ 7 - 0
src/main/webapp/webpage/modules/ruralprojectrecords/cost/ruralCostProjectRecordsAdminModify.jsp

@@ -882,6 +882,13 @@
                     </div>
                 </div>
                 <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label">归属部门:</label>
+                    <div class="layui-input-block  with-icon">
+                        <sys:treeselectbelongingDepartment id="belongingDepartment" name="belongingDepartmentName" value="${ruralProjectRecords.belongingDepartment}" labelName="belongingDepartment" labelValue="${ruralProjectRecords.belongingDepartment}"
+                                                           cssStyle="background-color:#fff" title="归属部门" url="/sys/office/treeDataAllByBelongingDepartment?type=2" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="true"/>
+                    </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">
                         <button type="button" class="layui-btn layui-btn-primary" style="width: 100%;text-align: left" id="demo100">

+ 7 - 0
src/main/webapp/webpage/modules/ruralprojectrecords/cost/ruralCostProjectRecordsForm.jsp

@@ -1063,6 +1063,13 @@
                     </div>
                 </div>
                 <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label">归属部门:</label>
+                    <div class="layui-input-block  with-icon">
+                        <sys:treeselectbelongingDepartment id="belongingDepartment" name="belongingDepartmentName" value="${ruralProjectRecords.belongingDepartment}" labelName="belongingDepartment" labelValue="${ruralProjectRecords.belongingDepartment}"
+                                                    cssStyle="background-color:#fff" title="归属部门" url="/sys/office/treeDataAllByBelongingDepartment?type=2" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="true"/>
+                    </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">
 <%--                        <select name="engineeringType">--%>

+ 6 - 0
src/main/webapp/webpage/modules/ruralprojectrecords/view/ruralProjectRecordsView.jsp

@@ -242,6 +242,12 @@
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6 lw6">
+					<label class="layui-form-label">归属部门:</label>
+					<div class="layui-input-block">
+						<input htmlEscape="false" style="background-color: #f1f1f1" readonly="true" id="belongingDepartment" class="form-control layui-input" value="${projectRecords.belongingDepartment}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6 lw6">
 					<label class="layui-form-label">项目负责人:</label>
 					<div class="layui-input-block">
 						<input htmlEscape="false" style="background-color: #f1f1f1" readonly="true" class="form-control layui-input" value="${projectRecords.projectMasterName}"/>