Sfoglia il codice sorgente

部门名称取当前部门的最大一级

huZhiHao 5 anni fa
parent
commit
d82a8fa6b7

+ 8 - 8
src/main/java/platform/common/util/word/ExportWord.java

@@ -162,14 +162,14 @@ public class ExportWord {
         XWPFTable table = document.getTableArray(0);
         fillTableData(table, tableData);
         //测试页眉设置
-        CTP ctp = CTP.Factory.newInstance();
-        XWPFParagraph paragraph_ = new XWPFParagraph(ctp, document);//段落对象
-        ctp.addNewR().addNewT().setStringValue("华丽的测试页眉2019051488888888");//设置页眉参数
-        ctp.addNewR().addNewT().setSpace(SpaceAttribute.Space.PRESERVE);
-        CTSectPr sectPr = document.getDocument().getBody().isSetSectPr() ? document.getDocument().getBody().getSectPr() : document.getDocument().getBody().addNewSectPr();
-        XWPFHeaderFooterPolicy policy = new XWPFHeaderFooterPolicy(document, sectPr);
-        XWPFHeader header = policy.createHeader(STHdrFtr.DEFAULT, new XWPFParagraph[]{paragraph_});
-        header.setXWPFDocument(document);
+//        CTP ctp = CTP.Factory.newInstance();
+//        XWPFParagraph paragraph_ = new XWPFParagraph(ctp, document);//段落对象
+//        ctp.addNewR().addNewT().setStringValue("华丽的测试页眉2019051488888888");//设置页眉参数
+//        ctp.addNewR().addNewT().setSpace(SpaceAttribute.Space.PRESERVE);
+//        CTSectPr sectPr = document.getDocument().getBody().isSetSectPr() ? document.getDocument().getBody().getSectPr() : document.getDocument().getBody().addNewSectPr();
+//        XWPFHeaderFooterPolicy policy = new XWPFHeaderFooterPolicy(document, sectPr);
+//        XWPFHeader header = policy.createHeader(STHdrFtr.DEFAULT, new XWPFParagraph[]{paragraph_});
+//        header.setXWPFDocument(document);
 
         xwpfHelper.saveDocument(document, response);
     }

+ 280 - 20
src/main/java/platform/modules/government/service/IndustrialLandSupplyDetailService.java

@@ -138,7 +138,9 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
 
                 IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
                 industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
-                industrialLandSupplyConsultation.setDepartment_id(user.getDepartment_id() + "");
+                //industrialLandSupplyConsultation.setDepartment_id(user.getDepartment_id() + "");
+                Department department = departmentService.findRootById(user.getDepartment_id());
+                industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
                 List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
                 boolean sumbitToSummary = false;
                 for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
@@ -157,7 +159,8 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 for (UserGroup userGroup : userGroups) {
                     if (Objects.equals(userGroup.getUser_id(), user.getId())) {
 
-                        Department department = departmentService.selectById(user.getDepartment_id());
+                        //Department department = departmentService.selectById(user.getDepartment_id());
+                        department = departmentService.findRootById(user.getDepartment_id());
                         if (sumbitToSummary) {
                             entity.setApprove_status_desc(department.getName() + "已反馈");
                             entity.setApprove_status("a");
@@ -171,7 +174,9 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
 
                 IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
                 industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
-                industrialLandSupplyDistribution.setDepartment_id(user.getDepartment_id() + "");
+                //industrialLandSupplyDistribution.setDepartment_id(user.getDepartment_id() + "");
+                Department department = departmentService.findRootById(user.getDepartment_id());
+                industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
                 List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
                 boolean sumbitToSummary = false;
                 for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
@@ -190,7 +195,8 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 for (UserGroup userGroup : userGroups) {
                     if (Objects.equals(userGroup.getUser_id(), user.getId())) {
 
-                        Department department = departmentService.selectById(user.getDepartment_id());
+                        //Department department = departmentService.selectById(user.getDepartment_id());
+                        department = departmentService.findRootById(user.getDepartment_id());
                         if (sumbitToSummary) {
                             entity.setApprove_status_desc(department.getName() + "已反馈");
                             entity.setApprove_status("a");
@@ -419,7 +425,9 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
 
         IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
         industrialLandSupplyConsultation.setIndustrial_land_supply_id(id);
-        industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
+        //industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
+        Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
+        industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
         industrialLandSupplyConsultation.setDel_flag(false);
         List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
         for (IndustrialLandSupplyConsultation landSupplyConsultation : industrialLandSupplyConsultationList) {
@@ -429,14 +437,15 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 FileDown fileDown = new FileDown(feedbackAttachments.get(0).getId(), feedbackAttachments.get(0).getFile_name(), feedbackAttachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
                 landSupplyConsultation.setFileDown(fileDown);
             }
-            Department department = departmentService.selectById(Integer.valueOf(landSupplyConsultation.getDepartment_id()));
-            landSupplyConsultation.setDepartment_name(department.getName());
+            Department depart = departmentService.selectById(Integer.valueOf(landSupplyConsultation.getDepartment_id()));
+            landSupplyConsultation.setDepartment_name(depart.getName());
         }
         entity.setConsultationList(industrialLandSupplyConsultationList);
 
         IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
         industrialLandSupplyDistribution.setIndustrial_land_supply_id(id);
-        industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
+        //industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
+        industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
         industrialLandSupplyDistribution.setDel_flag(false);
         List<IndustrialLandSupplyDistribution> industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
         for (IndustrialLandSupplyDistribution landSupplyDistribution : industrialLandSupplyDistributionList) {
@@ -454,8 +463,8 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 FileDown fileDown = new FileDown(attachmentList.get(0).getId(), attachmentList.get(0).getFile_name(), attachmentList.get(0).getFile_url(), attachmentList.get(0).getDownload_uri());
                 landSupplyDistribution.setFeedback_file(fileDown);
             }
-            Department department = departmentService.selectById(Integer.valueOf(landSupplyDistribution.getDepartment_id()));
-            landSupplyDistribution.setDepartment_name(department.getName());
+            Department depart = departmentService.selectById(Integer.valueOf(landSupplyDistribution.getDepartment_id()));
+            landSupplyDistribution.setDepartment_name(depart.getName());
         }
         entity.setDistributionList(industrialLandSupplyDistributionList);
 
@@ -591,7 +600,9 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             consulApprovalList = approvalService.findListByWhere(approval);
 
             IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
-            industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
+            //industrialLandSupplyConsultation.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
+            Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
+            industrialLandSupplyConsultation.setDepartment_id(department.getId() + "");
             industrialLandSupplyConsultation.setDel_flag(false);
             industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
         }
@@ -603,7 +614,9 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             distApprovalList = approvalService.findListByWhere(approval);
 
             IndustrialLandSupplyDistribution industrialLandSupplyDistribution = new IndustrialLandSupplyDistribution();
-            industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
+            //industrialLandSupplyDistribution.setDepartment_id(ShiroUtils.getUserEntity().getDepartment_id() + "");
+            Department department = departmentService.findRootById(ShiroUtils.getUserEntity().getDepartment_id());
+            industrialLandSupplyDistribution.setDepartment_id(department.getId() + "");
             industrialLandSupplyDistribution.setDel_flag(false);
             industrialLandSupplyDistributionList = industrialLandSupplyDistributionService.findListByWhere(industrialLandSupplyDistribution);
         }
@@ -924,10 +937,8 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
 //        params.put("apply_name", Constant.ProjectType.PROJECT_INTELLIGENT);
 //        String templateCode = Constant.SMS_TemplateCode.RPOJECT_APPROVAL_REMIND;
 
-        if (CommonUtils.isNull(approval)
-                || Objects.equals(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW, approval.getAfter_approvalstatus())
-                || Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT, approval.getAfter_approvalstatus())) {
-            //待属地提交 或  属地撤回  或  商务局受理员待提交--》待商务局受理员审核 或 待咨询反馈
+        if (CommonUtils.isNull(approval)) {
+            //待属地提交 --》待商务局受理员审核 或 待咨询反馈
 
             IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
             industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
@@ -987,7 +998,7 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 for (User user : users) {
                     if (Objects.equals(user.getId(), userGroup.getUser_id())) {
                         sb.append(userGroup.getUser_id() + ",");
-//                        String message = user.getUser_name() + ",您好。“" + company.getCompany_name() + "企业”的“" + projectName + "项目”申请需要您审核。谢谢。";
+//                        String message = user.getUser_name() +0 ",您好。“" + company.getCompany_name() + "企业”的“" + projectName + "项目”申请需要您审核。谢谢。";
 //                        messages.setContent(message);
 //                        int[] streetArrInt = new int[1];
 //                        streetArrInt[0] = userGroup.getUser_id();
@@ -1033,8 +1044,182 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
             approvalService.insertAndGetId(newApproval);
             return true;
+        } else if (Objects.equals(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW, approval.getAfter_approvalstatus())) {
+            //属地撤回 --》待商务局受理员审核 或 待咨询反馈
+
+            IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
+            industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
+            industrialLandSupplyConsultation.setDel_flag(false);
+            List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
+            boolean sumbitToLeader = false;
+            if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
+                //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
+                sumbitToLeader = true;
+            }
+            Group group = null;
+            newApproval.setOper_type(Constant.OperType.SUBMIT);
+            if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
+                newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.PLATE_WITHDRAW);
+                newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
+                group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
+                if (null == group) {
+                    throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
+                }
+            } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
+                newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
+                //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
+                if (!sumbitToLeader) {
+                    newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
+                    group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
+                    if (null == group) {
+                        throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
+                    }
+                } else {
+                    //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
+                    //临时跳过商务领导审核
+                    newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
+                    //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
+                    //临时跳过商务领导审核
+                    group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
+                    if (null == group) {
+                        //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
+                        //临时跳过商务领导审核
+                        throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
+                    }
+                }
+            }
+
+            List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
+            List<User> users = userService.findListByWhere(new User());
+            StringBuffer sb = new StringBuffer("");
+            for (UserGroup userGroup : userGroups) {
+                for (User user : users) {
+                    if (Objects.equals(user.getId(), userGroup.getUser_id())) {
+                        sb.append(userGroup.getUser_id() + ",");
+                    }
+                }
+            }
+            newApproval.setNextchecker(sb.toString());
+            if (sb.length() == 0) {
+                if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
+                    throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
+                } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
+                    if (!sumbitToLeader) {
+                        throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
+                    } else {
+                        //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
+                        //临时跳过商务领导审核
+                        throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
+                    }
+                }
+            }
+            IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
+            entity.setId(applyId);
+            if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
+                entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
+            } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
+                //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
+                if (!sumbitToLeader) {
+                    entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
+                } else {
+                    //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
+                    //临时跳过商务领导审核
+                    entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
+                }
+            }
+            entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
+            industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
+            approvalService.insertAndGetId(newApproval);
+            return true;
+        } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT, approval.getAfter_approvalstatus())) {
+            //商务局受理员待提交--》待商务局受理员审核 或 待咨询反馈
+
+            IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
+            industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
+            industrialLandSupplyConsultation.setDel_flag(false);
+            List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
+            boolean sumbitToLeader = false;
+            if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
+                //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
+                sumbitToLeader = true;
+            }
+            Group group = null;
+            newApproval.setOper_type(Constant.OperType.SUBMIT);
+            if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
+                newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
+                newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
+                group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_1);
+                if (null == group) {
+                    throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
+                }
+            } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
+                newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_SUBMIT);
+                //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
+                if (!sumbitToLeader) {
+                    newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
+                    group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
+                    if (null == group) {
+                        throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
+                    }
+                } else {
+                    //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
+                    //临时跳过商务领导审核
+                    newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
+                    //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
+                    //临时跳过商务领导审核
+                    group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
+                    if (null == group) {
+                        //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
+                        //临时跳过商务领导审核
+                        throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
+                    }
+                }
+            }
+
+            List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
+            List<User> users = userService.findListByWhere(new User());
+            StringBuffer sb = new StringBuffer("");
+            for (UserGroup userGroup : userGroups) {
+                for (User user : users) {
+                    if (Objects.equals(user.getId(), userGroup.getUser_id())) {
+                        sb.append(userGroup.getUser_id() + ",");
+                    }
+                }
+            }
+            newApproval.setNextchecker(sb.toString());
+            if (sb.length() == 0) {
+                if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
+                    throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_1 + "没有该项目责任单位的人员,请联系管理员配置");
+                } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
+                    if (!sumbitToLeader) {
+                        throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
+                    } else {
+                        //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
+                        //临时跳过商务领导审核
+                        throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
+                    }
+                }
+            }
+            IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
+            entity.setId(applyId);
+            if (Constant.UserType.STREET.equals(ShiroUtils.getUserType())) {
+                entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE);
+            } else if (Constant.UserType.GOVERNMENT.equals(ShiroUtils.getUserType())) {
+                //如果提交了咨询信息进入待反馈 未提交直接进入商务局分管领导审核
+                if (!sumbitToLeader) {
+                    entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
+                } else {
+                    //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
+                    //临时跳过商务领导审核
+                    entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
+                }
+            }
+            entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
+            industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
+            approvalService.insertAndGetId(newApproval);
+            return true;
         } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_HANDLE, approval.getAfter_approvalstatus())) {
-            //待商务局受理员审核  --》 待咨询反馈
+            //待商务局受理员审核 --》 待咨询反馈
 
             IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
             industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
@@ -1091,6 +1276,77 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 }
             }
 
+            IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
+            entity.setId(applyId);
+            if (sumbitToLeader) {
+                //entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
+                //临时跳过商务领导审核
+                entity.setApprove_status(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
+            } else {
+                entity.setApprove_status(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
+            }
+            entity.setProcess_stage(Constant.LandSupplyApproveStage.PRE_AUDIT);
+            industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
+            approvalService.insertAndGetId(newApproval);
+            return true;
+        } else if (Objects.equals(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN, approval.getAfter_approvalstatus())) {
+            //预审退回 --》 待咨询反馈
+
+            IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
+            industrialLandSupplyConsultation.setIndustrial_land_supply_id(applyId + "");
+            industrialLandSupplyConsultation.setDel_flag(false);
+            List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = industrialLandSupplyConsultationService.findListByWhere(industrialLandSupplyConsultation);
+            boolean sumbitToLeader = false;
+            if (CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
+                sumbitToLeader = true;
+            }
+
+            Group group = null;
+            newApproval.setBefore_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_RETURN);
+            if (sumbitToLeader) {
+                newApproval.setOper_type(Constant.OperType.SUBMIT);
+                //newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_PENDING_HANDLE);
+                //临时跳过商务领导审核
+                newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.MANAGEMENT_COMMITTEE_LEADER_PENDING_HANDLE);
+                //group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_3);
+                //临时跳过商务领导审核
+                group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_4);
+                if (null == group) {
+                    //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
+                    //临时跳过商务领导审核
+                    throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
+                }
+            } else {
+                newApproval.setOper_type(Constant.OperType.DISTRIBUTE);
+                newApproval.setAfter_approvalstatus(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK);
+                group = groupService.findByNameOnly(Constant.INDUSTRIALLANDSUPPLY_2);
+                if (null == group) {
+                    throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
+                }
+            }
+            List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
+            List<User> users = userService.findListByWhere(new User());
+            StringBuffer sb = new StringBuffer("");
+            for (UserGroup userGroup : userGroups) {
+                for (User user : users) {
+                    if (Objects.equals(user.getId(), userGroup.getUser_id())) {
+                        sb.append(userGroup.getUser_id() + ",");
+                    }
+                }
+            }
+            newApproval.setNextchecker(sb.toString());
+            if (sumbitToLeader) {
+                if (sb.length() == 0) {
+                    //throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_3 + "没有该项目责任单位的人员,请联系管理员配置");
+                    //临时跳过商务领导审核
+                    throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_4 + "没有该项目责任单位的人员,请联系管理员配置");
+                }
+            } else {
+                if (sb.length() == 0) {
+                    throw new BaseException("操作失败," + Constant.INDUSTRIALLANDSUPPLY_2 + "没有该项目责任单位的人员,请联系管理员配置");
+                }
+            }
+
             IndustrialLandSupplyDetail entity = new IndustrialLandSupplyDetail();
             entity.setId(applyId);
             if (sumbitToLeader) {
@@ -1928,7 +2184,9 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
         for (UserGroup userGroup : userGroups) {
             for (User user : users) {
                 if (Objects.equals(user.getId(), userGroup.getUser_id())) {
-                    list.add(departmentService.selectById(user.getDepartment_id()));
+                    //list.add(departmentService.selectById(user.getDepartment_id()));
+                    //获取根目录部门
+                    list.add(departmentService.findRootById(user.getDepartment_id()));
                 }
             }
         }
@@ -1954,7 +2212,9 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
         for (UserGroup userGroup : userGroups) {
             for (User user : users) {
                 if (Objects.equals(user.getId(), userGroup.getUser_id())) {
-                    list.add(departmentService.selectById(user.getDepartment_id()));
+                    //list.add(departmentService.selectById(user.getDepartment_id()));
+                    //获取根目录部门
+                    list.add(departmentService.findRootById(user.getDepartment_id()));
                 }
             }
         }

+ 0 - 6
src/main/java/platform/modules/government/web/IndustrialLandSupplyController.java

@@ -2,7 +2,6 @@
 package platform.modules.government.web;
 
 import com.github.pagehelper.PageInfo;
-import org.apache.poi.xwpf.usermodel.XWPFDocument;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
@@ -15,7 +14,6 @@ import platform.common.base.service.DictionaryItemService;
 import platform.common.exception.BaseException;
 import platform.common.util.CommonUtils;
 import platform.common.util.ShiroUtils;
-import platform.common.util.word.ExportWord;
 import platform.modules.company.dto.LandSupplyApprovalDto;
 import platform.modules.government.dto.IndustrialLandSupplyDto;
 import platform.modules.government.dto.IndustrialLandSupplyParam;
@@ -28,11 +26,7 @@ import platform.modules.sys.web.ResponseMessage;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 产业供地

+ 105 - 85
src/main/java/platform/modules/sys/service/DepartmentService.java

@@ -44,32 +44,32 @@ public class DepartmentService extends BaseService<Department> {
     private UserService userService;
 
 
-    @Transactional(readOnly=true)
+    @Transactional(readOnly = true)
     public List<TreeNode> findTreeList() {
-        Integer streetId=null;
-        Integer buildId=null;
-        Integer companyId=null;
-        if(ShiroUtils.getUserType().equals(Constant.UserType.STREET)){
-            streetId=ShiroUtils.getStreetId();
-        }else if(ShiroUtils.getUserType().equals(Constant.UserType.BUILD)){
-            buildId=ShiroUtils.getBuildId();
-        }else if(ShiroUtils.getUserType().equals(Constant.UserType.COMPANY)){
-            companyId=ShiroUtils.getCompanyId();
+        Integer streetId = null;
+        Integer buildId = null;
+        Integer companyId = null;
+        if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
+            streetId = ShiroUtils.getStreetId();
+        } else if (ShiroUtils.getUserType().equals(Constant.UserType.BUILD)) {
+            buildId = ShiroUtils.getBuildId();
+        } else if (ShiroUtils.getUserType().equals(Constant.UserType.COMPANY)) {
+            companyId = ShiroUtils.getCompanyId();
         }
-        return departmentDao.findTreeList(ShiroUtils.getUserType(),streetId,buildId,companyId);
+        return departmentDao.findTreeList(ShiroUtils.getUserType(), streetId, buildId, companyId);
     }
 
 
-    public Boolean deleteDepartment(Integer departmentId)throws BaseException {
+    public Boolean deleteDepartment(Integer departmentId) throws BaseException {
         //是否子节点
-        List<Department> departments=departmentDao.findByDepartmentId(departmentId);
-        if(null!=departments&&departments.size()>0){
+        List<Department> departments = departmentDao.findByDepartmentId(departmentId);
+        if (null != departments && departments.size() > 0) {
             throw new BaseException("该组织名称有子节点,不能删除");
         }
         //是否有用户引用
-        User user=userDao.getUserByDepartmentId(departmentId);
-        if(null!=user){
-            throw new BaseException("该组织名称已被使用,不能删除"); 
+        User user = userDao.getUserByDepartmentId(departmentId);
+        if (null != user) {
+            throw new BaseException("该组织名称已被使用,不能删除");
         }
         //删除角色
         int count1 = this.deleteById(departmentId);
@@ -104,87 +104,87 @@ public class DepartmentService extends BaseService<Department> {
 
 
     @Transactional(readOnly = true)
-    public Department findByName(String name,Integer id) {
-    	Department deptCondition = new Department();
-    	deptCondition.setUser_type(ShiroUtils.getUserType());
-    	if(ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
-    		deptCondition.setStreet_id(ShiroUtils.getStreetId());
-    	}else if(ShiroUtils.getUserType().equals(Constant.UserType.BUILD)) {
-    		deptCondition.setStreet_id(ShiroUtils.getBuildId());
-    	}else if(ShiroUtils.getUserType().equals(Constant.UserType.COMPANY)) {
-    		deptCondition.setStreet_id(ShiroUtils.getCompanyId());
-    	}
-        return departmentDao.findByDepartmentName(name,id,deptCondition);
+    public Department findByName(String name, Integer id) {
+        Department deptCondition = new Department();
+        deptCondition.setUser_type(ShiroUtils.getUserType());
+        if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
+            deptCondition.setStreet_id(ShiroUtils.getStreetId());
+        } else if (ShiroUtils.getUserType().equals(Constant.UserType.BUILD)) {
+            deptCondition.setStreet_id(ShiroUtils.getBuildId());
+        } else if (ShiroUtils.getUserType().equals(Constant.UserType.COMPANY)) {
+            deptCondition.setStreet_id(ShiroUtils.getCompanyId());
+        }
+        return departmentDao.findByDepartmentName(name, id, deptCondition);
     }
 
     public int[] findDepartmentIdByName(List<String> departments) {
         return departmentDao.findDepartmentIdByName(departments);
     }
 
-    public PageInfo<Department> findDepartmentByGroupNamePageInfo(Integer pageNum,Integer pageSize,String keyWords,Integer type,Integer id) {
+    public PageInfo<Department> findDepartmentByGroupNamePageInfo(Integer pageNum, Integer pageSize, String keyWords, Integer type, Integer id) {
         List<Department> departments = new ArrayList<>();
-        if(type == 1){
+        if (type == 1) {
             PageHelper.startPage(pageNum, pageSize);
-            departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ,keyWords,null);
-        }else{
+            departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ, keyWords, null);
+        } else {
             //补发
             //查询出最近的一条分送各部门的审批数据
-            Approval approval = approvalService.findLastByCheckerAndBeforeStatu(id,Constant.DictionaryType.STOCKLAND,null,Constant.LandApproveStatus.PENDING_DISTRIBUTE);
+            Approval approval = approvalService.findLastByCheckerAndBeforeStatu(id, Constant.DictionaryType.STOCKLAND, null, Constant.LandApproveStatus.PENDING_DISTRIBUTE);
             List<String> nextCheckers = Arrays.asList(approval.getNextchecker().split(","));
 
             Set<Integer> set = new HashSet<>();
-            for(String checker:nextCheckers){
+            for (String checker : nextCheckers) {
                 User user = userService.findById(Integer.valueOf(checker));
-                if(null != user){
+                if (null != user) {
                     Department department = departmentService.findById(user.getDepartment_id());
-                    if(null != department){
+                    if (null != department) {
                         set.add(department.getId());
                     }
                 }
 
             }
 
-            if(null != nextCheckers && nextCheckers.size() >0){
+            if (null != nextCheckers && nextCheckers.size() > 0) {
                 PageHelper.startPage(pageNum, pageSize);
-                departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ,keyWords,set);
-            }else{
+                departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ, keyWords, set);
+            } else {
                 PageHelper.startPage(pageNum, pageSize);
-                departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ,keyWords,null);
+                departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ, keyWords, null);
             }
         }
 
         return new PageInfo<Department>(departments);
     }
 
-    public List<Department> findDepartListmentByGroupName(Integer pageNum,Integer pageSize,String keyWords,Integer type,Integer id) {
+    public List<Department> findDepartListmentByGroupName(Integer pageNum, Integer pageSize, String keyWords, Integer type, Integer id) {
         List<Department> departments = new ArrayList<>();
-        if(type == 1){
+        if (type == 1) {
             //PageHelper.startPage(pageNum, pageSize);
-            departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ,keyWords,null);
-        }else{
+            departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ, keyWords, null);
+        } else {
             //补发
             //查询出最近的一条分送各部门的审批数据
-            Approval approval = approvalService.findLastByCheckerAndBeforeStatu(id,Constant.DictionaryType.STOCKLAND,null,Constant.LandApproveStatus.PENDING_DISTRIBUTE);
+            Approval approval = approvalService.findLastByCheckerAndBeforeStatu(id, Constant.DictionaryType.STOCKLAND, null, Constant.LandApproveStatus.PENDING_DISTRIBUTE);
             List<String> nextCheckers = Arrays.asList(approval.getNextchecker().split(","));
 
             Set<Integer> set = new HashSet<>();
-            for(String checker:nextCheckers){
+            for (String checker : nextCheckers) {
                 User user = userService.findById(Integer.valueOf(checker));
-                if(null != user){
+                if (null != user) {
                     Department department = departmentService.findById(user.getDepartment_id());
-                    if(null != department){
+                    if (null != department) {
                         set.add(department.getId());
                     }
                 }
 
             }
 
-            if(null != nextCheckers && nextCheckers.size() >0){
+            if (null != nextCheckers && nextCheckers.size() > 0) {
                 //PageHelper.startPage(pageNum, pageSize);
-                departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ,keyWords,set);
-            }else{
+                departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ, keyWords, set);
+            } else {
                 //PageHelper.startPage(pageNum, pageSize);
-                departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ,keyWords,null);
+                departments = departmentDao.findDepartmentByGroupNamePageInfo(Constant.HGXSHXZ, keyWords, null);
             }
         }
 
@@ -193,44 +193,44 @@ public class DepartmentService extends BaseService<Department> {
 
 
     /**
-     * 
      * findDepartment(查询没有被删除的部门)
+     *
      * @return List<Department>
      */
-	public List<Department> findDepartment() {
-		Example example = new Example(Department.class);
-		Criteria criteria = example.createCriteria();
-		criteria.andEqualTo("del_flag", false);
-		List<Department> departmentList = this.selectByExample(example);
-		return departmentList;
-	}
-
-
-	public Department selectById(Integer did) {
-		Example example = new Example(Department.class);
-		Criteria criteria = example.createCriteria();
-		criteria.andEqualTo("id", did);
-		criteria.andEqualTo("del_flag", false);
-		List<Department> departmentList = this.selectByExample(example);
-		Department department = null;
-		if (departmentList != null && departmentList.size() > 0) {
-			department = departmentList.get(0);
-		}
-		return department;
-	}
-
-
-	public Integer selectMaxId() {
-		return departmentDao.selectMaxId();
-	}
-
-	//根据userId 查找所有部门
-	public List<Department> getAllUserDepts(List<String> userIdArr) {
-		return departmentDao.getAllUserDepts(userIdArr);
-	}
+    public List<Department> findDepartment() {
+        Example example = new Example(Department.class);
+        Criteria criteria = example.createCriteria();
+        criteria.andEqualTo("del_flag", false);
+        List<Department> departmentList = this.selectByExample(example);
+        return departmentList;
+    }
+
+
+    public Department selectById(Integer did) {
+        Example example = new Example(Department.class);
+        Criteria criteria = example.createCriteria();
+        criteria.andEqualTo("id", did);
+        criteria.andEqualTo("del_flag", false);
+        List<Department> departmentList = this.selectByExample(example);
+        Department department = null;
+        if (departmentList != null && departmentList.size() > 0) {
+            department = departmentList.get(0);
+        }
+        return department;
+    }
+
+
+    public Integer selectMaxId() {
+        return departmentDao.selectMaxId();
+    }
+
+    //根据userId 查找所有部门
+    public List<Department> getAllUserDepts(List<String> userIdArr) {
+        return departmentDao.getAllUserDepts(userIdArr);
+    }
 
     public Department findByDepartmentName(String department) {
-	    return departmentDao.findByDepartmentName(department, null, new Department());
+        return departmentDao.findByDepartmentName(department, null, new Department());
     }
 
     public List<Department> findByPid(Integer pid) {
@@ -244,10 +244,30 @@ public class DepartmentService extends BaseService<Department> {
 
     /**
      * 获取部门名和父级部门
+     *
      * @return
      */
     public List<DepartmentDto> findDepartmentList() {
 
         return departmentDao.findDepartmentList();
     }
+
+    public Department findRootById(Integer id) {
+
+        Department res = new Department();
+
+        Example example = new Example(Department.class);
+        Criteria criteria = example.createCriteria();
+        criteria.andEqualTo("del_flag", false);
+        criteria.andEqualTo("id", id);
+        List<Department> departmentList = this.selectByExample(example);
+        for (Department department : departmentList) {
+            if (Objects.equals(department.getParent_id(), 0)) {
+                res = department;
+            } else {
+                res = findRootById(department.getParent_id());
+            }
+        }
+        return res;
+    }
 }